This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-23
Channels
- # announcements (3)
- # architecture (10)
- # babashka (37)
- # beginners (69)
- # calva (2)
- # cider (10)
- # clerk (22)
- # clj-kondo (33)
- # cljdoc (44)
- # clojure (45)
- # clojure-conj (4)
- # clojure-denmark (7)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojurescript (10)
- # clr (19)
- # conjure (1)
- # emacs (28)
- # events (1)
- # fulcro (1)
- # jobs (1)
- # joyride (1)
- # lsp (18)
- # malli (30)
- # membrane (3)
- # off-topic (23)
- # pathom (45)
- # portal (29)
- # proletarian (7)
- # rdf (15)
- # re-frame (21)
- # reagent (2)
- # releases (6)
- # remote-jobs (1)
- # reveal (6)
- # shadow-cljs (36)
- # slack-help (7)
- # sql (5)
- # tools-deps (3)
years ago there was a package(s) which allowed helm searching clojars and yanking the version does anyone remember what this was called or have a similar workflow implemented to search clojars and get the mvn coordinates? thx
I don't remember the package but cljr-add-project-dependency
seemed to offer similar functionality (and also automatically adding this to your project, even hotloading the dependency when it was working properly)
You might also be able to use Neil's Emacs UI: https://github.com/babashka/neil#emacs-integration
> I don't remember the package cljr-add-project-dependency seemed to offer similar functionality (and also automatically adding this to your project, even hotloading the dependency when it was working properly)
ooh yeah i think this is the one, do you happen to know if it still works?
https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-project-dependency did work many years ago when I last used clj-refactor package Hotloading the library into the dependence did stop working, although I assume clojars API hasn't changed so the adding of dependency should still work
I assume app project dependencies only works for Leiningen projects.
Find-versions can be used for Clojure CLI (deps.edn) projects, specifying the library-name
to search for
Clojure -X:deps find-versions :lib library-name
Note: Update after misreading docs... sorry https://clojure.org/reference/deps_and_cli#find-versions^^ is missing :lib
following up on this, there is a way to have a similar workflow to the now defunct cljr-refactor-hotload-dependency
functionality
1. get cljr-add-project-dependency
working with correct version numbers for cider-nrepl
and refactor-nrepl
, this gives the auto-complete search of clojars from emacs (search only, nothing else)
a. for whatever reason when running the above it mangles my deps.edn
. if that happens to you, try the following to simply push the mvn coordinate to kill ring
(defun cljr-add-project-dependency-print (force)
"Add a dependency to the project.clj file.
See: "
(interactive "P")
(cljr--ensure-op-supported "artifact-list")
(when-let ((lib-name (thread-last (cljr--get-artifacts-from-middleware force)
(cljr--prompt-user-for "Artifact: ")))
(version (thread-last (cljr--get-versions-from-middleware lib-name)
(cljr--prompt-user-for "Version: "))))
(kill-new (concat lib-name " {:mvn/version \"" version "\"}"))))
2. Download + Install https://github.com/lambdaisland/classpath which will watch your deps.edn and do the reloading
3. call cljr-add-project-dependency
(or the modified one), to update deps.edn
4. Hopefully classpath
will download and load the lib into you running repl
Additional Steps for Embedded Repl (aka cider-connect vs cider-jack-in)
ā¢ add the following deps
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}
cider/cider-nrepl {:mvn/version "0.30.0"}
ā¢ redefine cider-nrepl-handler
like so
(def cider-nrepl-handler-custom
"We build our own custom nrepl handler, mimicking CIDER's."
(apply nrepl.server/default-handler
(conj cider.nrepl.middleware/cider-middleware 'refactor-nrepl.middleware/wrap-refactor)))
ā¢ launch repl as before referencing new handler
(defonce server (start-server :port 42069
:host "0.0.0.0"
:bind "0.0.0.0"
:handler cider-nrepl-handler-custom
))
There's also magit-log-trace-definition
- it shows the log of changes for a selected function. There's a caveat though https://twitter.com/iLemming/status/1058507343372021760v
You have to set it up to make it work for Clojure.
I just started using ob-clojure and am trying to figure out what's up with result output.
#+begin_src clojure
(+ 1 1)
#+end_src
#+RESULTS:
nothing is printed in results, but anything printed does.
#+begin_src clojure :results pp
(+ 1 1)
#+end_src
#+RESULTS:
: 2
I tried this with babashka and clj-cli backends, maybe it has something to do with shell backends? Should it be showing values without explicitly printing?it looks like it's because it invokes bb sometestfile.clj
which doesn't output return values
@U036QHV2M4Z which bb version is this?
bb used to print return values before 1.1.171 (released today) but this is now opt-in using the --prn
flag
thanks @U04V15CAJ! sounds like ob-clojure needs an update
looks like https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ob-clojure.el?h=main#n274, I can try it out real quick
I'm using GNU Emacs 28.2 (build 2, aarch64-apple-darwin22.1.0, NS appkit-2299.00 Version 13.0.1 (Build 22A400)) of 2023-01-02 and had to pull the latest org to get it. I have no idea how updates or for that matter contributions work
oh man, I'll do this tonight if nobody gets to it first https://orgmode.org/worg/org-contribute.html#first-patch
It seems @UFAP0C8KU also contributed to this
Since a few week, I have a patch laying around to solve the different output behaviours. The cider backend was not consistent with the normal bable conventions and babashka and nbb where different with the last return value which apparently is now fixed since today š
@U036QHV2M4Z no need to write a patch as I have the code already. I'm also the current maintainer of ob-clojure so I'm allowed to push to the repo.. i.e. it doesn't take month until the patch gets installed š
Btw, just adding --prn
isn't enough, it keeps asking if it should execute return values in parens (basically any list return values) as elisp. I imagine there's some 'not elisp!' setting somewhere
following up on this, there is a way to have a similar workflow to the now defunct cljr-refactor-hotload-dependency
functionality
1. get cljr-add-project-dependency
working with correct version numbers for cider-nrepl
and refactor-nrepl
, this gives the auto-complete search of clojars from emacs (search only, nothing else)
a. for whatever reason when running the above it mangles my deps.edn
. if that happens to you, try the following to simply push the mvn coordinate to kill ring
(defun cljr-add-project-dependency-print (force)
"Add a dependency to the project.clj file.
See: "
(interactive "P")
(cljr--ensure-op-supported "artifact-list")
(when-let ((lib-name (thread-last (cljr--get-artifacts-from-middleware force)
(cljr--prompt-user-for "Artifact: ")))
(version (thread-last (cljr--get-versions-from-middleware lib-name)
(cljr--prompt-user-for "Version: "))))
(kill-new (concat lib-name " {:mvn/version \"" version "\"}"))))
2. Download + Install https://github.com/lambdaisland/classpath which will watch your deps.edn and do the reloading
3. call cljr-add-project-dependency
(or the modified one), to update deps.edn
4. Hopefully classpath
will download and load the lib into you running repl
Additional Steps for Embedded Repl (aka cider-connect vs cider-jack-in)
ā¢ add the following deps
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}
cider/cider-nrepl {:mvn/version "0.30.0"}
ā¢ redefine cider-nrepl-handler
like so
(def cider-nrepl-handler-custom
"We build our own custom nrepl handler, mimicking CIDER's."
(apply nrepl.server/default-handler
(conj cider.nrepl.middleware/cider-middleware 'refactor-nrepl.middleware/wrap-refactor)))
ā¢ launch repl as before referencing new handler
(defonce server (start-server :port 42069
:host "0.0.0.0"
:bind "0.0.0.0"
:handler cider-nrepl-handler-custom
))