aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuri Linkov2021-02-25 20:45:40 +0200
committerJuri Linkov2021-02-25 20:45:40 +0200
commit297c0e0306f111c1e7564b2bb49a7e1a925a55bb (patch)
treef21135ef195dc0b8f74689888fec8a4e3f641f6c /src
parent056b468f74ff0aab41febaf6dbd4db23f3bebba2 (diff)
downloademacs-297c0e0306f111c1e7564b2bb49a7e1a925a55bb.tar.gz
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 'src')
-rw-r--r--src/fns.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fns.c b/src/fns.c
index c16f9c63998..79b5a1e9930 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2873,6 +2873,11 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */)
2873 return obj; 2873 return obj;
2874 } 2874 }
2875 2875
2876 if (use_short_answers)
2877 {
2878 return call1 (intern ("y-or-n-p"), prompt);
2879 }
2880
2876 AUTO_STRING (yes_or_no, "(yes or no) "); 2881 AUTO_STRING (yes_or_no, "(yes or no) ");
2877 prompt = CALLN (Fconcat, prompt, yes_or_no); 2882 prompt = CALLN (Fconcat, prompt, yes_or_no);
2878 2883
@@ -5904,6 +5909,15 @@ that disables the use of a file dialog, regardless of the value of
5904this variable. */); 5909this variable. */);
5905 use_file_dialog = true; 5910 use_file_dialog = true;
5906 5911
5912 DEFVAR_BOOL ("use-short-answers", use_short_answers,
5913 doc: /* Non-nil means `yes-or-no-p' uses shorter answers "y" or "n".
5914It's discouraged to use single-key answers because `yes-or-no-p' is
5915intended to be used when it's thought that you should not respond too
5916quickly, so you take time and perhaps think more about the answer.
5917When non-nil, then `yes-or-no-p' uses `y-or-n-p' to read an answer.
5918The same variable also affects the function `read-answer'. */);
5919 use_short_answers = false;
5920
5907 defsubr (&Sidentity); 5921 defsubr (&Sidentity);
5908 defsubr (&Srandom); 5922 defsubr (&Srandom);
5909 defsubr (&Slength); 5923 defsubr (&Slength);