Skip to content

Commit e14ad28

Browse files
committed
Insert flavor check before project type check
1 parent a450a0b commit e14ad28

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

inf-clojure.el

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,6 @@ Takes its root binding from inf-clojure-repl-default-flavor but
275275
can be further customized using either `setq-local` or an entry
276276
in `.dir-locals.el`." )
277277

278-
(defun inf-clojure--flavor-setup ()
279-
"Setup inf-clojure defcustoms depending on the choose flavor."
280-
(pcase inf-clojure-repl-flavor
281-
(lumo (inf-clojure--flavor-lumo-setup))
282-
(clojure nil)
283-
(_ (user-error "[inf-clojure] The specified flavor is not supported at the moment."))))
284-
285278
(define-derived-mode inf-clojure-mode comint-mode "Inferior Clojure"
286279
"Major mode for interacting with an inferior Clojure process.
287280
Runs a Clojure interpreter as a subprocess of Emacs, with Clojure
@@ -391,12 +384,20 @@ Fallback to `default-directory.' if not within a project."
391384
((file-exists-p "build.boot") "boot")
392385
(t nil))))
393386

387+
(defun inf-clojure-flavor ()
388+
"Determine the flavor of the project."
389+
(pcase inf-clojure-repl-flavor
390+
(lumo (inf-clojure--lumo-repl-command))
391+
(_ nil)))
392+
394393
(defun inf-clojure-cmd (project-type)
395394
"Determine the command `inf-clojure' needs to invoke for the PROJECT-TYPE."
396-
(pcase project-type
397-
("lein" inf-clojure-lein-cmd)
398-
("boot" inf-clojure-boot-cmd)
399-
(_ inf-clojure-generic-cmd)))
395+
(if-let ((flavor-command (inf-clojure-flavor)))
396+
flavor-command
397+
(pcase project-type
398+
("lein" inf-clojure-lein-cmd)
399+
("boot" inf-clojure-boot-cmd)
400+
(_ inf-clojure-generic-cmd))))
400401

401402
(defun inf-clojure-clear-repl-buffer ()
402403
"Clear the REPL buffer."

0 commit comments

Comments
 (0)