From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Date: Sun, 1 Oct 2017 16:15:56 -0700 (PDT) Message-ID: <3440084b-1e2d-44d8-a291-44d6622bbbbc@default> References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1506899837 24328 195.159.176.226 (1 Oct 2017 23:17:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 1 Oct 2017 23:17:17 +0000 (UTC) Cc: 28525@debbugs.gnu.org, npostavs@users.sourceforge.net To: Tino Calancha , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 02 01:17:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dynTy-0005Nd-71 for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Oct 2017 01:17:10 +0200 Original-Received: from localhost ([::1]:50060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dynU2-0002CY-5b for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Oct 2017 19:17:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dynTt-0002CS-Ni for bug-gnu-emacs@gnu.org; Sun, 01 Oct 2017 19:17:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dynTq-0001hI-HQ for bug-gnu-emacs@gnu.org; Sun, 01 Oct 2017 19:17:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34529) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dynTq-0001h8-Ej for bug-gnu-emacs@gnu.org; Sun, 01 Oct 2017 19:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dynTq-0003q1-6J for bug-gnu-emacs@gnu.org; Sun, 01 Oct 2017 19:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Oct 2017 23:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150689976714672 (code B ref 28525); Sun, 01 Oct 2017 23:17:02 +0000 Original-Received: (at 28525) by debbugs.gnu.org; 1 Oct 2017 23:16:07 +0000 Original-Received: from localhost ([127.0.0.1]:43210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dynSx-0003oa-DM for submit@debbugs.gnu.org; Sun, 01 Oct 2017 19:16:07 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:44420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dynSv-0003nn-A8 for 28525@debbugs.gnu.org; Sun, 01 Oct 2017 19:16:05 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v91NFwVl028924 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 1 Oct 2017 23:15:58 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v91NFwoN018468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 1 Oct 2017 23:15:58 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v91NFvaw008347; Sun, 1 Oct 2017 23:15:57 GMT In-Reply-To: <87poa7tstz.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4588.0 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137761 Archived-At: FWIW: I don't think that Emacs should test for function aliases and change its behavior accordingly. I don't think users should be encouraged to alias `yes-or-no-p' to `y-or-n-p'. That's a bad idea _in general_, IMO, even if it some users might find it's appropriate for them. I think that making Emacs code automatically recognize such an alias just encourages such (bad) practice on the part of users. ---- FWIW2: It can, however, be helpful to let users override a design choice of `y-or-n-p' or `yes-or-no-p' _for a given calling function_ (as opposed to globally). I've written library Yes-No, to provide such a feature. https://www.emacswiki.org/emacs/Yes-No `yes-no.el' provides no behavior change, except for code that wants to let users decide. For that, the author just provides the symbol for the calling function as an additional argument to the prompting function. For example, the behavior of this call from function `foo' is unchanged: (yes-or-no-p "Agree? "). But this call from function `foo' lets users decide: (yes-or-no-p "Agree? " 'foo). In the latter case, a user can answer `yes', `no', or `use-y-or-n' (which is available with completion). If the latter then the call immediately switches to using `y-or-n-p', and all `yes-or-no-p' calls from function `foo' from then on are redirected to use `y-or-n-p' instead. Similarly, this call from `bar' lets users decide: (y-or-n-p "Agree? " 'bar). Here, a user can answer using character `y', `n', or `e'. Answer `e' switches immediately to using `yes-or-no-p', and all `y-or-n-p' calls from function `bar' from then on are redirected to `yes-or-no-p'. When either redirection is in effect, a user can of course redirect back again, to the original behavior (programmer-defined). And when either redirection is in effect, a user can reset the call to use only the default behavior from then on. To reset a `yes-or-no-p' prompt (redirected from `y-or-n-p') a user chooses input `reset-to-default' (with completion). To reset a `y-or-n-p' prompt (redirected from `yes-or-no-p') a user uses character `^'. A user option lets a user turn off respect of the optional CALLER arg. If nil then there is no change in behavior from vanilla Emacs: no other inputs are allowed besides yes/no or y/n. So even if a library author provides CALLER, to let users decide on a case-by-case basis, a user can choose not to allow herself to do so. (Obviously, a library that uses argument CALLER must require library `yes-no.el'.) The behavior is implemented by putting the symbol for the prompting function to redirect to on the symbol for the calling function, as the value of property `yes/no-prompting'. For example, if a user chooses `use-y-or-n' from `yes-or-no-p' called from `foo', we do this to redirect such calls to prompt with `y-or-n-p': (put 'foo 'yes/no-prompting 'y-or-n-p) Resetting to the default behavior just puts nil as the property value.