* 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).
When non-nil, then functions 'read-char-choice' and 'y-or-n-p' (respectively)
use the function 'read-key' to read a character instead of using the minibuffer.
+---
+** New variable 'use-short-answers' to use 'y-or-n-p' instead of 'yes-or-no-p'.
+This relieves of the need to define an alias that maps one to another
+in the init file. The same variable also affects the function 'read-answer'.
+
+++
** 'set-window-configuration' now takes an optional 'dont-set-frame'
parameter which, when non-nil, instructs the function not to select
;; 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)
"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))
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)
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);
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".
+It's discouraged to use single-key answers because `yes-or-no-p' is
+intended to be used when it's thought that you should not respond too
+quickly, so you take time and perhaps think more about the answer.
+When non-nil, then `yes-or-no-p' uses `y-or-n-p' to read an answer.
+The same variable also affects the function `read-answer'. */);
+ use_short_answers = false;
+
defsubr (&Sidentity);
defsubr (&Srandom);
defsubr (&Slength);