Skip to content

Commit f298612

Browse files
authored
[Fix #173] Use clojure-mode project detection (#176)
We also get as an extra benefit project type caching and all of the project types supported by clojure-mode.
1 parent 977e176 commit f298612

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### New features
66

7+
* [#173](https://github.com/clojure-emacs/inf-clojure/issues/173): Use clojure-mode project detection instead of duplicate version in inf-clojure
78
* [#174](https://github.com/clojure-emacs/inf-clojure/pull/174): Set REPL type from startup form or prompt at startup, introduce `inf-clojure-custom-repl-type` defcustom.
89
* [#174](https://github.com/clojure-emacs/inf-clojure/pull/174): Invoke `inf-clojure` with a prefix argument to prevent using `inf-clojure-custom-startup` and `inf-clojure-custom-repl-type.
910

inf-clojure.el

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -595,21 +595,6 @@ to continue it."
595595
(inf-clojure-chomp (concat "\n" (inf-clojure-remove-subprompts str))))
596596
(t str)))
597597

598-
(defvar inf-clojure-project-root-files
599-
'("project.clj" "build.boot" "deps.edn" "shadow-cljs.edn")
600-
"A list of files that can be considered project markers.")
601-
602-
(defun inf-clojure-project-root ()
603-
"Retrieve the root directory of a project if available.
604-
605-
Fallback to `default-directory.' if not within a project."
606-
(or (car (remove nil
607-
(mapcar (lambda
608-
(file)
609-
(locate-dominating-file default-directory file))
610-
inf-clojure-project-root-files)))
611-
default-directory))
612-
613598
(defun inf-clojure-clear-repl-buffer ()
614599
"Clear the REPL buffer."
615600
(interactive)
@@ -682,7 +667,7 @@ process buffer for a list of commands.)"
682667
'confirm-after-completion))))
683668
(if (not (comint-check-proc "*inf-clojure*"))
684669
;; run the new process in the project's root when in a project folder
685-
(let ((default-directory (inf-clojure-project-root))
670+
(let ((default-directory (clojure-project-dir))
686671
(cmdlist (if (consp cmd)
687672
(list cmd)
688673
(split-string cmd)))
@@ -957,7 +942,7 @@ STRING if present."
957942
(prin1-to-string (substring-no-properties string))))
958943
nil
959944
(expand-file-name inf-clojure--log-file-name
960-
(inf-clojure-project-root))
945+
(clojure-project-dir))
961946
'append
962947
'no-annoying-write-file-in-minibuffer)))
963948

0 commit comments

Comments
 (0)