[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-clojure d81e266 116/313: [Fix #48] Stop prompting for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-clojure d81e266 116/313: [Fix #48] Stop prompting for the symbol at point by default (#51) |
Date: |
Wed, 11 Aug 2021 09:59:58 -0400 (EDT) |
branch: elpa/inf-clojure
commit d81e266e77316bc116ceca5dbc92fc3831825be3
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
[Fix #48] Stop prompting for the symbol at point by default (#51)
The patch makes so that the REPL commands don't prompt for things
anymore (except for `inf-clojure-apropos`). For prompting, the user will
need to pass a prefix argument to the command.
---
CHANGELOG.md | 2 +-
README.md | 4 +++
inf-clojure.el | 83 +++++++++++++++++++++++++++++++++-------------------------
3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dedc3fe..e11e079 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,10 +4,10 @@
### New Features
+* [#51](https://github.com/clojure-emacs/inf-clojure/pull/51): Commands do not
prompt by default anymore, unless they receive a non-nil prefix argument.
* [#44](https://github.com/clojure-emacs/inf-clojure/pull/44): Add REPL types
and Lumo support.
* [#50](https://github.com/clojure-emacs/inf-clojure/pull/50): Rename
defcustoms to `inf-clojure-*-form` where appropriate.
* [#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`.
* [#42](https://github.com/clojure-emacs/inf-clojure/issues/42): Add a
defcustom controlling the window in which the REPL buffer is displayed
(`inf-clojure-repl-use-same-window`).
* Font-lock the code in the REPL.
diff --git a/README.md b/README.md
index ff18d71..f28da31 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,10 @@ the default specified in `inf-clojure-program`.
You can set custom values to `inf-clojure` variables on a per-project basis
using [directory
variables](https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html).
+The REPL commands don't prompt by default but a prefix argument will invert
+this. For instance: `C-u C-c C-v` will ask for the symbol you want to show the
+docstring for.
+
## REPL Type
An `inf-clojure` REPL can be of different types: Clojure, ClojureScript, Lumo
and Planck are all potentially valid options.
diff --git a/inf-clojure.el b/inf-clojure.el
index a4b8dc2..40d1126 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -238,12 +238,6 @@ This should usually be a combination of
`inf-clojure-prompt' and
`inf-clojure-subprompt'."
:type 'regexp)
-(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))
- :package-version '(inf-clojure . "2.0.0"))
-
(defcustom inf-clojure-repl-use-same-window nil
"Controls whether to display the REPL buffer in the current window or not."
:type '(choice (const :tag "same" t)
@@ -722,22 +716,29 @@ The value is nil if it can't find one."
;;; Documentation functions: var doc and arglist.
;;; ======================================================================
-(defun inf-clojure-show-var-documentation (var)
+(defun inf-clojure-show-var-documentation (prompt-for-symbol)
"Send a form to the inferior Clojure to give documentation for VAR.
-See function `inf-clojure-var-doc-form'."
- (interactive (inf-clojure-symprompt "Var doc" (inf-clojure-var-at-pt)))
- (comint-proc-query (inf-clojure-proc) (format (inf-clojure-var-doc-form)
var)))
-
-(defun inf-clojure-show-var-source (var)
- "Send a form to the inferior Clojure to give source for VAR.
-See variable `inf-clojure-var-source-form'."
- (interactive (inf-clojure-symprompt "Var source" (inf-clojure-var-at-pt)))
- (comint-proc-query (inf-clojure-proc) (format inf-clojure-var-source-form
var)))
+See function `inf-clojure-var-doc-form'. When invoked with a
+prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol name."
+ (interactive "P")
+ (let ((var (if prompt-for-symbol
+ (car (inf-clojure-symprompt "Var doc"
(inf-clojure-var-at-pt)))
+ (inf-clojure-var-at-pt))))
+ (comint-proc-query (inf-clojure-proc) (format (inf-clojure-var-doc-form)
var))))
+
+(defun inf-clojure-show-var-source (prompt-for-symbol)
+ "Send a command to the inferior Clojure to give source for VAR.
+See variable `inf-clojure-var-source-form'. When invoked with a
+prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol name."
+ (interactive "P")
+ (let ((var (if prompt-for-symbol
+ (car (inf-clojure-symprompt "Var source"
(inf-clojure-var-at-pt)))
+ (inf-clojure-var-at-pt))))
+ (comint-proc-query (inf-clojure-proc) (format inf-clojure-var-source-form
var))))
(defun inf-clojure-arglist (fn)
"Send a query to the inferior Clojure for the arglist for function FN.
See variable `inf-clojure-arglist-form'."
- (interactive (inf-clojure-symprompt "Arglist" (inf-clojure-fn-called-at-pt)))
(let* ((proc (inf-clojure-proc))
(comint-filt (process-filter proc))
(kept "")
@@ -748,34 +749,44 @@ See variable `inf-clojure-arglist-form'."
(process-send-string proc eldoc-snippet)
(while (and (not (string-match inf-clojure-prompt kept))
(accept-process-output proc 2)))
- (setq eldoc (and (string-match "(.+)" kept) (match-string 0 kept)))
- )
+ (setq eldoc (and (string-match "(.+)" kept) (match-string 0 kept))))
(set-process-filter proc comint-filt))
eldoc))
-(defun inf-clojure-show-arglist (fn)
- "Show the arglist for function FN in the mini-buffer."
- (interactive (inf-clojure-symprompt "Arglist" (inf-clojure-fn-called-at-pt)))
- (let ((eldoc (inf-clojure-arglist fn)))
+(defun inf-clojure-show-arglist (prompt-for-symbol)
+ "Show the arglist for function FN in the mini-buffer.
+See variable `inf-clojure-arglist-form'. When invoked with a
+prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol name."
+ (interactive "P")
+ (let* ((fn (if prompt-for-symbol
+ (car (inf-clojure-symprompt "Arglist"
(inf-clojure-fn-called-at-pt)))
+ (inf-clojure-fn-called-at-pt)))
+ (eldoc (inf-clojure-arglist fn)))
(when eldoc
(message "%s: %s" fn eldoc))))
-(defun inf-clojure-show-ns-vars (ns)
+(defun inf-clojure-show-ns-vars (prompt-for-ns)
"Send a query to the inferior Clojure for the public vars in NS.
-See variable `inf-clojure-ns-vars-form'."
- (interactive (inf-clojure-symprompt "Ns vars" (clojure-find-ns)))
- (comint-proc-query (inf-clojure-proc) (format inf-clojure-ns-vars-form ns)))
+See variable `inf-clojure-ns-vars-form'. When invoked with a
+prefix argument PROMPT-FOR-NS, it prompts for a namespace name."
+ (interactive "P")
+ (let ((ns (if prompt-for-ns
+ (car (inf-clojure-symprompt "Ns vars" (clojure-find-ns)))
+ (clojure-find-ns))))
+ (comint-proc-query (inf-clojure-proc) (format inf-clojure-ns-vars-form
ns))))
-(defun inf-clojure-set-ns (ns)
+(defun inf-clojure-set-ns (prompt-for-ns)
"Set the ns of the inferior Clojure process to 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-form ns)))
+See variable `inf-clojure-set-ns-form`. It defaults to the ns of
+the current buffer. When invoked with a prefix argument
+PROMPT-FOR-NS, it prompts for a namespace name."
+ (interactive "P")
+ (let ((ns (if prompt-for-ns
+ (car (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-form
ns))))
(defun inf-clojure-apropos (var)
"Send a form to the inferior Clojure to give apropos for VAR.
- [nongnu] elpa/inf-clojure f24722c 294/313: Extract useful functions, (continued)
- [nongnu] elpa/inf-clojure f24722c 294/313: Extract useful functions, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure e1a93c7 121/313: Add lock around REPL type detection, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 5ef6bdf 123/313: Revert "Remove unwanted ansi chars from the REPL output", ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 7441d3b 120/313: Fix REPL type detection, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 2669544 129/313: [Fix #63] Avoid spurious output by using buffer redirection, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 0fbcfcb 140/313: Improve the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure db7bfaf 155/313: Fix the changelog, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 42f860f 169/313: Add Multiple Process Support section to README, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 3a93815 170/313: [Fix #105] Add planck-specific function for show-arglist (#106), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 204e5b7 114/313: Do some cleanup in preparation for a major release, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure d81e266 116/313: [Fix #48] Stop prompting for the symbol at point by default (#51),
ELPA Syncer <=
- [nongnu] elpa/inf-clojure 431c068 127/313: Fix three "variable is void" bugs, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 723064d 151/313: [Fix #83] Harden parsing of repl responses (#85), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure a705085 152/313: Add nil parameter to lumo completions' atom, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure f7ec13a 160/313: Improve performance of inf-clojure--process-response and close #89, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 12583f4 175/313: Add :safe clause for inf-clojure-repl-use-same-window, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 247ca70 182/313: Release 2.1.0, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 62bb0fc 186/313: Update CHANGELOG.md, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure dcb523b 191/313: Avoid computing completion bounds when no valid chars are at point, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 1507faa 119/313: Add dir support in Lumo, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure ff72d66 236/313: [Fix #171] Release 2.2.0, ELPA Syncer, 2021/08/11