Newbie Clojure programmer here. NREPL in Emacs isn't working for me.
My project is just the lein-generated Hello World.
Running "lein repl" in a shell works, but nrepl.el doesn't work. Rather than winding up in the project's namespace in the repl, I just get the default toplevel in the "user" namespace.
Should see something like:
my$ lein repl
nREPL server started on port 57347
REPL-y 0.2.0
Clojure 1.5.1
Hello Project
my.core=>
But instead see:
; nREPL 0.1.8-preview
user> (in-ns my.core)
CompilerException java.lang.ClassNotFoundException: my.core, compiling:(NO_SOURCE_PATH:1:1)
user>
In a clean nrepl.el scenario, I see two java processes going and they look plausible. One has my project on the -classpath and is implementing the actual repl (server), while the other is the client side java (-D MyProjectPath -m leiningen.core.main repl :headless).
I get the same lossage whether I get there by mx nrepl-jack-in
or starting in the shell and then mx nrepl
. I get a repl that doesn't know my project.
I wonder if this stuff works for anyone, or if I have something installed or set up wrong? Lots of "0.xxx" versions of things going on here...
Looks like you are missing a quote before your namespace, try the following:
(in-ns 'my.core)
Note the ' before my.
NRepl always starts in the top-level user namespace. Use Mx nrepl-set-ns
, or Cc Mn
in a Clojure buffer, to set the namespace of NRepl to the one of the buffer.
In your specific case,
src/my/core.clj
, press Cc Mj
to start NRepl, src/my/core.clj
buffer, Cu Cc Cz
to set the NRepl namespace to my.core
and switch back to the NRepl buffer. Cu Cc Cz
is a shortcut for Cc Mn
followed by Cc Cz
to switch to the NRepl buffer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.