Skip to content

Commit 5d76920

Browse files
arichiardibbatsov
authored andcommitted
Introduce inf-clojure-project-type defcustom
This patch adds a defcustom, inf-clojure-project-type, so that when it is not-nil we skip the project detection and choose which inf-clojure-*-cmd will be used. This is very useful for projects that don't have standard layouts.
1 parent 12583f4 commit 5d76920

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-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-project-type` defcustom.
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+
The `inf-clojure-project-type` can force a particular project type, skipping
78+
the project detection, which can be useful for projects that don't have
79+
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: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ number (e.g. (\"localhost\" . 5555))."
189189
(stringp (car x))
190190
(numberp (cdr x))))
191191

192+
(defcustom inf-clojure-project-type nil
193+
"Defines the project type.
194+
195+
If this is `nil`, the project will be automatically detected."
196+
:type 'string
197+
:safe #'stringp
198+
:package-version '(inf-clojure . "2.1.0"))
199+
192200
(defcustom inf-clojure-lein-cmd "lein repl"
193201
"The command used to start a Clojure REPL for Leiningen projects.
194202
@@ -511,10 +519,11 @@ Fallback to `default-directory.' if not within a project."
511519

512520
(defun inf-clojure-project-type ()
513521
"Determine the type, either leiningen or boot of the current project."
514-
(let ((default-directory (inf-clojure-project-root)))
515-
(cond ((file-exists-p "project.clj") "lein")
516-
((file-exists-p "build.boot") "boot")
517-
(t nil))))
522+
(or inf-clojure-project-type
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 "generic")))))
518527

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

0 commit comments

Comments
 (0)