This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-16
Channels
- # announcements (62)
- # babashka (12)
- # babashka-sci-dev (73)
- # beginners (16)
- # biff (10)
- # calva (65)
- # cider (13)
- # clerk (8)
- # clojure (31)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-spec (24)
- # clojure-uk (5)
- # clojuredesign-podcast (18)
- # clojurescript (18)
- # dev-tooling (2)
- # emacs (30)
- # etaoin (4)
- # gratitude (3)
- # hyperfiddle (20)
- # integrant (2)
- # jobs (4)
- # kaocha (7)
- # malli (1)
- # observability (11)
- # off-topic (11)
- # pathom (12)
- # podcasts-discuss (7)
- # portal (12)
- # quil (3)
- # re-frame (6)
- # releases (1)
- # sql (22)
- # squint (5)
- # testing (79)
- # tools-deps (3)
- # xtdb (20)
Apologies if I’m not getting the terminology right here (I’m new to this), but does anybody know how (assuming there is a “how”) to reset the context in a CIDER nREPL session? for example, I’ve defined some vars previously in my buffer and did C-c C-k
. After removing the def
s, and doing C-c C-k
again, I’m expecting the vars to no longer be there. But they still are.
We have cider-undef-all
as well https://docs.cider.mx/cider/usage/cider_mode.html#key-reference
You can mix and match approaches (see above) depending on your preferences :)
thank you everybody! @U797MAJ8M I assume you mean like a search engine lookup? using the search box at https://docs.cider.mx/cider/usage/cider_mode.html doesnt really give me anything @U01320BR6US thank you. I’m not seeing this at https://docs.cider.mx/cider/usage/cider_mode.html#key-reference. Is this documented somewhere else?
Yes, if you check the doc in emacs (`C-h k C-c C-k`):
C-c C-k runs the command cider-load-buffer (found in cider-mode-map),
which is an interactive native-compiled Lisp function in
‘cider-eval.el’.
It is bound to C-c C-k.
(cider-load-buffer &optional BUFFER CALLBACK UNDEF-ALL)
Load (eval) BUFFER’s file in nREPL.
If no buffer is provided the command acts on the current buffer. If the
buffer is for a cljc file, and both a Clojure and ClojureScript REPL exists
for the project, it is evaluated in both REPLs.
Optional argument CALLBACK will override the default ‘cider-load-file-handler’.
When UNDEF-ALL is non-nil or called with C-u, removes
all ns aliases and var mappings from the namespace before reloading it.
I've use cider-undef
very successfully to remove a specific var (a def or defn), usually before renaming a test or function name.
If you have deftype, defrecord then they can be harder to manage
Using clojure.tools.namespace.repl/refresh
should remove all def and defn vars
https://practical.li/clojure/clojure-cli/repl-reloaded/#reload-namespaces
@U05KG6CCKT6 with "reloaded workflow" nivekuil refers to this https://www.cognitect.com/blog/2013/06/04/clojure-workflow-reloaded
Curious, does sesman-restart
work for y'all on a cider-connect
ed repl?
I've never used it much tbh, so I can't make a complete asessment. I've seen it working on cider-jack-in sessions, but not cider-connect ones (which ironically sounds like an easier use case)
Clarification, I mean restart after the server was shut down and started again over the same port
oh I'm now making sense of things...
Servers often restart over a new random port, so
sesman-restart
cannot magically know about it.
It may be worthwhile to prompt for ports if the current one can't be connected to. But there's the alternative of cider-connect
ing again and reuse the dead repl. 🌀