This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-28
Channels
- # aleph (4)
- # announcements (5)
- # babashka (28)
- # babashka-sci-dev (13)
- # beginners (63)
- # calva (76)
- # cider (113)
- # clara (7)
- # clj-kondo (42)
- # cljdoc (1)
- # clojure (170)
- # clojure-europe (20)
- # clojure-nl (17)
- # clojure-norway (3)
- # clojure-spec (12)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (55)
- # clojureverse-ops (1)
- # consulting (1)
- # core-async (9)
- # cursive (16)
- # data-science (1)
- # datascript (8)
- # datomic (27)
- # emacs (14)
- # events (1)
- # fulcro (10)
- # graphql (9)
- # gratitude (1)
- # jobs (6)
- # jobs-discuss (5)
- # leiningen (10)
- # lsp (35)
- # missionary (4)
- # nextjournal (9)
- # off-topic (46)
- # pathom (15)
- # pedestal (5)
- # polylith (37)
- # portal (15)
- # re-frame (22)
- # reagent (4)
- # reitit (5)
- # reveal (18)
- # shadow-cljs (20)
- # tools-deps (7)
- # xtdb (10)
I'd like to improve doom-emacs modeline icon where tells if cider is connected or not, I want to add a intermediate state telling if there is something being evaluated, is there any cider hook where I can rely on this?
when connected but never evaluated nothing or there is something being evaluated it would be:
I managed to make almost everything work using cider-connected-hook
, cider-disconnected-hook
, cider-mode-hook
and cider-file-loaded-hook
, but the latter is not totally reliable for the intermediate state
it'd be nice to have a pre-hook when cider is evaluating something and a pos-hook when it finished evaluated or it's cancelled
BTW this already work on doom-emacs without the intermediate state, I made it some months ago My modeline:
I see the hooks beeing important not for just modeline but anyone that would want to add some kind of UX feedback of cider state :)
it seems cider has spinner indeed, but I never see it working, maybe doom disables it?
I think it's related with the spinner running on the repl buffer, and the repl buffer has no modeline
yeah I saw that, but even so I never saw this spinner working, does it always work for you @U11BV7MTK? I suspect doom-emacs does something that hides it
and the stop messages: • https://github.com/clojure-emacs/cider/blob/master/cider-connection.el#L159 • https://github.com/clojure-emacs/cider/blob/master/cider-debug.el#L349 • https://github.com/clojure-emacs/cider/blob/master/cider-client.el#L94
I see, so probably a doom-emacs thing, anyway, I still think the hooks would improve how other can extend this behavior
only thing i can think of is there are packages that dimish things in the modeline and i bet they are getting swept up in that
hmm. i bet there's another package that achieves the same thing. anything that claims to clean up the modeline. but this is all speculation
actually, doom-modeline is built-in on doom-emacs: https://github.com/hlissner/doom-emacs/blob/develop/modules/ui/modeline/+light.el I remember I coded there adding that cider repl icon
but most doom-emacs people use the main modeline: https://github.com/seagle0128/doom-modeline I already used both and saw people using both, and never saw that spinner
😂 yeah.. I'm used to keep only on the notebook without any extra monitor :man-shrugging:
Yeah, I actually wrote that code @U8QBZBHGD 😅
this whole conversation was to have some hooks from cider to improve it even more :)
i also see this in spinner.el:
(unless (and (listp mode-line-process)
(memq 'spinner--mode-line-construct mode-line-process))
(setq mode-line-process
(list (or mode-line-process "")
'spinner--mode-line-construct)))
check those constraints? mode-line-process. although i guess that's just adding it to the list and ensuring not to re-add it
this show the cider spinner corectly:
(spinner-start cider-eval-spinner-type nil
cider-eval-spinner-delay)
anyway, thanks for the help @U11BV7MTK, I'd still like to have my repl icon instead of the spinner
i'm gonna look into this: maybe spinner start isn't built into all interactive eval handlers?
right. i agree. but my thinking is that the places where spinner calls are would be the place to swap in the hooks and have spinner as the default on the hook
so once spinner works for you you'll know that your change works when the spinner keeps working on the hook, and then unhook it and set your own icon on the hook and it'll almost 100% work
another thing to check, is define dummy functions for spinner-start
and stop that just message "i was called and started" or whatever and see if CIDER is failing to call or spinner is failing to render
probably the buffer it's wrong, it's the repl one, not the active buffer where I'm coding :)
oh maybe! i haven't seen CIDER in a while so i'm not actually sure which buffer lol
and you'll dabble a toe into the waters of multiple connections and figuring out which repl buffer is connected
that's an area where the workspace style editors are far easier: intellij and vs code. There aren't multiple projects open at once
yeah haha, I used the simple one https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/clojure/config.el#L105
agree. i really like that about emacs. but it does make that particular problem harder
actually one thing i don't like about lsp. I often look into lots of other projects and that spins up lsp servers just by looking at a clj file. i wish it was opt in per proejct
i have to remember to lsp-workspace-shutdown if i go look at clojure source code or core.match, etc
yeah, unless you opened the buffer from the current workspace which will open in a cache emacs folder using the same session, it will connect another session indeed
anyway, I'll go to bed now, thank you for the help and chat @U11BV7MTK @U8QBZBHGD
Thanks one long thread! @UKFSJSM38 all sorts of improvements are more than welcome. 🙂
I also also thinking it'd be nice to have some indication about whether a ns was evaluated or not, etc, but never got to doing those.
Btw, what are you using to see the variable values in the minibuffer? That looks cool!
That's another thing we can do for CIDER as well, although I'm not sure how it will look for bigger values. 😄
Haha, it's from doom-emacs I guess
It uses ivy via shortcut SPC h v
showing all variables and it's values
@borkdude I think you'll like this - https://github.com/clojure-emacs/cider/commit/4ba36bccd2fc7b5da1f0b5f156059bdf3391b2d1 🙂
I didn't have time to test it properly, but the code is pretty straight-forward, so I'm optimistic it will work. bb.edn
made implementing jack-in support pretty simple.

@bozhidar just checking. does this assume anything about anyone writing an .nrepl-port file?
No, it just assumes that you write the port to the terminal, the same wait that Lein does it.
there is some code here that accounts for this: https://github.com/babashka/babashka/wiki/GNU-Emacs
Just wanted to point you at the bb-jack-in @U07FP7QJ0 showed me a while ago. https://gist.github.com/plexus/5c27d643853c791685cede8b24fb854b#file-03_user_config-el-L35
Yeah, it's trivial to have a dedicated command, but if we assume that most babashka projects use bb.edn
, I think it makes more sense to make cider-jack-in-clj
aware of babashka (which is what I did), than to introduce one more set of commands. Obviously with Emacs we always have infinite possibilities. 🙂
Did anyone run into issues with dependencies and deps.edn aliases recently? I sometimes jack-in and it just doesn't find the deps from some alias. No change in code. I jack-in again and it works. I can't reproduce it reliably. I also don't know if it is some cider issue or lower down. My dir-locals.el mostly contains something like (cider-clojure-cli-global-options . "-A:dev:test:build")
Nothing comes to mind, however if the issue is flaky, perhaps tools.deps own caching .cpcache
is into play
this can happen if you are using local deps
cache will not be recomputed if those change
(but I am working on a fix for this!)
Doubt this is an issue but FYI you can specify aliases directly with cider-clojure-cli-aliases, instead of sending them as global options.
Well it would be something transitive from a local dep so could be about anything
You should be able to fix it by using clj -Sforce from the command line (+ any aliases)
No seems to be a cider issue. Ran into it again a couple of times and the jack in command does not contain the aliases.
Are :indents
and :alias-map
the only options that cider can send to cljfmt? I'd like to enable :remove-multiple-non-indenting-spaces?
for cider's use of cljfmt, but adding it to the cider-format-code-options
plist doesn't work. Is there another way or will this need a code change to cider?
@UE1N3HAJH Unfortunately only :indents
and :alias-maps
are currently supported. We'd need to change both cider--nrepl-format-code-request-map
from cider-client.el
in Cider code, and at least format-code-reply
in Cider-nREPL code.
Thanks @U8T05KBEW I thought as much. I may make a PR if I get around to it.