This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-22
Channels
- # aleph (5)
- # announcements (9)
- # babashka (9)
- # beginners (127)
- # cherry (1)
- # cider (48)
- # clj-kondo (5)
- # cljdoc (1)
- # clojure (70)
- # clojure-berlin (1)
- # clojure-europe (57)
- # clojure-france (2)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-norway (4)
- # clojure-uk (1)
- # clojurescript (2)
- # css (1)
- # cursive (6)
- # emacs (6)
- # gratitude (1)
- # honeysql (5)
- # introduce-yourself (5)
- # jobs-discuss (7)
- # joyride (1)
- # kaocha (3)
- # lsp (1)
- # malli (9)
- # nbb (2)
- # off-topic (91)
- # pathom (7)
- # pedestal (14)
- # re-frame (4)
- # reitit (67)
- # shadow-cljs (46)
- # spacemacs (3)
- # squint (3)
- # tools-build (14)
- # tools-deps (1)
- # vim (3)
hey I’m getting “Are you sure you want to run cider-jack-in
without a clojure project?” Looking at the source this seems to only come up if the project-dir can’t be found? Why would the project dir not be found?
more context: I just updated cider to the latest and this is a new project generated by clj new
(defcustom clojure-build-tool-files
'("project.clj" ; Leiningen
"build.boot" ; Boot
"build.gradle" ; Gradle
"build.gradle.kts" ; Gradle
"deps.edn" ; Clojure CLI (a.k.a. tools.deps)
"shadow-cljs.edn" ; shadow-cljs
)
"A list of files, which identify a Clojure project's root.
Out-of-the box `clojure-mode' understands lein, boot, gradle,
shadow-cljs and tools.deps."
:type '(repeat string)
:package-version '(clojure-mode . "5.0.0")
:safe (lambda (value)
(and (listp value)
(cl-every 'stringp value))))
if you find this bit in your current clojure-mode
it is probably missing deps.edn entryAnd that did it! It’s too bad that clojure-mode didn’t get updated when I updated cider. That was a tough one to solve.
luckily there is a great #C0617A8PQ channel for questions before you spend too much time on tooling 🙂
M-x straight-pull-all
followed by M-x straight-build-all
gives me lots of bleeding-edge versions of Emacs Clojure packages, but it's also let me avoid these kind of situations
Right now, I'm dealing with a nasty issue with CIDER where dir-local variables do not influence how CIDER injects the enrich-classpath middleware
enrich-classpath author here. LMK if I can help in any way. since Enrich is disabled by default at the moment, knowing about unforeseen interactions would be incredibly helpful :)
woah... First of all thanks for the blazing fast response! Secondly, I think the issue is actually with CIDER rather than your awesome library 🙂 Here's how my .dir-locals.el looks like
((nil . ((cider-enrich-classpath . nil)
(cider-preferred-build-tool . lein))))
When I run M-x cider-jack-in-cljs
on my project, CIDER still decides to inject the enrich-classpath middleware. I have it enabled by default but I disable it for CLJS projects since figwheel currently breaks with it.
When I explicitly (setq cider-enrich-classpath nil)
in e.g. IELM, the problem goes away. So I'm not sure what's really going on here.Let's say you open a directory with those dir-locals.
If you M-:
(https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Eval.html) and type cider-enrich-classpath
, what is the output?
If it evaluates to anything other than nil
, basically that's the problem: .dir-locals are are not working as configured
Hm... it evaluates to nil
yet CIDER invokes lein as follows:
/opt/local/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.0.0\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.5.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.7\"\] -- update-in :plugins conj \[mx.cider/enrich-classpath\ \"1.9.0\"\] -- update-in :middleware conj cider.enrich-classpath/middleware -- repl :headless :host localhost
That's pretty weird because cider-enrich-classpath
only exists in cider.el, in exactly 3 places: the defcustom declaration and 2 call sites.
Those call sites are inside defun
s, so they're using whatever value was last set.
Maybe use this pattern:
(advice-add 'the-cider-relevant-function ':around 'my-spy)
where my-spy is a defun that prints the current value of the cider-enrich-classpath
defcustomIt evaluates to t
in the advice function yet when I eval in the buffer it's set to nil
.
Here's the specific function I added.
(advice-add 'cider-jack-in-cljs :around (lambda (&rest args)
(message (format "%s" cider-enrich-classpath))))
hmm... try printing default-directory
also. Perhaps it's bound to something other than your project directory and therefore its dir-locals are disregarded?
(kind of a crazy hypothesis but also plausible :) )
Updated advice function
(advice-add 'cider-jack-in-cljs
:around (lambda (&rest args)
(message (format "%s, %s" default-directory
cider-enrich-classpath))))
And I get the output ~/Developer/Clojure/project/, t
. The default-directory
is in the correct directory.Oh I think I know what might be happening. Here's my init.el
for CIDER:
(use-package cider
:commands cider-jack-in
:config (setq cider-use-tooltips nil
cider-enrich-classpath t
cider-lein-parameters "repl :headless :host localhost"))
Maybe CIDER is being lazily loaded by straight.el and it runs the config when I finally invoke a function defined in CIDER?That looks to be the culprit so far: a freshly restarted Emacs is telling me cider-enrich-classpath
is unbound.
I would have guessed that the
cider-enrich-classpath t
bit was the one to be tweaked. Dunno how use-package can dir-locals can interactI think the :commands
key in use-package makes the package lazily loaded (though you can force it to load with a supplied command). So the situation must've been something like:
1. Emacs starts up, but cider is neither loaded nor configured.
2. dir-locals sets cider-enrich-classpath
to nil
.
3. cider-jack-in-cljs
forces cider to be loaded and configured.
4. cider-enrich-classpath
gets set to t
I would love that to be true, but Cursive use has been astonishingly consistent at almost exactly 30% for several years now (according to the community survey).
i love emacs and don’t care for text editors that are focused around a project directory. But the beginner experience of vs code is leagues ahead of emacs for sure
At my work place, IntelliJ and Emacs is pretty evenly split, then there's that one person using Vim. I've surprisingly not seen VS Code used anywhere, yet... but I do know it's popular in the "outside world", so to speak (e.g. luminus template generates a bunch of vs code specific files for you)
It’s funny how much time it takes to learn the lesson that if you have a data problem and any DATA problem (code is data, text is data), emacs has a solution.
I just had to ingest a bunch of information related to passing a citizenship test and emacs of course has org-drill. which has a spaced repetition, flash cardy quizzing functionality
Copy and paste the study manual and the a few emacs macros and I’ve got a test in a few hours.
wow. @bhauman i would love to read an article about that. i don’t have that much emacs-fu but would love to see it
@bhauman I'm quite embarrassed to say that I hallucinated the wrong name! 😳 No obituary required!