summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/map-ynp.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-02-25 20:45:40 +0200
committerJuri Linkov <juri@linkov.net>2021-02-25 20:45:40 +0200
commit297c0e0306f111c1e7564b2bb49a7e1a925a55bb (patch)
treef21135ef195dc0b8f74689888fec8a4e3f641f6c /lisp/emacs-lisp/map-ynp.el
parent056b468f74ff0aab41febaf6dbd4db23f3bebba2 (diff)
downloademacs-297c0e0306f111c1e7564b2bb49a7e1a925a55bb.tar.gz
emacs-297c0e0306f111c1e7564b2bb49a7e1a925a55bb.tar.bz2
emacs-297c0e0306f111c1e7564b2bb49a7e1a925a55bb.zip
New variable 'use-short-answers' to use 'y-or-n-p' instead of 'yes-or-no-p'
* lisp/cus-start.el: Add use-short-answers. * lisp/emacs-lisp/map-ynp.el (read-answer): Handle use-short-answers. (read-answer-short): Add use-short-answers to docstring. * src/fns.c (Fyes_or_no_p): Call y-or-n-p if use_short_answers is true. (syms_of_fns): Add DEFVAR_BOOL use-short-answers (bug#46594).
Diffstat (limited to 'lisp/emacs-lisp/map-ynp.el')
-rw-r--r--lisp/emacs-lisp/map-ynp.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 14112a1c147..86a0c76fd16 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -265,7 +265,8 @@ C-g to quit (cancel the whole command);
"If non-nil, `read-answer' accepts single-character answers.
If t, accept short (single key-press) answers to the question.
If nil, require long answers. If `auto', accept short answers if
-the function cell of `yes-or-no-p' is set to `y-or-n-p'."
+`use-short-answers' is non-nil, or the function cell of `yes-or-no-p'
+is set to `y-or-n-p'."
:type '(choice (const :tag "Accept short answers" t)
(const :tag "Require long answer" nil)
(const :tag "Guess preference" auto))
@@ -304,7 +305,8 @@ Return a long answer even in case of accepting short ones.
When `use-dialog-box' is t, pop up a dialog window to get user input."
(let* ((short (if (eq read-answer-short 'auto)
- (eq (symbol-function 'yes-or-no-p) 'y-or-n-p)
+ (or use-short-answers
+ (eq (symbol-function 'yes-or-no-p) 'y-or-n-p))
read-answer-short))
(answers-with-help
(if (assoc "help" answers)