all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 46594@debbugs.gnu.org
Subject: bug#46594: [External] : bug#46594: Use short answers
Date: Wed, 24 Feb 2021 22:50:21 +0200	[thread overview]
Message-ID: <87blc9gpgy.fsf@mail.linkov.net> (raw)
In-Reply-To: <8335xltdmi.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 24 Feb 2021 22:27:49 +0200")

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

>> This is not only about about y-or-n-p/yes-or-no-p.  It also affects
>> the function 'read-answer' and its option 'read-answer-short'.
>
> Then why neither NEWS nor the doc string mention those other APIs?

Sorry, this fixes the omission:


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

diff --git a/etc/NEWS b/etc/NEWS
index caa366aaef..1ec080a6db 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2414,6 +2414,11 @@ and display the result.
 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
diff --git a/src/fns.c b/src/fns.c
index c16f9c6399..7c35957e0f 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5904,6 +5909,16 @@ 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".
+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, and giving the wrong answer would have serious consequences.
+When non-nil, it uses `y-or-n-p'.  In this case it means also obeying
+the value of `y-or-n-p-use-read-key'.  The same variable also affects
+the function `read-answer'.  */);
+  use_short_answers = false;
+
   defsubr (&Sidentity);
   defsubr (&Srandom);
   defsubr (&Slength);

  reply	other threads:[~2021-02-24 20:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blc9gpgy.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=46594@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.