Fork me on GitHub

when running cider-jack-in-clj (or -cljs), cider asks me which command should be used. In our project, with clj the answer is lein and with cljs its shadow-cljs. Is it possible to configure this automatically with e.g. .dir-locals.el? I tried browsing through the cider variables, but didn't find anything suitable.


this both exists and doesn’t exist. What exists is a var called cider-preferred-build-tool. Using .dir-locals, you can make this var have lein when in clojure-mode and shadow when in clojurescript mode. But this leaves ambiguity when in an edn buffer like shadow-cljs.edn annoyingly. And even more annoyingly, it (currently) isn’t configured by cider-jack-in-clj and cider-jack-in-cljs which it should. So the answer is “kinda” and open to improvements. You could also make little functions like work-clj-repl and work-cljs-repl that call cider-jack-in with the correct vars passed in


Based on my very minimal emacs experience I assume the first trick you mentioned requires that I must be in a cljs buffer to start the cljs repl and vice versa with clj? I guess creating custom functions is a better choice, that way I can call them regardless of the buffer type I assume


correct about the buffer types. you can set dir-locals that work in all modes, and you can set values for each type of mode you are in. But yeah it would require being in a cljs buffer when you start up your repl. and forgetting that makes a long and annoying mistake. I’d for sure go with functions

👍 1