Emacs, Clojure, lein and nrepl: *nrepl* buffer shows up blank

670 views Asked by At

I created a new project with lein. I open core.clj in emacs. I make sure to run M-x clojure-mode, and M-x nrepl-enable-on-existing-clojure-buffers.

Then I run M-x nrepl-jack-in and in the mini-buffer I get

Starting nREPL server...

followed by a message such as:

Connected. You're bound to be unhappy if you optimize everything. -Donald Knuth

I see that the buffer name is *nrepl*, but the buffer does not contain a Clojure Repl and instead is completely blank.

If I type anything (meaning anything at all,) I get:

Wrong type argument: integer-or-marker-p, nil

If I switch back to my core.clj buffer, and hit C-c C-l,I get the namespaced name of the last function in my buffer in the minibuffer as a result. And if I put my cursor at the end of a function definition and hit C-x C-e, I get:

CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:1:1)

I tried making a new lein directory with no dependencies using lein new project-name and tried the same steps as above and got the same results.

What else can I check and/or what am I doing wrong?

EDIT: Additional Information

When I type something into the empty *nrepl* buffer and try to press C-x C-e on what I typed, in the mini buffer I get the message:

No Lisp subprocess; see variable `inferior-lisp-buffer'

Also, I am running:

GNU Emacs 24.3.1

Leiningen 2.1.2 on Java 1.6.0_27 OpenJDK 64-Bit Server VM

1

There are 1 answers

0
noisesmith On BEST ANSWER

I just fixed this exact issue on my own setup. Move your .emacs.d to a backup location, and make a backup copy of your .emacs. Make a new .emacs with only the following lines:

(require 'package)

(add-to-list 'package-archives 
    '("marmalade" .
      "http://marmalade-repo.org/packages/"))

(package-initialize)

(require 'clojure-mode)

(require 'nrepl)

Once you install nrepl and clojure-mode via running M-x package-list-packages and installing their respective entries, you will be able to use nrepl.

Add your custom .emacs back in one logical unit at a time, and you should be able to figure out where the conflict was and eliminate it. Be suspicious of anything related to slime / swank.