Skip to content

Commit a450a0b

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 b376a36 commit a450a0b

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

262262
(put 'inf-clojure-mode 'mode-class 'special)
263263

264-
(defcustom inf-clojure-repl-flavor 'clojure
265-
"Symbol to define your REPL flavor.
266-
The default flavor is 'clojure, 'lumo is the other supported
264+
(defcustom inf-clojure-repl-default-flavor 'clojure
265+
"Symbol to define your default REPL flavor.
266+
The default flavor is clojure, lumo is the other supported
267267
one."
268-
:type 'symbol
269-
:options '(clojure lumo)
268+
:type '(choice (const :tag "Lumo" lumo)
269+
(other :tag "Clojure" clojure))
270270
:group 'inf-clojure)
271271

272+
(defvar-local inf-clojure-repl-flavor inf-clojure-repl-default-flavor
273+
"Symbol to define your REPL flavor.
274+
Takes its root binding from inf-clojure-repl-default-flavor but
275+
can be further customized using either `setq-local` or an entry
276+
in `.dir-locals.el`." )
277+
272278
(defun inf-clojure--flavor-setup ()
273279
"Setup inf-clojure defcustoms depending on the choose flavor."
274280
(pcase inf-clojure-repl-flavor
275-
(lumo (progn (message "[inf-clojure] will switch to the Lumo flavor")
276-
(inf-clojure--flavor-lumo-setup)))
277-
(_ (message "[inf-clojure] will default to the Clojure 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."))))
278284

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

0 commit comments

Comments
 (0)