How do I choose/switch Leiningen profiles with Emacs nREPL?
I have a :dev profile set up in my leiningen project file. This defines an :init and :init-ns setting for my repl session. If I launch nrepl in emacs (Mx nrepl-jack-in) with the cursor over the :dev keyword in my project.clj, the repl launches and the :init and :init-ns settings are used. If I have my cursor elsewhere, the initial namespace is different (a test ns, not user), and :init hasn't been evaluated.
I'm guessing it's a feature of some sort, (I'm more inclined to think it's random buggy behaviour now) but can anyone explain it or point me at the docs that do so? Also, is there any way to change the profile once the repl's been launched?
Thanks
Contrary to what commenter @user7610 said, there is no cider-jack-in-with-profile
function in cider. Cider pull-request #544 was a bit misleading in that regard.
If you want cider to load your own special-snowflake
profile do this in emacs:
Mx set-variable cider-lein-parameters
to eg with-profile +my-special-snowflake repl :headless
or to set the variable interactively (so you can see it's current value before changing it):
Ch, v cider-lein-parameters
and then click or hit enter on "customize" and set it there to eg with-profile +my-special-snowflake repl :headless
and apply it That'll cause your next cider-jack-in
to load the my-special-snowflake
profile in addition to the base
profile (which is needed in order to run the nrepl and hence cider).
I'm just searching the same feature and found this open issue in clojure-emacs/nrepl.el "Add argument to nrepl-jack-in to allow specification of profiles" https://github.com/clojure-emacs/nrepl.el/issues/327
it is still open
Try this:
(defun start-cider-repl-with-profile ()
(interactive)
(letrec ((profile (read-string "Enter profile name: "))
(lein-params (concat "with-profile +" profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)
(cider-jack-in)))
Test on CIDER 0.16.0 (Riga)
链接地址: http://www.djcxy.com/p/38608.html上一篇: 无法在Emacs中获得nrepl的工作