This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-31
Channels
- # announcements (8)
- # babashka (8)
- # beginners (13)
- # biff (1)
- # calva (1)
- # cider (12)
- # clj-kondo (16)
- # cljs-dev (3)
- # cljsrn (14)
- # clojure (18)
- # clojure-austin (2)
- # clojure-czech (3)
- # clojure-europe (54)
- # clojure-germany (5)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojure-spec (4)
- # clojure-survey (2)
- # clojure-uk (1)
- # clojured (15)
- # clojurescript (5)
- # conjure (6)
- # core-async (65)
- # cursive (24)
- # data-science (1)
- # emacs (9)
- # events (3)
- # graphql (5)
- # integrant (6)
- # jobs (2)
- # joyride (62)
- # lsp (5)
- # malli (10)
- # off-topic (20)
- # pathom (57)
- # polylith (18)
- # re-frame (12)
- # remote-jobs (3)
- # rewrite-clj (14)
- # sci (2)
- # shadow-cljs (41)
- # sql (9)
- # tools-deps (68)
Heya, what's the recommended way to evaluate an expression right after having successfully connected to an nrepl server?
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).
Sorry, I meant automatically / non-interactively
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
I use the user.clj
namespace to launch data inspectors such as portal, e.g. https://practical.li/spacemacs/clojure-repl/portal-data-visualization.html#rich-comment-block-for-portal
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 🙂
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?