Skip to content

Commit 35f5d71

Browse files
mbuczkobbatsov
authored andcommitted
[Fix #451] Make the function determining the project directory customizable (#452)
1 parent b901fa7 commit 35f5d71

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* [#443](https://github.com/clojure-emacs/clojure-mode/issues/443): Fix behavior of `clojure-forward-logical-sexp` and `clojure-backward-logical-sexp` with conditional macros.
1111
* [#429](https://github.com/clojure-emacs/clojure-mode/issues/429): Fix a bug causing last occurrence of expression sometimes is not replaced when using `move-to-let`.
1212
* [#423](https://github.com/clojure-emacs/clojure-mode/issues/423): Make `clojure-match-next-def` more robust against zero-arity def-like forms.
13+
* [#451](https://github.com/clojure-emacs/clojure-mode/issues/451): Make project root directory calculation customized by `clojure-project-root-function`
1314

1415
### New features
1516

clojure-mode.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ Out-of-the box `clojure-mode' understands lein, boot and gradle."
192192
(and (listp value)
193193
(cl-every 'stringp value))))
194194

195+
(defcustom clojure-project-root-function #'clojure-project-root-path
196+
"Function to locate clojure project root directory."
197+
:type 'function
198+
:risky t
199+
:package-version '(clojure-mode . "5.7.0"))
200+
195201
(defcustom clojure-refactor-map-prefix (kbd "C-c C-r")
196202
"Clojure refactor keymap prefix."
197203
:type 'string
@@ -1604,6 +1610,13 @@ nil."
16041610
(defun clojure-project-dir (&optional dir-name)
16051611
"Return the absolute path to the project's root directory.
16061612
1613+
Call is delegated down to `clojure-project-root-function' with
1614+
optional DIR-NAME as argument."
1615+
(funcall clojure-project-root-function dir-name))
1616+
1617+
(defun clojure-project-root-path (&optional dir-name)
1618+
"Return the absolute path to the project's root directory.
1619+
16071620
Use `default-directory' if DIR-NAME is nil.
16081621
Return nil if not inside a project."
16091622
(let* ((dir-name (or dir-name default-directory))

0 commit comments

Comments
 (0)