Skip to content

Commit 57e2c97

Browse files
committed
[Fix #2424] Fallback to lein on jack-in when clojure is missing
The Clojure CLI tools are not available on Windows yet, so for them `clojure-cli` is a poor default. Now we set the default in a dynamic fashion.
1 parent 5cf0f6f commit 57e2c97

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* [#2307](https://github.com/clojure-emacs/cider/pull/2307): Use a better error when a cljs repl form cannot be found.
3333
* Fix the broken test selector functionality.
3434
* [#2291](https://github.com/clojure-emacs/cider/issues/2291): `cider-use-tooltips` custom variable works as expected.
35+
* [#2424](https://github.com/clojure-emacs/cider/issues/2424): Fallback to `lein` as the default jack-in command when `clojure` is not present.
3536

3637
### Changes
3738

cider.el

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,14 @@ By default we favor the project-specific shadow-cljs over the system-wide."
214214
:safe #'stringp
215215
:package-version '(cider . "0.10.0"))
216216

217-
(defcustom cider-jack-in-default "clojure-cli"
217+
(defcustom cider-jack-in-default (if (executable-find "clojure") "clojure-cli" "lein")
218218
"The default tool to use when doing `cider-jack-in' outside a project.
219219
This value will only be consulted when no identifying file types, i.e.
220220
project.clj for leiningen or build.boot for boot, could be found.
221221
222-
As the Clojure CLI is bundled with Clojure itself, it's the default."
222+
As the Clojure CLI is bundled with Clojure itself, it's the default.
223+
In the absence of the Clojure CLI (e.g. on Windows), we fallback
224+
to Leiningen."
223225
:type '(choice (const "lein")
224226
(const "boot")
225227
(const "clojure-cli")
@@ -1369,6 +1371,8 @@ PROJECT-DIR defaults to the current project."
13691371
choices nil t nil nil default))
13701372
(choices
13711373
(car choices))
1374+
;; if we're outside a project we fallback to whatever tool
1375+
;; is specified in `cider-jack-in-default' (normally clojure-cli)
13721376
(t cider-jack-in-default))))
13731377

13741378

0 commit comments

Comments
 (0)