Fork me on GitHub
#cider
<
2022-05-25
>
onetom03:05:45

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).

vemv05:05:06

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 https://github.com/clojure-emacs/cider-nrepl op. And then read its source

vemv05:05:25

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)

onetom10:05:22

@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: https://github.com/clojure-emacs/cider/blob/0dcc5b079a79a928b791cc9cd9bbd2e3bef92d0d/cider-eval.el#L1501 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
vemv11:05:39

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

vemv11:05:46

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

🙂 1
thheller06:05:57

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"
)

thheller06:05:43

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

thheller06:05:05

or is the something the middleware actually uses?

bozhidar07:05:03

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

bozhidar07:05:21

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

thheller07:05:37

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

bozhidar07:05:06

@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*
                                sicmutils.expression/expression->stream)

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

respatialized17:05:20

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.

respatialized17:05:37

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