From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#46594: Use short answers Date: Wed, 17 Feb 2021 20:59:47 +0200 Organization: LINKOV.NET Message-ID: <87im6qikpo.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24949"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) To: 46594@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 17 20:11:27 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCSER-0006KT-7u for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Feb 2021 20:11:27 +0100 Original-Received: from localhost ([::1]:34820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCSEQ-00042x-8F for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Feb 2021 14:11:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCSE2-00042f-K0 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 14:11:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCSE2-0003tV-Cr for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 14:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lCSE2-0003w9-71 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 14:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2021 19:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161358900815017 (code B ref -1); Wed, 17 Feb 2021 19:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Feb 2021 19:10:08 +0000 Original-Received: from localhost ([127.0.0.1]:44969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCSD9-0003u8-Mq for submit@debbugs.gnu.org; Wed, 17 Feb 2021 14:10:08 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:36392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCSD8-0003tz-A6 for submit@debbugs.gnu.org; Wed, 17 Feb 2021 14:10:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCSD8-0003ss-4X for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 14:10:06 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:49967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCSD5-0003ZU-5m for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2021 14:10:05 -0500 X-Originating-IP: 91.129.96.116 Original-Received: from mail.gandi.net (m91-129-96-116.cust.tele2.ee [91.129.96.116]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id C71201BF20D for ; Wed, 17 Feb 2021 19:09:57 +0000 (UTC) Received-SPF: pass client-ip=217.70.183.201; envelope-from=juri@linkov.net; helo=relay8-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200212 Archived-At: --=-=-= Content-Type: text/plain 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=use-short-answers.patch 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); --=-=-=--