This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-17
Channels
- # aleph (57)
- # announcements (2)
- # babashka (11)
- # beginners (55)
- # calva (18)
- # cider (37)
- # clj-kondo (24)
- # clojure (18)
- # clojure-europe (80)
- # clojure-nl (2)
- # clojure-norway (22)
- # clojure-uk (7)
- # clojured (1)
- # clojurescript (24)
- # data-science (9)
- # datomic (45)
- # events (1)
- # gratitude (4)
- # humbleui (30)
- # hyperfiddle (7)
- # introduce-yourself (2)
- # malli (3)
- # missionary (12)
- # music (1)
- # off-topic (33)
- # re-frame (3)
- # reagent (11)
- # ring (24)
- # shadow-cljs (13)
- # sql (3)
- # tools-deps (4)
Is cider as a tap / inspect target still in discussion?
For the time being, for personal use I'm using the solution outlined in OP here https://github.com/clojure-emacs/cider/issues/3055 e.g. I copied that to ~/.lein/profiles and created a simple Elisp helper for inspecting/clearing that atom That same issue serves for keeping track of an official solution - it should be offered later this quarter
I don’t use lein
- will that work with deps.edn too?
Glad to hear it’s still being considered :
I think so - $HOME/.clojure/deps.edn allows you to add dirs or a .jar to any project. Although I think that nowadays it emits a warning if a given custom dir is outside the project root.
Cool, thanks, I’ll look into it
clj-refactor's magic requires is inserting a project namespace I don't ever want. Is there a way to keep magic requires, but either blacklist a particular candidate or entirely disable inference using suggest-libspecs
? I want to retain the base candidates (`io`/`set`/`str` etc). I don't see this in the docs at https://github.com/clojure-emacs/clj-refactor.el/wiki#magic-requires
Can you expand on what's happening, and why you think it's happening? Please use examples (even if redacted)
I type user/
(because I'm in some random ns and want to use something from user.clj in a rich comment). clj-refactor adds [company.foo.bar.user :as user]
. company.foo.bar.user
is an existing but unrelated project namespace. As far as I can tell this alias for company.foo.bar.user is used elsewhere and so it infers that I want it here. I would prefer it did no inference for user
.
I think this one should cut it
(defcustom cljr-suggest-namespace-aliases t
"If `t', `namespace-aliases' and `cljr-slash' will take into account suggested namespace aliases,
following this convention: `'."
:group 'cljr
:type 'boolean)
Would disabling the flag altogether work for you? That convention is far from universal
But it feels tremendously useful to me
It would make sense to implement a blacklist if you mostly liked this 'inference' except for a few cases.I definitely like the base candidates (io/set/str...) and usually the inference works well. There's only a small number of cases where the inference does the wrong thing.
Disabling the flag would be fine on this particular project, I guess
As far as I can tell this alias for company.foo.bar.user is used elsewhere and so it infers that I want it here.I see. clj-refactor/refactor-nrepl foster that your project's set of ns aliases should have exactly one meaning
So probably that existing user
was 'bad' - you'd use bar.user
instead for example.
The dot usage is described in https://stuartsierra.com/2015/05/10/clojure-namespace-aliases - "Keep enough trailing parts to make each alias unique"
...I realise you might not immediately be compelled to refactor your project, but a few people find it more maintainable - this way aliases become logical and memorable.
Feel free to create an issue for a blacklist though, I do realise the real world tends to be messier than that 🌀
I generally use and prefer an unambiguous set of namespace aliases, alas this is someone else's project and I the outsider come in to help but not change much 🙂
I definitely sympathize with advice
ing your way into make things work as desired 😄
An upstream collab would always be welcome.
Is there a way to add to the nrepl middlware when running a Clojure CLI REPL from cider-jack-in-clj ??
Specifically, I would like to include portal.nrepl/wrap-portal
to the --middlware
part of the command so Portal will tap> everything from nREPL for a complete history.
I use this approach when running the REPL process in a terminal window and connecting with cider-connect
. This uses an alias similar to that documented on the Portal guide
https://cljdoc.org/d/djblue/portal/0.51.1/doc/guides/nrepl#toolsdeps
I am unclear if there is an existing way to do this with jack-in approach to starting the REPL process (and nREPL server)
You can customise cider-jack-in-nrepl-middlewares
, though its elements have to symbols referring to a var with a list of middleware to use.
Are the symbols in cider-jack-in-nrepl-middlewares
merged into the default middleware or replace the default (e.g. do I need to include cider.nrepl/cider-middleware
I'll try without that first and assume its additive and see if it breaks 🙂
This .dir-locals.el config works. The middleware variable replaces the default middleware, so cider.nrepl also needs to be included Open to any improvements on this config, Thank you.
;;; Directory Local Variables -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")
((clojure-mode . ((cider-preferred-build-tool . clojure-cli)
(cider-jack-in-nrepl-middlewares . (cider.nrepl/cider-middleware portal.nrepl/wrap-portal))
(cider-clojure-cli-aliases . ":dev:test"))))
I reckon that with the eval
trick that one can use in .dir-locals, you could use (cider-add-to-list x 'portal.nrepl/wrap-portal)
instead of re-setting the value
Yes, I have an example of Emacs add-to-list
in the https://practical.li/spacemacs/clojure-development/project-configuration/#further-examples for .dir-locals, although I find it tidier to have a specific variable to set this though. Thanks
If you use clj-refactor or anything that similarly adds mw, their mws could be lost (simply adding that for completeness 😇)
Yes, add-to-list is much safer and doesn't necessarily require knowledge of the default middleware that is needed by Cider and other tools.
During eval, any output on **err**
seems to be considered an error, and output to either the message buffer and/or an overlay according to cider-use-overlays
. It currently seems impossible to turn off this behaviour. We have a project where logging is configured to go to stderr, which results in the every log message being output to at least one of the message buffer or an overlay. This is independent of cider-log (which we can’t use as logging with log4j2). Did I miss a way to have err output go to neither message buffer nor overlay?
Today we progressed in diagnosing it https://github.com/clojure-emacs/cider/issues/3587 I had it hard from my side as I hadn't reproduced it so far You might have luck locally altering this code https://github.com/clojure-emacs/cider/issues/3587#issuecomment-1895262468
I’m not sure it is timbre relate. The code seems to be in cider--display-interactive-eval-result
.
Sure, that's where my snippet points to The symptom shows up in timbre, shadow-cljs, possibly others
That sounds plausible, Timbre does compile-time things and shadow-cljs invokes cider-nrepl (normally things work in the opposite direction)
I think what I will do is to detect if err
values (from nrepl messages) do look like an exception. We have accurate regexes for exceptions that work against every Clojure version
Thanks, I linked to it in the GH issue. Btw, if you happen to have the chance, feel free to self-assign this. But I can happily jump to it later.