GNU bug report logs - #46594
Use short answers

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 17 Feb 2021 19:11:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 46594 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: bug#46594: [External] : bug#46594: Use short answers
Date: Wed, 24 Feb 2021 22:50:21 +0200
[Message part 1 (text/plain, inline)]
>> 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:

[use-short-answers-2.patch (text/x-diff, inline)]
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);

This bug report was last modified 4 years and 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.