Skip to content

Commit 0b90c95

Browse files
committed
Add defcustom inf-clojure-prompt-when-set-ns
The patch allow the user to disable the request "Set ns: ..." on C-c M-n. The default is to always prompt.
1 parent 3e22747 commit 0b90c95

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

inf-clojure.el

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ This should usually be a combination of `inf-clojure-prompt' and
179179
:type 'regexp
180180
:group 'inf-clojure)
181181

182+
(defcustom inf-clojure-prompt-when-set-ns t
183+
"Controls whether to prompt by default when switching namespace."
184+
:type '(choice (const :tag "always" t)
185+
(const :tag "never" nil))
186+
:group 'inf-clojure)
187+
182188
(defvar inf-clojure-buffer nil
183189
"The current inf-clojure process buffer.
184190
@@ -621,7 +627,11 @@ See variable `inf-clojure-ns-vars-command'."
621627
(defun inf-clojure-set-ns (ns)
622628
"Set the ns of the inferior Clojure process to NS.
623629
Defaults to the ns of the current buffer."
624-
(interactive (inf-clojure-symprompt "Set ns to" (clojure-find-ns)))
630+
(interactive (list (if inf-clojure-prompt-when-set-ns
631+
(inf-clojure-symprompt "Set ns to" (clojure-find-ns))
632+
(clojure-find-ns))))
633+
(when (or (not ns) (equal ns ""))
634+
(user-error "No namespace selected"))
625635
(comint-proc-query (inf-clojure-proc) (format inf-clojure-set-ns-command ns)))
626636

627637
(defun inf-clojure-apropos (var)

0 commit comments

Comments
 (0)