Skip to content

Commit 02b6200

Browse files
committed
Add inf-clojure-prompt-on-commands and closes #48
The patch introduces a way to globally disable prompting. It deletes `inf-clojure-prompt-when-set-ns`.
1 parent 3929054 commit 02b6200

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

inf-clojure.el

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ This should usually be a combination of `inf-clojure-prompt' and
230230
`inf-clojure-subprompt'."
231231
:type 'regexp)
232232

233-
(defcustom inf-clojure-prompt-on-set-ns t
233+
(defcustom inf-clojure-prompt-on-commands t
234234
"Controls whether to prompt when switching namespace."
235235
:type '(choice (const :tag "always" t)
236-
(const :tag "never" nil)))
236+
(const :tag "never" nil))
237+
:safe 'booleanp)
237238

238239
(defcustom inf-clojure-repl-use-same-window nil
239240
"Controls whether to display the REPL buffer in the current window or not."
@@ -686,19 +687,25 @@ The value is nil if it can't find one."
686687
(defun inf-clojure-show-var-documentation (var)
687688
"Send a form to the inferior Clojure to give documentation for VAR.
688689
See function `inf-clojure-var-doc-form'."
689-
(interactive (inf-clojure-symprompt "Var doc" (inf-clojure-var-at-pt)))
690+
(interactive (list (if inf-clojure-prompt-on-commands
691+
(inf-clojure-symprompt "Var doc" (inf-clojure-var-at-pt))
692+
(inf-clojure-var-at-pt))))
690693
(comint-proc-query (inf-clojure-proc) (format (inf-clojure-var-doc-form) var)))
691694

692695
(defun inf-clojure-show-var-source (var)
693-
"Send a form to the inferior Clojure to give source for VAR.
694-
See variable `inf-clojure-var-source-form'."
695-
(interactive (inf-clojure-symprompt "Var source" (inf-clojure-var-at-pt)))
696+
"Send a command to the inferior Clojure to give source for VAR.
697+
See variable `inf-clojure-var-source-command'."
698+
(interactive (list (if inf-clojure-prompt-on-commands
699+
(inf-clojure-symprompt "Var source" (inf-clojure-var-at-pt))
700+
(inf-clojure-var-at-pt))))
696701
(comint-proc-query (inf-clojure-proc) (format inf-clojure-var-source-form var)))
697702

698703
(defun inf-clojure-arglist (fn)
699704
"Send a query to the inferior Clojure for the arglist for function FN.
700705
See variable `inf-clojure-arglist-form'."
701-
(interactive (inf-clojure-symprompt "Arglist" (inf-clojure-fn-called-at-pt)))
706+
(interactive (list (if inf-clojure-prompt-on-commands
707+
(inf-clojure-symprompt "Arglist" (inf-clojure-fn-called-at-pt))
708+
(inf-clojure-fn-called-at-pt))))
702709
(let* ((proc (inf-clojure-proc))
703710
(comint-filt (process-filter proc))
704711
(kept "")
@@ -709,29 +716,32 @@ See variable `inf-clojure-arglist-form'."
709716
(process-send-string proc eldoc-snippet)
710717
(while (and (not (string-match inf-clojure-prompt kept))
711718
(accept-process-output proc 2)))
712-
(setq eldoc (and (string-match "(.+)" kept) (match-string 0 kept)))
713-
)
719+
(setq eldoc (and (string-match "(.+)" kept) (match-string 0 kept))))
714720
(set-process-filter proc comint-filt))
715721
eldoc))
716722

717723
(defun inf-clojure-show-arglist (fn)
718724
"Show the arglist for function FN in the mini-buffer."
719-
(interactive (inf-clojure-symprompt "Arglist" (inf-clojure-fn-called-at-pt)))
725+
(interactive (list (if inf-clojure-prompt-on-commands
726+
(inf-clojure-symprompt "Arglist" (inf-clojure-fn-called-at-pt))
727+
(inf-clojure-fn-called-at-pt))))
720728
(let ((eldoc (inf-clojure-arglist fn)))
721729
(when eldoc
722730
(message "%s: %s" fn eldoc))))
723731

724732
(defun inf-clojure-show-ns-vars (ns)
725733
"Send a query to the inferior Clojure for the public vars in NS.
726734
See variable `inf-clojure-ns-vars-form'."
727-
(interactive (inf-clojure-symprompt "Ns vars" (clojure-find-ns)))
735+
(interactive (list (if inf-clojure-prompt-on-commands
736+
(inf-clojure-symprompt "Ns vars" (clojure-find-ns))
737+
(clojure-find-ns))))
728738
(comint-proc-query (inf-clojure-proc) (format inf-clojure-ns-vars-form ns)))
729739

730740
(defun inf-clojure-set-ns (ns)
731741
"Set the ns of the inferior Clojure process to NS.
732742
Defaults to the ns of the current buffer, always prompting before
733743
setting, unless `inf-clojure-prompt-on-set-ns` is nil."
734-
(interactive (list (if inf-clojure-prompt-on-set-ns
744+
(interactive (list (if inf-clojure-prompt-on-commands
735745
(inf-clojure-symprompt "Set ns to" (clojure-find-ns))
736746
(clojure-find-ns))))
737747
(when (or (not ns) (equal ns ""))
@@ -741,7 +751,9 @@ setting, unless `inf-clojure-prompt-on-set-ns` is nil."
741751
(defun inf-clojure-apropos (var)
742752
"Send a form to the inferior Clojure to give apropos for VAR.
743753
See variable `inf-clojure-apropos-form'."
744-
(interactive (inf-clojure-symprompt "Var apropos" (inf-clojure-var-at-pt)))
754+
(interactive (list (if inf-clojure-prompt-on-commands
755+
(inf-clojure-symprompt "Var apropos" (inf-clojure-var-at-pt))
756+
(inf-clojure-var-at-pt))))
745757
(comint-proc-query (inf-clojure-proc) (format inf-clojure-apropos-form var)))
746758

747759
(defun inf-clojure-macroexpand (&optional macro-1)

0 commit comments

Comments
 (0)