This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-20
Channels
- # announcements (3)
- # babashka (7)
- # beginners (36)
- # calva (71)
- # cider (25)
- # clj-commons (5)
- # cljdoc (19)
- # cljs-dev (5)
- # clojure (223)
- # clojure-austin (2)
- # clojure-bay-area (1)
- # clojure-europe (31)
- # clojure-france (6)
- # clojure-nl (2)
- # clojure-norway (19)
- # clojure-spec (13)
- # clojure-uk (7)
- # clojurescript (127)
- # core-logic (2)
- # cursive (21)
- # datalevin (53)
- # datomic (9)
- # emacs (37)
- # events (1)
- # graphql (8)
- # jobs (12)
- # lsp (8)
- # off-topic (92)
- # pathom (49)
- # pedestal (1)
- # polylith (3)
- # re-frame (25)
- # releases (2)
- # sci (11)
- # shadow-cljs (13)
- # vim (10)
Is there a way to prevent Emacs from freezing because I accidentally ran something that is going to print a ton of stuff in the REPL?
You can interrupt the execution.
But i also run into that issue from time to time. I'm not sure if the other editors fair any better.
Well, that's the problem, it's too frozen to interupt, I wonder if cider could like count how many things it printed in some time-window, and if it's too many stop printing. I'm guessing an editor with threads would fair better if the printing was concurrent, the UI thread wouldn't get blocked maybe.
I had started using cider-connect instead of jack-in, because at least I can quickly kill the repl that way at the command line, and sometimes that allows emacs to revover.
That being said most print operations shouldn't block the REPL these days - ever since nREPL 0.6 printing has been done in chunks and normally you should be able to interrupt the process. But I guess there are still some edge-cases.
There's a bit more on the topic here https://metaredux.com/posts/2019/03/29/nrepl-0-6.html
For me I think it Emacs that's frozen, so even my commands to Emacs are backed up and I'd have to wait a long time until it even got to doing a C-c C-b
How does cider figure out the namespace to give new files? Sometimes it seems to get it right, while at others it isn't dine relative to the class path (like src/main/clojure)
That's coming from clj-refactor.el, not from CIDER. I don't recall what the algorithm it uses to infer the namespace, though.
See:
(defcustom cljr-add-ns-to-blank-clj-files t
"If t, automatically add a ns form to new .clj files."
:type 'boolean
:safe #'booleanp)
(defun cljr--add-ns-if-blank-clj-file ()
(ignore-errors
(when (and cljr-add-ns-to-blank-clj-files
(cljr--clojure-ish-filename-p (buffer-file-name))
(= (point-min) (point-max)))
(insert (format "(ns %s)\n\n" (cider-expected-ns)))
(when (cljr--in-tests-p)
(cljr--add-test-declarations)))))
I'm trying to write some emacs configuration that spawns the right shadow-cljs
repl (opening :app
) without prompting me for questions; here's where I got:
(defun med/proper-repl ()
(interactive)
(let ((cider-preferred-build-tool 'shadow-cljs)
(cider-shadow-default-options ":app"))
(cider-jack-in-cljs '(:cljs-repl-type shadow))))
unfortunately, it seems that I can't set cider-shadow-default-options
from the let block: it will always be seen as nil from the cider-shadow-cljs-init-form
function (I enabled debugging to see that). However, if I set that option globally, then the function works as intended. What's happening?Is there a way to "repeat" an old evaluation in cider (maybe using cider's history?)? So for example I evaluated a form (some-test 1 2)
at line 400 of a file. Then I'm editing some things at the top of the file and I evaluate somethings, now I want to evaluate (some-test 1 2)
again but I don't want to go down to line 400 everytime. (Right now I use ciders history in the repl)
Can I keep evaluation or add a "watch" to this evaluation somehow? :thinking_face:
I would suggest to bind to a key an invocation of (cider-interactive-eval your_command)
Thanks I think I can add something to the register and then eval directly from the register. Corgi does provide some functions to help with this
Here's an example:
(defun malli-check-all ()
(interactive)
(cider-interactive-eval "(-> (mi/check) portal.malli.visualizer/check->portal)"))
(map! :leader
(:prefix-map ("z" . "Generative testing")
"z" #'malli-check-this
"a" #'malli-check-all))
For now, I'm using cider-repl-preoutput-hook
to see where I am in the compilation process, but arriving here was a process full of impasses.
@U051BLM8F maybe? ^