[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46594: Use short answers
From: |
Juri Linkov |
Subject: |
bug#46594: Use short answers |
Date: |
Wed, 17 Feb 2021 20:59:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
Tags: patch
As discussed in
https://lists.gnu.org/archive/html/emacs-devel/2020-12/msg01915.html
here is an option that accomplishes the mapping of
(defalias 'yes-or-no-p 'y-or-n-p)
> It's a bit more than just
>
> Non-nil means `yes-or-no-p' uses shorter answers "y" or "n".
>
> because short circuiting it to 'y-or-n-p' means it will also obey
> 'y-or-n-p-use-read-key'.
This is a related option, but I'm not sure if it should be mentioned
in the docstring. Maybe a simple reference should be sufficient?
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index c0a4a6dda0..d17c419c36 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -302,6 +302,7 @@ minibuffer-prompt-properties--setter
;; fns.c
(use-dialog-box menu boolean "21.1")
(use-file-dialog menu boolean "22.1")
+ (use-short-answers menu boolean "28.1")
(focus-follows-mouse
frames (choice
(const :tag "Off (nil)" :value nil)
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 14112a1c14..6be57a4fca 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -304,7 +304,8 @@ read-answer
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)
diff --git a/src/fns.c b/src/fns.c
index c16f9c6399..f51ef2781d 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2873,6 +2873,11 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1,
0,
return obj;
}
+ if (use_short_answers)
+ {
+ return call1 (intern ("y-or-n-p"), prompt);
+ }
+
AUTO_STRING (yes_or_no, "(yes or no) ");
prompt = CALLN (Fconcat, prompt, yes_or_no);
@@ -5904,6 +5909,10 @@ syms_of_fns (void)
this variable. */);
use_file_dialog = true;
+ DEFVAR_BOOL ("use-short-answers", use_short_answers,
+ doc: /* Non-nil means `yes-or-no-p' uses shorter answers "y" or "n". */);
+ use_short_answers = false;
+
defsubr (&Sidentity);
defsubr (&Srandom);
defsubr (&Slength);
- bug#46594: Use short answers,
Juri Linkov <=
- bug#46594: Use short answers, Lars Ingebrigtsen, 2021/02/22
- bug#46594: [External] : bug#46594: Use short answers, Drew Adams, 2021/02/22
- bug#46594: [External] : bug#46594: Use short answers, Juri Linkov, 2021/02/24
- bug#46594: [External] : bug#46594: Use short answers, Eli Zaretskii, 2021/02/24
- bug#46594: [External] : bug#46594: Use short answers, Juri Linkov, 2021/02/24
- bug#46594: [External] : bug#46594: Use short answers, Eli Zaretskii, 2021/02/24
- bug#46594: [External] : bug#46594: Use short answers, Juri Linkov, 2021/02/24
- bug#46594: [External] : bug#46594: Use short answers, Eli Zaretskii, 2021/02/25
- bug#46594: [External] : bug#46594: Use short answers, Juri Linkov, 2021/02/25
- bug#46594: [External] : bug#46594: Use short answers, Drew Adams, 2021/02/24