Skip to content

Use clojure-mode project detection #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* [#173](https://github.com/clojure-emacs/inf-clojure/issues/173): Use clojure-mode project detection instead of duplicate version in inf-clojure
* [#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.
* [#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.

Expand Down
19 changes: 2 additions & 17 deletions inf-clojure.el
Original file line number Diff line number Diff line change
Expand Up @@ -595,21 +595,6 @@ to continue it."
(inf-clojure-chomp (concat "\n" (inf-clojure-remove-subprompts str))))
(t str)))

(defvar inf-clojure-project-root-files
'("project.clj" "build.boot" "deps.edn" "shadow-cljs.edn")
"A list of files that can be considered project markers.")

(defun inf-clojure-project-root ()
"Retrieve the root directory of a project if available.

Fallback to `default-directory.' if not within a project."
(or (car (remove nil
(mapcar (lambda
(file)
(locate-dominating-file default-directory file))
inf-clojure-project-root-files)))
default-directory))

(defun inf-clojure-clear-repl-buffer ()
"Clear the REPL buffer."
(interactive)
Expand Down Expand Up @@ -682,7 +667,7 @@ process buffer for a list of commands.)"
'confirm-after-completion))))
(if (not (comint-check-proc "*inf-clojure*"))
;; run the new process in the project's root when in a project folder
(let ((default-directory (inf-clojure-project-root))
(let ((default-directory (clojure-project-dir))
(cmdlist (if (consp cmd)
(list cmd)
(split-string cmd)))
Expand Down Expand Up @@ -957,7 +942,7 @@ STRING if present."
(prin1-to-string (substring-no-properties string))))
nil
(expand-file-name inf-clojure--log-file-name
(inf-clojure-project-root))
(clojure-project-dir))
'append
'no-annoying-write-file-in-minibuffer)))

Expand Down