emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yes-or-no-p prompt conditionally broken in master?


From: Kaushal Modi
Subject: Re: yes-or-no-p prompt conditionally broken in master?
Date: Fri, 04 Sep 2015 18:52:21 +0000

@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 <address@hidden> wrote:
Eli Zaretskii <address@hidden> writes:

>> From: David Kastrup <address@hidden>
>> Cc: Alan Mackenzie <address@hidden>, address@hidden,
>> address@hidden, address@hidden,
>> address@hidden, address@hidden, address@hidden,
>> address@hidden
>> Date: Fri, 04 Sep 2015 20:14:51 +0200
>>
>> Eli Zaretskii <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]