Skip to content

Commit 7ecd990

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 ed98754 commit 7ecd990

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
@@ -228,20 +228,26 @@ whichever process buffer you want to use.")
228228

229229
(put 'inf-clojure-mode 'mode-class 'special)
230230

231-
(defcustom inf-clojure-repl-flavor 'clojure
232-
"Symbol to define your REPL flavor.
233-
The default flavor is 'clojure, 'lumo is the other supported
231+
(defcustom inf-clojure-repl-default-flavor 'clojure
232+
"Symbol to define your default REPL flavor.
233+
The default flavor is clojure, lumo is the other supported
234234
one."
235-
:type 'symbol
236-
:options '(clojure lumo)
235+
:type '(choice (const :tag "Lumo" lumo)
236+
(other :tag "Clojure" clojure))
237237
:group 'inf-clojure)
238238

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

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

0 commit comments

Comments
 (0)