Skip to content

Commit 417bc9d

Browse files
committed
Introduce inf-clojure-skip-project-detection
This patch adds a defcustom, inf-clojure-skip-project-detection, that when non-nil skips the project detection so that only inf-clojure-generic-cmd will be used. This is very useful for projects that don't have standard layouts.
1 parent b04f05d commit 417bc9d

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
* [#93](https://github.com/clojure-emacs/inf-clojure/pull/93): Slow response from inf-clojure (completions, arglists, ...).
1010
* [#101](https://github.com/clojure-emacs/inf-clojure/pull/101): `inf-clojure-set-ns` hangs Emacs.
1111

12+
### New Features
13+
14+
* [#114](https://github.com/clojure-emacs/inf-clojure/pull/114): Introduce `inf-clojure-skip-project-detection`.
15+
1216
## 2.0.1 (2017-05-18)
1317

1418
### Bugs Fixed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ interacting with it.
7474
`inf-clojure` has several custom variables which control the command
7575
used to start a REPL for particular project type - `inf-clojure-lein-cmd`,
7676
`inf-clojure-boot-cmd` and `inf-clojure-generic-cmd`.
77+
If `inf-clojure-skip-project-detection` is non-nil, only
78+
`inf-clojure-generic-cmd` will be used, which can be useful for projects that
79+
don't have standard layouts.
7780

7881
By default all those variables are set to strings (e.g. `lein repl`).
7982
However, it is possible to use a cons pair like `("localhost" . 5555)`

inf-clojure.el

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ number (e.g. (\"localhost\" . 5555))."
189189
(stringp (car x))
190190
(numberp (cdr x))))
191191

192+
(defcustom inf-clojure-skip-project-detection nil
193+
"Skip project detection if non-nil.
194+
195+
This allows to rely on `inf-clojure-generic-cmd` for specifying
196+
the REPL command."
197+
:type 'boolean
198+
:safe #'booleanp
199+
:package-version '(inf-clojure . "2.1.0"))
200+
192201
(defcustom inf-clojure-lein-cmd "lein repl"
193202
"The command used to start a Clojure REPL for Leiningen projects.
194203
@@ -510,10 +519,11 @@ Fallback to `default-directory.' if not within a project."
510519

511520
(defun inf-clojure-project-type ()
512521
"Determine the type, either leiningen or boot of the current project."
513-
(let ((default-directory (inf-clojure-project-root)))
514-
(cond ((file-exists-p "project.clj") "lein")
515-
((file-exists-p "build.boot") "boot")
516-
(t nil))))
522+
(when (not inf-clojure-skip-project-detection)
523+
(let ((default-directory (inf-clojure-project-root)))
524+
(cond ((file-exists-p "project.clj") "lein")
525+
((file-exists-p "build.boot") "boot")
526+
(t nil)))))
517527

518528
(defun inf-clojure-cmd (project-type)
519529
"Determine the command `inf-clojure' needs to invoke for the PROJECT-TYPE."

0 commit comments

Comments
 (0)