cider

quoll 2024-10-03T16:42:52.977419Z

I'm working in a new project which uses leiningen. I only started using Cider after moving to deps-based projects, so I'm not that conversant with the setup here, sorry. Trying to jack in from emacs leads to errors loading cider.nrepl, so I've tried running from the command line. My ~/.lein/profiles.clj looks like this:

{:user {:plugins [[cider/cider-nrepl "0.50.2"]
                  [lein-print "0.1.0"]]}}
(The local project.clj is large, but I can post appropriate snippets if needed) When I try to jack in from emacs, or even just run lein repl then I always get a series of errors of the form:
Error loading cider.nrepl: Syntax error macroexpanding at (cider/nrepl.clj:1:1).
When it's on the CLI then there are 26 of them, while emacs has 54 (probably not significant). This is followed by:
Syntax error compiling var at (/private/var/folders/hn/mv1vb8y144b_29pn1p886wx80000gn/T/form-init5690839193242023009.clj:1:16702).
Unable to resolve var: cider.nrepl/wrap-apropos in this context
I'm guessing that it can't find the middlewares on the path, though they're included in cider-nrepl jar, so that guess may be way off. Does anyone have a suggestion here, please?

quoll 2024-10-03T16:46:39.334129Z

I should note: • I can use cider just fine in my own projects, which all rely on deps.edn. • I also have my own simpler leiningen project which starts cider in emacs without a problem.

Stig Brautaset 2024-10-03T17:17:48.421749Z

I see this on occasion, but I don't know what causes it. I'm a bit embarrassed to share this, but maybe this extra information can help you get to the bottom of it: • Sometimes running lein clean helps. • Other times restarting Emacs (🫣) helps. • I'm pretty sure I've been successful trying to cider-jack-in from a different namespace, or when the current buffer is the project.clj If all else fails my fallback is to do lein repl in eshell, and then do a cider-connect. Happy 🐛 hunting :-)

quoll 2024-10-03T17:24:49.193629Z

ah… it needed lein clean I was just saying to someone: I haven't used lein for several years now. I totally forgot about cleaning.

quoll 2024-10-03T17:26:46.835269Z

Thank you!

Stig Brautaset 2024-10-03T17:38:53.834729Z

You're welcome!

2024-10-07T14:55:31.741599Z

I much prefer to leave out the cider deps from the project.clj and let jack-in add its own. This keeps the versions consistent with your particular cider client version expectations.

Stig Brautaset 2024-10-07T15:50:55.086909Z

I do let cider handle the deps, but I still experience this issue on occasion.

2024-10-07T16:08:02.057399Z

Yeah, I wasn’t suggesting it was the source of your trouble @stig328 I was relating my thought to the original comment where @quoll looked to be adding ~/.lein/profiles.clj deps for cider-nrepl. Since it was listed as a :plugins I’m actually not sure how it might clash with the :dependencies added dynamically with jack-in.

👍 1
quoll 2024-10-07T16:19:20.142309Z

Thanks for pointing this out! It was supposed to be a dependency under :repl, not under :user 🤦‍♀️

👍 1