Fork me on GitHub
#cider
<
2022-05-31
>
dergutemoritz10:05:49

Heya, what's the recommended way to evaluate an expression right after having successfully connected to an nrepl server?

practicalli-johnny10:05:58

There are https://docs.cider.mx/cider/usage/code_evaluation.html. For just an expression, use the cdier-eval-defun-at-point command with the cursor anywhere on the expression. However, I would recommend evaluating the current namespace as the first step after connecting to the REPL via nrepl. This will load Clojure core into CIDER and ensure docs and jump-to actions work correctly. Either evaluate the (ns ,,,) expression, or evaluate the whole buffer, cider-load-buffer (C-c C-k). Note: If you evaluate the whole buffer, put any code you do not want to run into a (comment ,,, ) expression (especially if that code doesnt evaluate correctly).

dergutemoritz11:05:48

Sorry, I meant automatically / non-interactively

practicalli-johnny11:05:59

Ah, then use the user namespace. Expressions included in the user namespace are loaded into the REPL For example : https://practical.li/clojure/clojure-cli/projects/configure-repl-startup.html user.clj also works for Leiningen projects too, just ensure that the user.clj file is included in the classpath, usually with a dev profile in Leiningen

dergutemoritz10:06:11

Right, there's one more catch: The code in question is a call to a CIDER middleware API which requires me to pass in my current CIDER session-id. Currently I obtain it via CIDER'S elisp API call (cider-nrepl-eval-session) and then use that to construct the function call I pass on to (cider-interactive-eval). Not sure if there is a way to do that from the Clojure side, too? Also, I want to be able to use this when connecting to an already running remote REPL which of course wouldn't repeatedly load the user namespace whenever I connect. Hope I'm making sense 🙂

FiVo13:05:27

Hey, I upgraded to emacs 28 a couple of days ago and realized today that the spinner for "evaluation in progress" wasn't showing up. Upgraded to Cider 1.4.1 (was on 1.2 before), but still no luck. Anybody ran into this?

FiVo13:05:47

Just checked cider-show-eval-spinner is set to true

vemv15:05:43

this is the package in question, you might want to check in isolation whether it works in e28

FiVo22:05:45

Yes works in vanilla emacs.

đź‘Ť 1
FiVo08:06:37

Fixed it by removing my elpa cache.