aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorNoam Postavsky2018-07-04 22:51:45 -0400
committerNoam Postavsky2018-08-04 11:55:40 -0400
commit95050a5841c01bbcb6e8a82838881eee7879b7b9 (patch)
tree566ce0574690af55f40488a615a0066237e8e825 /lisp
parentd228de8a26fdda28f5414200f32be6e7adfdacf7 (diff)
downloademacs-95050a5841c01bbcb6e8a82838881eee7879b7b9.tar.gz
emacs-95050a5841c01bbcb6e8a82838881eee7879b7b9.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/map-ynp.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 61c04ff7b3e..87c4079a95f 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);
257;; either long or short answers. 257;; either long or short answers.
258 258
259;; For backward compatibility check if short y/n answers are preferred. 259;; For backward compatibility check if short y/n answers are preferred.
260(defcustom read-answer-short (eq (symbol-function 'yes-or-no-p) 'y-or-n-p) 260(defcustom read-answer-short 'auto
261 "If non-nil, accept short answers to the question." 261 "If non-nil, `read-answer' accepts single-character answers.
262 :type 'boolean 262If t, accept short (single key-press) answers to the question.
263If nil, require long answers. If `auto', accept short answers if
264the function cell of `yes-or-no-p' is set to `y-or-on-p'."
265 :type '(choice (const :tag "Accept short answers" t)
266 (const :tag "Require long answer" nil)
267 (const :tag "Guess preference" auto))
263 :version "27.1" 268 :version "27.1"
264 :group 'minibuffer) 269 :group 'minibuffer)
265 270
@@ -290,8 +295,9 @@ When `read-answer-short' is non-nil, accept short answers.
290Return a long answer even in case of accepting short ones. 295Return a long answer even in case of accepting short ones.
291 296
292When `use-dialog-box' is t, pop up a dialog window to get user input." 297When `use-dialog-box' is t, pop up a dialog window to get user input."
293 (custom-reevaluate-setting 'read-answer-short) 298 (let* ((short (if (eq read-answer-short 'auto)
294 (let* ((short read-answer-short) 299 (eq (symbol-function 'yes-or-no-p) 'y-or-n-p)
300 read-answer-short))
295 (answers-with-help 301 (answers-with-help
296 (if (assoc "help" answers) 302 (if (assoc "help" answers)
297 answers 303 answers