emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-clojure 6a354dc 097/313: Add defcustom `inf-clojure-pr


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure 6a354dc 097/313: Add defcustom `inf-clojure-prompt-on-set-ns` (#46)
Date: Wed, 11 Aug 2021 09:59:54 -0400 (EDT)

branch: elpa/inf-clojure
commit 6a354dc3ea101c27dcde2c404f314d7ffcd61c03
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Add defcustom `inf-clojure-prompt-on-set-ns` (#46)
    
    The patch allow the user to disable the prompt "Set ns: ..." on `C-c
    M-n`. The default is to always prompt.
---
 CHANGELOG.md   |  1 +
 inf-clojure.el | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99009ea..b5e8134 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 ### New Features
 
 * [#34](https://github.com/clojure-emacs/inf-clojure/pull/34): Add support for 
socket REPL connections.
+* [#46](https://github.com/clojure-emacs/inf-clojure/pull/46): Make it 
possible to disable prompt on `inf-clojure-set-ns`.
 * New interactive command `inf-clojure-display-version`.
 
 ### Bugs Fixed
diff --git a/inf-clojure.el b/inf-clojure.el
index 13bfeb4..3a445f1 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -179,6 +179,12 @@ This should usually be a combination of 
`inf-clojure-prompt' and
   :type 'regexp
   :group 'inf-clojure)
 
+(defcustom inf-clojure-prompt-on-set-ns t
+  "Controls whether to prompt when switching namespace."
+  :type '(choice (const :tag "always" t)
+                 (const :tag "never" nil))
+  :group 'inf-clojure)
+
 (defvar inf-clojure-buffer nil
   "The current inf-clojure process buffer.
 
@@ -620,8 +626,13 @@ See variable `inf-clojure-ns-vars-command'."
 
 (defun inf-clojure-set-ns (ns)
   "Set the ns of the inferior Clojure process to NS.
-Defaults to the ns of the current buffer."
-  (interactive (inf-clojure-symprompt "Set ns to" (clojure-find-ns)))
+Defaults to the ns of the current buffer, always prompting before
+setting, unless `inf-clojure-prompt-on-set-ns` is nil."
+  (interactive (list (if inf-clojure-prompt-on-set-ns
+                         (inf-clojure-symprompt "Set ns to" (clojure-find-ns))
+                       (clojure-find-ns))))
+  (when (or (not ns) (equal ns ""))
+    (user-error "No namespace selected"))
   (comint-proc-query (inf-clojure-proc) (format inf-clojure-set-ns-command 
ns)))
 
 (defun inf-clojure-apropos (var)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]