From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: yes-or-no-p prompt conditionally broken in master? Date: Fri, 04 Sep 2015 18:53:44 +0000 Message-ID: References: <83fv2v9y9z.fsf@gnu.org> <57355235-9af7-49fb-81b5-93182cfc9d49@default> <83a8t39x3t.fsf@gnu.org> <83zj128slp.fsf@gnu.org> <87k2s6o7qh.fsf@igel.home> <83wpw68j2n.fsf@gnu.org> <871teenysf.fsf@igel.home> <83r3me8ho3.fsf@gnu.org> <20150904133439.GB2991@acm.fritz.box> <83lhcm83vl.fsf@gnu.org> <87fv2ut5k4.fsf@fencepost.gnu.org> <83k2s682el.fsf@gnu.org> <877fo6t4f9.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1dfc0d6e99f051ef06b63 X-Trace: ger.gmane.org 1441392876 17559 80.91.229.3 (4 Sep 2015 18:54:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2015 18:54:36 +0000 (UTC) Cc: bruce.connor.am@gmail.com, emacs-devel@gnu.org, schwab@linux-m68k.org, monnier@iro.umontreal.ca, dgutov@yandex.ru, acm@muc.de, drew.adams@oracle.com To: David Kastrup , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 04 20:54:34 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZXw7u-0001Zk-1z for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2015 20:54:18 +0200 Original-Received: from localhost ([::1]:34428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXw7t-0006HX-JJ for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2015 14:54:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXw7c-0006Df-1j for emacs-devel@gnu.org; Fri, 04 Sep 2015 14:54:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXw7a-0006Ml-Ml for emacs-devel@gnu.org; Fri, 04 Sep 2015 14:53:59 -0400 Original-Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:35511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXw7W-0006Ko-9k; Fri, 04 Sep 2015 14:53:54 -0400 Original-Received: by obuk4 with SMTP id k4so24058606obu.2; Fri, 04 Sep 2015 11:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=RFGd0xhM7zZZF62HjpVtydyYgjQJYPDdbV9/hHweqOo=; b=hPkDDotfEUJ2hOlja/xCM6kNJC8kGjeo9vOg70PjrGfIX4xKLHBFSQRswmhu1gZ5q9 A88IfGeYPHUkBlDBrgtryQUuX6ulgMwn7Xb+mvNpo2f8+Nw1kxtdfFzTniK8uiF4FZXY 0rDcPigPqxpOK6pWm/Gxl5JM3opaDCwlJnW9zHakUAyXcrzwzxYkVC4T92SbAS/bjY5t IX/LoPFuyzKpBxMYwQpD3W2XOTdh97mihetdOMTftKQbFirbCTnzank/dYjbzFFIlTBa 9zz5V2fzxyeUt8qml1oI1QwF4uewbFeKtuPe34/wisnTKgzwSdajNaB0X3KW33JqXMtc zyQQ== X-Received: by 10.182.240.135 with SMTP id wa7mr4734383obc.63.1441392833782; Fri, 04 Sep 2015 11:53:53 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189615 Archived-At: --001a11c1dfc0d6e99f051ef06b63 Content-Type: text/plain; charset=UTF-8 Of course I forgot to mention that (message "y/n") is supposed to be the traditional y-or-n-p implementation and (message "yes/no") is supposed to be the traditional yes-or-no-p implementation. On Fri, Sep 4, 2015 at 2:52 PM Kaushal Modi wrote: > @Eli, @Drew > > Would this psuedocode work? > > (progn > ;; Possible values: nil, 'quick, 'verbose > ;; (defconst yes-or-no-option nil) > ;; (defconst yes-or-no-option 'quick) > (defconst yes-or-no-option 'verbose) > ;; If nil, yes-or-no-p and y-or-n-p will work their traditional ways > ;; If 'quick , both yes-or-no-p and y-or-n-p will work like y-or-n-p > ;; If 'verbose , both yes-or-no-p and y-or-n-p will work like yes-or-no-p > > ;; yes-or-no-p now implemented in elisp instead of C > (defun yes-or-no-p (prompt) > (if (eq yes-or-no-option 'quick) > (message "y/n") > (message "yes/no"))) > > ;; y-or-n-p redefined > (defun y-or-n-p (prompt) > (let* ((orig--yes-or-no-option yes-or-no-option) > (yes-or-no-option (if (eq orig--yes-or-no-option 'verbose) > 'verbose > 'quick))) > (yes-or-no-p prompt))) > > (message "yes-or-no-p:") > (yes-or-no-p "Q? ") > (message "y-or-n-p:") > (y-or-n-p "Q? ") > nil) > > On Fri, Sep 4, 2015 at 2:50 PM David Kastrup wrote: > >> Eli Zaretskii writes: >> >> >> From: David Kastrup >> >> Cc: Alan Mackenzie , kaushal.modi@gmail.com, >> >> bruce.connor.am@gmail.com, emacs-devel@gnu.org, >> >> schwab@linux-m68k.org, monnier@iro.umontreal.ca, dgutov@yandex.ru, >> >> drew.adams@oracle.com >> >> Date: Fri, 04 Sep 2015 20:14:51 +0200 >> >> >> >> Eli Zaretskii writes: >> >> >> >> > The intent is to provide a predicate defcustom that allows to cause >> >> > yes-or-no-p behave like y-or-n-p. y-or-n-p will always behave as it >> >> > does, and I didn't intend to change that, as I don't see the use case >> >> > for that. >> >> >> >> Reliable translation into selection boxes when feeding emacs -batch >> from >> >> a script? >> > >> > y-or-n-p already does TRT in that case (no dialog boxes in -batch). >> >> Feeding emacs -batch _from_ a script. Meaning the script supplies "yes" >> and "no". >> >> >> Predictable behavior when navigating Emacs by voice? >> > >> > I don't see the relevance, please elaborate. >> >> Same as above. External input translated into a source for consumption >> by Emacs. >> >> >> Some people may prefer saying "yes" to saying "why". >> > >> > Likewise. >> >> "why" is phonetically the same as "y". Which means that it's likely >> harder to generate just "y" from voice than "yes". >> >> -- >> David Kastrup >> > --001a11c1dfc0d6e99f051ef06b63 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Of course I forgot to mention that (message "y/n"= ;) is supposed to be the traditional y-or-n-p implementation and (message &= quot;yes/no") is supposed to be the traditional yes-or-no-p implementa= tion.

On Fri, Sep 4, 2= 015 at 2:52 PM Kaushal Modi <k= aushal.modi@gmail.com> wrote:
@Eli, @Drew

Would this psuedocode wor= k?

(progn
=C2=A0 ;; Possible values= : nil, 'quick, 'verbose
=C2=A0 ;; (defconst yes-or-no-opt= ion nil)=C2=A0
=C2=A0 ;; (defconst yes-or-no-option 'quick)= =C2=A0
=C2=A0 (defconst yes-or-no-option 'verbose)=C2=A0
=C2=A0 ;; If nil, yes-or-no-p and y-or-n-p will work their traditiona= l ways
=C2=A0 ;; If 'quick , both yes-or-no-p and y-or-n-p wi= ll work like y-or-n-p
=C2=A0 ;; If 'verbose , both yes-or-no-= p and y-or-n-p will work like yes-or-no-p

=C2=A0 ;; yes-or-no-p now implemented in elisp in= stead of C
=C2=A0 (defun yes-or-no-p (prompt)
=C2=A0 =C2=A0 (if (eq yes-or-no-option 'quick)=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "y/n")
= =C2=A0 =C2=A0 =C2=A0 (message "yes/no")))

=C2=A0 ;; y-or-n-p redefined
= =C2=A0 (defun y-or-n-p (prompt)
=C2=A0 =C2=A0 (let* ((orig--yes-or-no-option yes-or-no-option)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(yes-or-no-option (if (eq orig--ye= s-or-no-option 'verbose)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0'verbose
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'q= uick)))
=C2=A0 =C2=A0 =C2=A0 (yes-or-no-p prompt)))
=C2=A0 (message "yes-or-no-p:")
=C2=A0 (yes= -or-no-p "Q? ")
=C2=A0 (message "y-or-n-p:")<= /div>
=C2=A0 (y-or-n-p "Q? ")
=C2=A0 nil)

On Fri, Sep 4, 2015= at 2:50 PM David Kastrup <dak@gnu.org> wrote:
Eli = Zaretskii <eliz@gnu.or= g> writes:

>> From: David Kastrup <dak@gnu.org>
>> Cc: Alan Mackenzie <acm@muc.de>, kaushal.modi@gmail.com,
>> bru= ce.connor.am@gmail.com, emacs-devel@gnu.org,
>> schwab@= linux-m68k.org, monnier@iro.umontreal.ca, dgutov@yandex.ru,
>> drew.ad= ams@oracle.com
>> Date: Fri, 04 Sep 2015 20:14:51 +0200
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > The intent is to provide a predicate defcustom that allows to= cause
>> > yes-or-no-p behave like y-or-n-p.=C2=A0 y-or-n-p will always = behave as it
>> > does, and I didn't intend to change that, as I don't = see the use case
>> > for that.
>>
>> Reliable translation into selection boxes when feeding emacs -batc= h from
>> a script?
>
> y-or-n-p already does TRT in that case (no dialog boxes in -batch).
Feeding emacs -batch _from_ a script.=C2=A0 Meaning the script supplies &qu= ot;yes"
and "no".

>> Predictable behavior when navigating Emacs by voice?
>
> I don't see the relevance, please elaborate.

Same as above.=C2=A0 External input translated into a source for consumptio= n
by Emacs.

>> Some people may prefer saying "yes" to saying "why&= quot;.
>
> Likewise.

"why" is phonetically the same as "y".=C2=A0 Which mean= s that it's likely
harder to generate just "y" from voice than "yes".

--
David Kastrup
--001a11c1dfc0d6e99f051ef06b63--