Fork me on GitHub

is there some common way to redirect messages coming from CIDER commands, like cider-load-buffer (`C-c C-k`), into the corresponding REPL window? it would be really helpful for understanding whether a NS was reloaded/refreshed before evaluating some expression, with cider-insert-defun-in-repl (similarly to how Cursive does it).


If I understand the question correctly, you want to understand step by step what CIDER is doing JVM-wide, right? If so the best approach would be to enable nrepl-log-messages in cider.el. Then for each message, you'd have to relate it to a op. And then read its source


It's not an automated approach, but it's what we have :) perhaps Cursive has it easier because IntelliJ itself runs in the JVM, I don't know. It might also be a good idea to simply ask specific questions or even create issues directly (any issue that can result in improved docs or UX is certainly welcome)


@U45T93RA6 no, i didn't mean nREPL messages. i was specifically thinking about these kind messages, which are just going into the *Messages* buffer now: i would think it's a good idea to see them in REPL buffers. but then again, i might want the wrong thing. how Cursive works makes a lot of sense to me and 80-90% of the time, that's what I think I want, so I would like the Emacs+CIDER combo work more like that. however, in those 10-20% of cases, i would really like to use CIDER's flexibility and its advanced ways of evaluations. but thanks for bringing up nrepl-log-messages; that might be a better direction for achieving what i want!

👍 1

yeah probably getting them into the repl would a bit fragile, because you'd be mixing auxiliary code execution (the messaging) with namespace reloading One could affect the other, e.g. blocking them or having output interleaved


Maybe a nice UI would be to reflect current ns state in the mode line . How to build that, IDK :)

🙂 1

is the info op in cider getting called incorrectly? the ns seems broken?

  id         "20"
  op         "info"
  session    "46f71837-9369-45db-bf99-09cd0250a74a"
  time-stamp "2022-05-24 16:06:38.095747000"
  ns         #("repro.core" 0 1 (fontified t help-echo cider--help-echo wrap-prefix "  " face font-lock-type-face) 1 10 (fontified t help-echo cider--help-echo wrap-prefix "  " face font-lock-type-face))
  sym        "test-fn-b"


seems like it is trying to send the correct thing but ends up sending garbage?


or is the something the middleware actually uses?


@thheller The Emacs text properties get ignored, so only a regular string gets sent in the end.


Still, I typically aim to clean those on the client, so the logs don't seem confusing.


ah ok. I was assuming the nrepl log shows stuff actually sent over nrepl.


@thheller No, it's the log from CIDER's perspective.

👍 1
Sam Ritchie15:05:05

hey all - I am migrating from leiningen to tools.deps. can someone help me figure out the correct way to set nrepl.middleware.print/*print-fn* for cider on startup?

Sam Ritchie15:05:21

in leiningen I had

:welcome (set! nrepl.middleware.print/*print-fn*

Sam Ritchie15:05:35

I am assuming there is something I can do with dir-locals.el but can’t find a list of all variables..

Sam Ritchie16:05:55

still not clear where I would do this particular setting


You could create a start namespace with a function like config that invokes your desired startup expressions and add that as an alias config to your deps.edn when launching the REPL - clojure -M:config:cider/nrepl In emacs you can prefix the cider-jack-in command with a universal arg (`C-u` by default) to add aliases to the default ones.


IIRC there's a way to get that alias picked up automatically via .dir-locals.el but I don't recall what it is