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:52:21 +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=001a113cef30f903fc051ef066da X-Trace: ger.gmane.org 1441392768 15765 80.91.229.3 (4 Sep 2015 18:52:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2015 18:52:48 +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:52:46 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 1ZXw6P-00006t-60 for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2015 20:52:45 +0200 Original-Received: from localhost ([::1]:34416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXw6O-0005F1-Kv for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2015 14:52:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXw6J-0005EW-SF for emacs-devel@gnu.org; Fri, 04 Sep 2015 14:52:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXw6I-0005lS-Df for emacs-devel@gnu.org; Fri, 04 Sep 2015 14:52:39 -0400 Original-Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:34835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXw6D-0005iA-8I; Fri, 04 Sep 2015 14:52:33 -0400 Original-Received: by oiww128 with SMTP id w128so17020335oiw.2; Fri, 04 Sep 2015 11:52:32 -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=lCisNEfKZ3F9uB7/T+2z+S33eePTTkyzpAw3lxT57VY=; b=xkiHupyedcgoowW/Y7uA/s8MySebLUd/dBdxE9M/Atjeo6/+pYIx56nsuV5Q89iRUD cyi7t2f7vMbFYZRWIJSEzMQJMoLLNGsnUd2XBhB1byVV/vtK6yca/F4kg+8CLVT6GPR1 NTuv7V2wJc8rh/r7Q1SsBS57x/urggAOgZC79863wu5TQCOfzZ6wuI8CUhlruJZYeGRK qQ+9rl9GcyYhU+GNDPE+RyYpTk12XpUFmNJbyNiWirJgDHGLezOnPXBPK91bEYQMxml0 tNUCqYymt2mqlbYYOOMOAFhdBs6fsSvkG6PkdFjqKa4DEdTRkXJu/0LzmTgRylQMEZQc 28oA== X-Received: by 10.202.182.214 with SMTP id g205mr4407867oif.85.1441392752130; Fri, 04 Sep 2015 11:52:32 -0700 (PDT) In-Reply-To: <877fo6t4f9.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::22a 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:189613 Archived-At: --001a113cef30f903fc051ef066da Content-Type: text/plain; charset=UTF-8 @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 > --001a113cef30f903fc051ef066da Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
@Eli, @Drew

Would this psuedocode work?=

(progn
=C2=A0 ;; Possible values: = nil, 'quick, 'verbose
=C2=A0 ;; (defconst yes-or-no-optio= n 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 traditional w= ays
=C2=A0 ;; If 'quick , both yes-or-no-p and y-or-n-p will = work like y-or-n-p
=C2=A0 ;; If 'verbose , both yes-or-no-p a= nd y-or-n-p will work like yes-or-no-p

=C2=A0 ;; y= es-or-no-p now implemented in elisp instead of C
=C2=A0 (defun ye= s-or-no-p (prompt)
=C2=A0 =C2=A0 (if (eq yes-or-no-option 'qu= ick)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "y/n")
<= div>=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)<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(yes-or-no-option (if (e= q orig--yes-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'quick)))
=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:")
=C2=A0 (y-or-n-p "Q? ")
=C2=A0 ni= l)

On Fri,= Sep 4, 2015 at 2:50 PM David Kastrup <da= k@gnu.org> wrote:
Eli Zare= tskii <eliz@gnu.org> 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
--001a113cef30f903fc051ef066da--