Skip to content

Commit b9c958f

Browse files
committed
Make inf-clojure-repl-flavor a local variable
This patch also improves the defcustom and throws a user-error in case the flavor is not supported.
1 parent 25a8f67 commit b9c958f

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

inf-clojure.el

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,26 @@ whichever process buffer you want to use.")
222222

223223
(put 'inf-clojure-mode 'mode-class 'special)
224224

225-
(defcustom inf-clojure-repl-flavor 'clojure
226-
"Symbol to define your REPL flavor.
227-
The default flavor is 'clojure, 'lumo is the other supported
225+
(defcustom inf-clojure-repl-default-flavor 'clojure
226+
"Symbol to define your default REPL flavor.
227+
The default flavor is clojure, lumo is the other supported
228228
one."
229-
:type 'symbol
230-
:options '(clojure lumo)
229+
:type '(choice (const :tag "Lumo" lumo)
230+
(other :tag "Clojure" clojure))
231231
:group 'inf-clojure)
232232

233+
(defvar-local inf-clojure-repl-flavor inf-clojure-repl-default-flavor
234+
"Symbol to define your REPL flavor.
235+
Takes its root binding from inf-clojure-repl-default-flavor but
236+
can be further customized using either `setq-local` or an entry
237+
in `.dir-locals.el`." )
238+
233239
(defun inf-clojure--flavor-setup ()
234240
"Setup inf-clojure defcustoms depending on the choose flavor."
235241
(pcase inf-clojure-repl-flavor
236-
(lumo (progn (message "[inf-clojure] will switch to the Lumo flavor")
237-
(inf-clojure--flavor-lumo-setup)))
238-
(_ (message "[inf-clojure] will default to the Clojure flavor"))))
242+
(lumo (inf-clojure--flavor-lumo-setup))
243+
(clojure nil)
244+
(_ (user-error "[inf-clojure] The specified flavor is not supported at the moment."))))
239245

240246
(define-derived-mode inf-clojure-mode comint-mode "Inferior Clojure"
241247
"Major mode for interacting with an inferior Clojure process.

0 commit comments

Comments
 (0)