I was actually quite happy with using vim + lein repl, but since so many people keep saying that Emacs is the way to go when it comes to Lisps, I've decided to give it a try. The problem is now setting up a clojure environment that does all the fancy things that people keep talking about - for now I managed to install clojure-mode and nREPL and that works reasonably well, but I need to get the repl to work with my Leiningen projects if this experiment is going to go somewhere (having a repl in the editor would be pretty pointless if that meant having to manage of all my dependencies (especially classpath related ones) on my own again). The problematic point here is that most articles I see online are
Now what I'm looking for is:
Assuming you have both lein2 and nrepl.el installed:
Option A:
You simply open in Emacs a file belonging to your lein project (like foo.clj
) and you type M-x nrepl-jack-in
. This will start a nREPL with all the deps loaded in and you can play with it more or less in the same manner as with swank-clojure
. (that's what I do most of the time)
Option B:
You go to your project's dir in a terminal and type there:
lein repl
Afterwards typing M-x nrepl
will allow you to connect to the running nrepl session.
nrepl.el
comes with a handy minor mode that allows you to evaluate code in your Clojure source files and load it directly in the repl (same as swank-clojure). A list of all available commands in available in the nREPL
menu section.
P.S.
nrepl.el
was renamed to CIDER
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With