[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 95050a5 5/6: Respect non-saved value of `read-short
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master 95050a5 5/6: Respect non-saved value of `read-short-answer' (Bug#31782) |
Date: |
Sat, 4 Aug 2018 11:56:23 -0400 (EDT) |
branch: master
commit 95050a5841c01bbcb6e8a82838881eee7879b7b9
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Respect non-saved value of `read-short-answer' (Bug#31782)
* lisp/emacs-lisp/map-ynp.el (read-answer-short): Add an `auto'
setting.
(read-answer): Check the function cell of `yes-or-no-p' when
`read-answer-short' is `auto' rather than calling
`custom-reevaluate-setting' which would reset the option to its saved
value.
---
lisp/emacs-lisp/map-ynp.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 61c04ff..87c4079 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -257,9 +257,14 @@ C-g to quit (cancel the whole command);
;; either long or short answers.
;; For backward compatibility check if short y/n answers are preferred.
-(defcustom read-answer-short (eq (symbol-function 'yes-or-no-p) 'y-or-n-p)
- "If non-nil, accept short answers to the question."
- :type 'boolean
+(defcustom read-answer-short 'auto
+ "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-on-p'."
+ :type '(choice (const :tag "Accept short answers" t)
+ (const :tag "Require long answer" nil)
+ (const :tag "Guess preference" auto))
:version "27.1"
:group 'minibuffer)
@@ -290,8 +295,9 @@ When `read-answer-short' is non-nil, accept short answers.
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."
- (custom-reevaluate-setting 'read-answer-short)
- (let* ((short read-answer-short)
+ (let* ((short (if (eq read-answer-short 'auto)
+ (eq (symbol-function 'yes-or-no-p) 'y-or-n-p)
+ read-answer-short))
(answers-with-help
(if (assoc "help" answers)
answers
- [Emacs-diffs] master updated (c27bd46 -> 84ecc48), Noam Postavsky, 2018/08/04
- [Emacs-diffs] master b6dd037 2/6: ; Merge from emacs-26, Noam Postavsky, 2018/08/04
- [Emacs-diffs] master 95050a5 5/6: Respect non-saved value of `read-short-answer' (Bug#31782),
Noam Postavsky <=
- [Emacs-diffs] master 529ec8d 3/6: Merge from emacs-26, Noam Postavsky, 2018/08/04
- [Emacs-diffs] master 84ecc48 6/6: ; etc/NEWS: Remove read-answer, it was backported to v26, Noam Postavsky, 2018/08/04
- [Emacs-diffs] master d228de8 4/6: ; Merge from emacs-26, Noam Postavsky, 2018/08/04
- [Emacs-diffs] master 6328d2f 1/6: Merge from emacs-26, Noam Postavsky, 2018/08/04