Can't get nrepl working in Emacs

888 views Asked by At

I'm running on an Ubuntu machine. I had emacs23 installed, but it looks like nREPL is designed to work with emacs24. So, I uninstalled emacs23, installed emacs24. I removed my existing .emacs file and .emacs.d directory.

Then I ran M-x package-list-packages and installed clojure-mode and nrepl.

I created a Clojure project with lein new foobar and then tried to open the default core.clj file. It puts me in Clojure mode automatically, but if I type M-x nrepl-jack-in (while in the core.clj buffer), it says Starting nREPL server..., but I never see any buffer named *nrepl* (which, based on reading the documentation, is the expected result). I just see the Starting nREPL server... in the minibuffer indefinitely.

Now, a buffer named *nrepl-server* is created and it says:

REPL started; server listening on localhost port 5871
Exception Unsupported option(s) supplied: :headless  clojure.core/load-libs (core.clj:5266)
clojure.core=>

But it doesn't seem like this is very useful (I can't seem to cause it to eval anything in that buffer?!?).

I tried Googling on this, but I couldn't find anybody who seemed to have this problem. I'd like to play around with Clojure (and core.logic in particular), but this is a complete non-starter. :-(

2

There are 2 answers

0
Michael Tiller On BEST ANSWER

So, it turns out the issue was that my version of Ubuntu installed Leinengen 1.7.1 via apt-get but if I upgrade to version 2, the issue went away.

In summary, the issue is that lein version 2+ is required here but if you have a lower version you really don't get any visible indication of what is wrong (unless you count the exception thrown in *nrepl-server*, which isn't normally visible).

0
Michiel Borkent On

Next time you can also try to start the nrepl-server via lein repl in a separate shell. This way you can see if and on what port nrepl is running. In Emacs you can then do M-x nrepl and connect to the right nrepl server instance.