summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-03-29 06:30:09 +0200
committerStefan Kangas <stefankangas@gmail.com>2023-03-29 06:30:09 +0200
commitf24aa0f46af1f808aa051fdbb44876a1141c928c (patch)
tree6373e545cd21ef33584529de9d2c9bd90016bed0 /lisp/subr.el
parent2002ac376c97382cace161ef0832a6faf6f376e8 (diff)
parent3965c65d5e28e0efdfa693046f6a2059e74465f9 (diff)
downloademacs-f24aa0f46af1f808aa051fdbb44876a1141c928c.tar.gz
Merge from origin/emacs-29
3965c65d5e2 ; * lisp/subr.el (read-char-choice): Fix last change. c1eac5b6586 Improve documentation of 'read-choice' and related symbols a8c9283e170 Revert "Comp fix calls to redefined primtives with op-byt... 8b66d8abd01 Revert "* lisp/emacs-lisp/comp.el (comp-emit-set-call-sub... 4ec4f614c71 ; Fix incompatibility in 'display-buffer-assq-regexp' ba3ade58f3b Skip ruby-ts-imenu-index test if needed 9133446db87 Fix Eglot Tramp tests on EMBA 5b351bc7fa9 * test/infra/Dockerfile.emba (emacs-gnustep): Instrument ...
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el56
1 files changed, 31 insertions, 25 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 39866dd7acb..123275b5971 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3233,34 +3233,40 @@ This function is used by the `interactive' code letter \"n\"."
n))
(defvar read-char-choice-use-read-key nil
- "Prefer `read-key' when reading a character by `read-char-choice'.
-Otherwise, use the minibuffer.
+ "If non-nil, use `read-key' when reading a character by `read-char-choice'.
+Otherwise, use the minibuffer (this is the default).
-When using the minibuffer, the user is less constrained, and can
-use the normal commands available in the minibuffer, and can, for
-instance, switch to another buffer, do things there, and then
-switch back again to the minibuffer before entering the
-character. This is not possible when using `read-key', but using
-`read-key' may be less confusing to some users.")
+When reading via the minibuffer, you can use the normal commands
+available in the minibuffer, and can, for instance, temporarily
+switch to another buffer, do things there, and then switch back
+to the minibuffer before entering the character. This is not
+possible when using `read-key', but using `read-key' may be less
+confusing to some users.")
(defun read-char-choice (prompt chars &optional inhibit-keyboard-quit)
- "Read and return one of CHARS, prompting for PROMPT.
-Any input that is not one of CHARS is ignored.
-
-By default, the minibuffer is used to read the key
-non-modally (see `read-char-from-minibuffer'). If
+ "Read and return one of the characters in CHARS, prompting with PROMPT.
+CHARS should be a list of single characters.
+The function discards any input character that is not one of CHARS,
+and by default shows a message to the effect that it is not one of
+the expected characters.
+
+By default, this function uses the minibuffer to read the key
+non-modally (see `read-char-from-minibuffer'), and the optional
+argument INHIBIT-KEYBOARD-QUIT is ignored. However, if
`read-char-choice-use-read-key' is non-nil, the modal `read-key'
-function is used instead (see `read-char-choice-with-read-key')."
+function is used instead (see `read-char-choice-with-read-key'),
+and INHIBIT-KEYBOARD-QUIT is passed to it."
(if (not read-char-choice-use-read-key)
(read-char-from-minibuffer prompt chars)
(read-char-choice-with-read-key prompt chars inhibit-keyboard-quit)))
(defun read-char-choice-with-read-key (prompt chars &optional inhibit-keyboard-quit)
- "Read and return one of CHARS, prompting for PROMPT.
+ "Read and return one of the characters in CHARS, prompting with PROMPT.
+CHARS should be a list of single characters.
Any input that is not one of CHARS is ignored.
If optional argument INHIBIT-KEYBOARD-QUIT is non-nil, ignore
-`keyboard-quit' events while waiting for a valid input.
+`keyboard-quit' events while waiting for valid input.
If you bind the variable `help-form' to a non-nil value
while calling this function, then pressing `help-char'
@@ -3556,15 +3562,15 @@ Also discard all previous input in the minibuffer."
(sit-for 2)))
(defvar y-or-n-p-use-read-key nil
- "Prefer `read-key' when answering a \"y or n\" question by `y-or-n-p'.
-Otherwise, use the minibuffer.
-
-When using the minibuffer, the user is less constrained, and can
-use the normal commands available in the minibuffer, and can, for
-instance, switch to another buffer, do things there, and then
-switch back again to the minibuffer before entering the
-character. This is not possible when using `read-key', but using
-`read-key' may be less confusing to some users.")
+ "Use `read-key' when reading answers to \"y or n\" questions by `y-or-n-p'.
+Otherwise, use the `read-from-minibuffer' to read the answers.
+
+When reading via the minibuffer, you can use the normal commands
+available in the minibuffer, and can, for instance, temporarily
+switch to another buffer, do things there, and then switch back
+to the minibuffer before entering the character. This is not
+possible when using `read-key', but using `read-key' may be less
+confusing to some users.")
(defvar from--tty-menu-p nil
"Non-nil means the current command was invoked from a TTY menu.")