branch: elpa/inf-clojure
commit 7b2c46ad2b8e313269c08d9efbb2e89a50a15a5b
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Handle nil project in inf-clojure--project-dir
project-current returns nil when no project is detected, causing
project-root to error. Guard with when-let so we gracefully
return nil instead. Also add squint.edn to the project markers.
Fixes #219
---
inf-clojure.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/inf-clojure.el b/inf-clojure.el
index 82a06f7b5a..1859f5ee8e 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -755,7 +755,7 @@ The name is simply the final segment of the path."
(file-name-nondirectory (directory-file-name dir)))
(defun inf-clojure--project-dir ()
- "Return current Clojure project root."
+ "Return current Clojure project root, or nil if not in a project."
(let ((project-vc-extra-root-markers '("project.clj" ; Leiningen
"build.gradle" ; Gradle
"build.gradle.kts" ; Gradle
@@ -764,8 +764,10 @@ The name is simply the final segment of the path."
"bb.edn" ; babashka
"nbb.edn" ; nbb
"basilisp.edn" ; Basilisp (Python)
+ "squint.edn" ; Squint
)))
- (project-root (project-current))))
+ (when-let ((project (project-current)))
+ (project-root project))))
(defvar clojure-ts-mode-syntax-table)