summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2018-08-22 12:01:35 +0200
committerBozhidar Batsov <bozhidar@batsov.com>2018-08-22 12:01:35 +0200
commit57e2c9789b165b283c0ddac342d0df3feaa30074 (patch)
tree33a80d03fc6fa252a14666255b9acec1e51f4b58
parent5cf0f6f04697d598b20d1f6b68588db43c433614 (diff)
[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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--cider.el8
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 963ce2ad..b363f30d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@
* [#2307](https://github.com/clojure-emacs/cider/pull/2307): Use a better error when a cljs repl form cannot be found.
* Fix the broken test selector functionality.
* [#2291](https://github.com/clojure-emacs/cider/issues/2291): `cider-use-tooltips` custom variable works as expected.
+* [#2424](https://github.com/clojure-emacs/cider/issues/2424): Fallback to `lein` as the default jack-in command when `clojure` is not present.
### Changes
diff --git a/cider.el b/cider.el
index 8f63f9b2..99db9ded 100644
--- a/cider.el
+++ b/cider.el
@@ -214,12 +214,14 @@ By default we favor the project-specific shadow-cljs over the system-wide."
:safe #'stringp
:package-version '(cider . "0.10.0"))
-(defcustom cider-jack-in-default "clojure-cli"
+(defcustom cider-jack-in-default (if (executable-find "clojure") "clojure-cli" "lein")
"The default tool to use when doing `cider-jack-in' outside a project.
This value will only be consulted when no identifying file types, i.e.
project.clj for leiningen or build.boot for boot, could be found.
-As the Clojure CLI is bundled with Clojure itself, it's the default."
+As the Clojure CLI is bundled with Clojure itself, it's the default.
+In the absence of the Clojure CLI (e.g. on Windows), we fallback
+to Leiningen."
:type '(choice (const "lein")
(const "boot")
(const "clojure-cli")
@@ -1369,6 +1371,8 @@ PROJECT-DIR defaults to the current project."
choices nil t nil nil default))
(choices
(car choices))
+ ;; if we're outside a project we fallback to whatever tool
+ ;; is specified in `cider-jack-in-default' (normally clojure-cli)
(t cider-jack-in-default))))