all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#46594: Use short answers
@ 2021-02-17 18:59 Juri Linkov
  2021-02-22 15:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2021-02-17 18:59 UTC (permalink / raw)
  To: 46594

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

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?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: use-short-answers.patch --]
[-- Type: text/x-diff, Size: 1808 bytes --]

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);

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-02-25 18:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-17 18:59 bug#46594: Use short answers Juri Linkov
2021-02-22 15:13 ` Lars Ingebrigtsen
2021-02-22 17:13   ` bug#46594: [External] : " Drew Adams
2021-02-24 18:44     ` Juri Linkov
2021-02-24 19:26       ` Eli Zaretskii
2021-02-24 19:49         ` Juri Linkov
2021-02-24 20:27           ` Eli Zaretskii
2021-02-24 20:50             ` Juri Linkov
2021-02-25 15:04               ` Eli Zaretskii
2021-02-25 18:45                 ` Juri Linkov
2021-02-24 23:55       ` Drew Adams
2021-02-25  9:20         ` Juri Linkov
2021-02-25 16:40           ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.