I had exactly the same problem as ThomasH where calling lein repl
from an Emacs shell would get me the introductory messages and a prompt ...
nREPL server started on port 55801 on host 127.0.0.1 - nrepl://127.0.0.1:55801
REPL-y 0.4.4, nREPL 0.8.3
Clojure 1.10.1
Java HotSpot(TM) 64-Bit Server VM 15.0.2+7-27
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
... but seemingly freeze when I try to get it to do anything, like:
user=> (+ 1 2 3 8)
When I open up the Task Manager, I could see the underlying Java program continuously at ~30% CPU for no apparent reason, and the only way I could reliably get out of it was to end the Java process from there.
But through a lot of effort, I finally figured out that the reason this was happening was a shell environment variable TERM=emacs
. Whenever you call M-x shell
, the function comint-term-environment
puts it in for you.
(According to the source code in comint.el
, it's done so that it "lets us specify a width". And it also mentions that "Some programs that use terminfo get very confused if TERM
is not a valid terminal type". So there you have it - it looks like Java is one of those.)
To resolve this, you can set the variable system-uses-terminfo
to 't
before calling M-x shell
.
(setq system-uses-terminfo t)
After having done so, Java is now finally responsive and I can evaluate things in the repl.
user=> (+ 1 2 3 8)
14
If you have this problem and got fortunate enough to stumble here, I hope this helps! =D
lein.bat
in git bash. Can you give a bit more details - yourPATH
, how you try to runlein
under bash, if you can runjava
in bash etc? – Brothellein run
works andlein repl
doesn't. Are you inside a project? Can you trylein repl
outside of any project? Maybe even without lein profiles. Just shooting in the dark. – Brothel