Emacs, Cider, Leiningen - I somehow broke it

Hey everyone,

after a bit of a break I can finally find the time to pick up learning clojure where I left it a couple of months ago.
Unfortunately it seems like I broke my emacs-clojure setup in the meantime.
The whole universe of cider, leiningen, nrepl etc. is still pretty much a mystery to me which makes it very hard to fix it.
Here’s the situation:
I can run “lein repl” from the terminal and evaluate code, no problem here.
I can run emacs and “cider-jack-in” in a project folder I created with lein, no problem here.
However if I try “cider-jack-in” without a project I cannot evaluate code. There is no error message, but absolutely no response to my evaluations. I know not using a project is not really encouraged but as I’m still learning this is very helpful to quickly mess around with code.

There is one thing I noticed which might be the issue:
After evaluating “cider-jack-in” without a project it prints info about successfully establishing the connection using “nREPL 0.8.1” but the “Connection Info” shows (Java 14.0.1, Clojure 1.10.1, nREPL 0.7.0). I seems like it tries to communicate with a different version?

I’m using Emacs 26 running macOS (unfortunately). I tried reinstalling everything clojure related in emacs but that did not help.

Apart from simply making it work I’m hoping to learn a bit more about the whole setup while fixing it.

Thank you very much!

What exactly do you mean by doing cider-jack-in without a project? Are you editing some stand-alone clojure file? If you’re in a non-clojure mode buffer, the CIDER shortcuts will not work, but if you’re not getting any errors, and a REPL buffer actually appears, it should work.

Thanks for your answer! Sorry if I haven’t expressed myself clearly.

If I call cider-jack-in without navigating into a project folder, emacs (or cider) asks me to confirm that I actually want to do this: "Are you sure you want to run cider-jack-in without a Clojure project?"
If I confirm, the repl connection is successfully established and I end up in the user namespace but I cannot evaluate any code (nothing happens except a progress bar in the header of the minibuffer).

Whoa – I’ve never attempted to use Cider without a project. My understanding was that it requires either a project.clj, shadow-cljs.edn, or other recognized project file. If I were you I would regard this as expected behavior and just start with a lein new my-generic-project etc. If you want to just practice unassociated Clojure, use babashka.

Ok, in that case it would seem that there is something weird with your setup, I often use a cider scratch buffer connected to a fresh REPL (with no project) to test little snippets, and it works as it should.

It’s kinda hard to say what might be wrong without looking at your config, etc…

@Webdev_Tory, Cider does not require a project, you can evaluate Clojure code in a scratch buffer with no issues (of course, you won’t get any dependencies either, so if you need anything besides core stuff, you’re better off creating a project)