cider

Jim Newton 2025-11-13T11:37:08.720419Z

I’m trying to delve into the clojure elisp code. Is the the correct place to ask questions? can someone explain or perhaps point me to an explanation of the evaluation protocol. In particular from elisp, cider-interactive-eval seems to call cider-nrepl-request;eval which appears to ask clojure to evaluate a designated expression. But I don’t yet understand what happens to the several results. 1) the clojure object returned, (I assume the clojure end pretty prints this and passes it back to elisp as maybe a string), 2) the stdout which the clojure expression printed, 3) the stderr the clojure expression printed, 3) some designator of the exception if such was raised. 4) whether the evaluation was interrupted or timed out Are these passed back as a data structure, or are they not acutally passed back but handled by various callbacks? I see the callbacks, but I don’t see a description ?yet? about what arguments they are called with. I would like to write a different entry point to cider-interactive-eval which will annotate the region with the stderr if there are lines of stderr and there was no exception.

Jim Newton 2025-11-13T11:38:12.652649Z

it looks like maybe I can do this simply by provided an appropriate callback. but that’s only a suspicion.

dpsutton 2025-11-13T14:32:07.909359Z

there’s a setting you can set to log all of the nrepl traffic between the client (emacs) and the server (the nrepl server running in your project). You should turn that on and look at what goes back and forth

dpsutton 2025-11-13T14:32:32.911149Z

but it’s largely maps like

dpsutton 2025-11-13T14:32:35.820979Z

{:op :eval :code "(+ 1 1)"}

dpsutton 2025-11-13T14:32:52.330029Z

{:out "2" :done true}

dpsutton 2025-11-13T14:33:10.026499Z

there’s some book keeping like each message has an id and the responses include which id they are in response to

dpsutton 2025-11-13T14:33:24.351409Z

but it’s basically a network repl (nrepl)

dpsutton 2025-11-13T14:34:57.887839Z

https://docs.cider.mx/cider/troubleshooting.html#missing-nrepl-messages-buffer m-x nrepl-toggle-message-logging and then you can watch the traffic

Jim Newton 2025-11-15T13:45:50.104439Z

ah yes, that’s an interesting piece of information. It indeed gives a bit of insight.

Jim Newton 2025-11-15T13:47:01.581789Z

I see the following in the message buffer on evaluaing a defun which contains my macro call.

(<--
  id         "27"
  session    "6e181038-8061-49d4-9cd9-052b7c557203"
  time-stamp "2025-11-13 16:48:02.421994000"
  err        "Unreachable code: [:launch-the-missiles a b]
"
)

Jim Newton 2025-11-15T13:47:49.305659Z

that means the error message was communicated … now I just need to figure out how to intercept it and react to it.

Alejandro 2025-11-13T19:43:02.638839Z

Hello. I've asked a question on the discourse forum, but this chat is probably a better place for asking it. Can cider copy the selected region to the repl buffer along with the result of evaluation? I'd like to keep the history of all interaction with repl. https://clojureverse.org/t/can-cider-copypaste-the-selected-region-into-the-repl-buffer/14774

bozhidar 2025-11-14T06:16:09.689299Z

There’s cider-eval-last-sexp-to-repl that does something similar.