GNU bug report logs - #27979
tab completion for "(yes or no)?"

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Sun, 6 Aug 2017 01:09:02 UTC

Severity: wishlist

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27979 in the body.
You can then email your comments to 27979 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 01:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 06 Aug 2017 01:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: tab completion for "(yes or no)?"
Date: Sun, 06 Aug 2017 08:33:30 +0800
You know those programs that ask you "(yes or no)?"
Well wouldn't it be great if one could hit y<TAB> and then it would
become "yes" etc.

Ah, yes-or-no-p is a built-in function in ‘C source code’.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 07:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 27979 <at> debbugs.gnu.org
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 06 Aug 2017 15:59:33 +0900
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> You know those programs that ask you "(yes or no)?"
> Well wouldn't it be great if one could hit y<TAB> and then it would
> become "yes" etc.
>
> Ah, yes-or-no-p is a built-in function in ‘C source code’.
IMO, Emacs prefers `yes-or-no-p' for dangerous actions, and it
uses `y-or-n-p' for safe ones.  I think this is good, to protect
beginners from lost important data; offering TAB completion would
somehow contradict this idiom.

Some experts have in their Emacs init file:
(fset 'yes-or-no-p 'y-or-n-p)

;; So that they will be prompted with (y or n).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 12:53:01 GMT) Full text and rfc822 format available.

Message #11 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 06 Aug 2017 20:52:07 +0800
>>>>> "TC" == Tino Calancha <tino.calancha <at> gmail.com> writes:
TC> offering TAB completion would somehow contradict this idiom.

Well I discovered for a second and subsequent yes, one can just hit the up arrow.

(But I hope that is not now going to be removed too, now that I revealed it.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 13:03:02 GMT) Full text and rfc822 format available.

Message #14 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 27979 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 6 Aug 2017 22:02:39 +0900 (JST)
[Message part 1 (text/plain, inline)]

On Sun, 6 Aug 2017, 積丹尼 Dan Jacobson wrote:

>>>>>> "TC" == Tino Calancha <tino.calancha <at> gmail.com> writes:
> TC> offering TAB completion would somehow contradict this idiom.
>
> Well I discovered for a second and subsequent yes, one can just hit the up arrow.
What?? Oh noo!
> (But I hope that is not now going to be removed too, now that I revealed it.)
You should keep your secrets better :-).  I already canceled the auto 
completion in the recursive deletion or dirs: now the full word is 
required.  I must thank your this report, it opened my eyes about my 
previous mistake ;-)

I really prefer that users input the full word when they are about to
run such kind of commands: commands that might destroy months-years of 
someones work.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 14:00:02 GMT) Full text and rfc822 format available.

Message #17 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 6 Aug 2017 22:59:09 +0900 (JST)
[Message part 1 (text/plain, inline)]

On Sun, 6 Aug 2017, Tino Calancha wrote:

>
>
> On Sun, 6 Aug 2017, 積丹尼 Dan Jacobson wrote:
>
>>>>>>> "TC" == Tino Calancha <tino.calancha <at> gmail.com> writes:
>> TC> offering TAB completion would somehow contradict this idiom.
>> 
>> Well I discovered for a second and subsequent yes, one can just hit the up 
>> arrow.
> What?? Oh noo!
>> (But I hope that is not now going to be removed too, now that I revealed 
>> it.)
My comment above (What?? Oh noo!) was just a joke.  It's perfectly 
fine that you use the arrows to repeat a previous answer.  That must work 
in almost every situation.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 15:08:01 GMT) Full text and rfc822 format available.

Message #20 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 27979 <at> debbugs.gnu.org
Subject: RE: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 6 Aug 2017 08:07:33 -0700 (PDT)
> IMO, Emacs prefers `yes-or-no-p' for dangerous actions, and it
> uses `y-or-n-p' for safe ones.  I think this is good, to protect
> beginners from lost important data; offering TAB completion would
> somehow contradict this idiom.

+1
 
> Some experts have in their Emacs init file:
>   (fset 'yes-or-no-p 'y-or-n-p)
> So that they will be prompted with (y or n).

More newbies than experts, methinks. ;-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 15:21:01 GMT) Full text and rfc822 format available.

Message #23 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 27979 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: RE: bug#27979: tab completion for "(yes or no)?"
Date: Mon, 7 Aug 2017 00:20:33 +0900 (JST)

On Sun, 6 Aug 2017, Drew Adams wrote:

>> Some experts have in their Emacs init file:
>>   (fset 'yes-or-no-p 'y-or-n-p)
>> So that they will be prompted with (y or n).
>
> More newbies than experts, methinks. ;-)

I have:
(defalias 'yes-or-no-p 'y-or-n-p)

so i am neither expert nor beginner (an outsider or a secret
agent, maybe).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 15:47:02 GMT) Full text and rfc822 format available.

Message #26 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: RE: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 6 Aug 2017 08:46:14 -0700 (PDT)
> >> Some experts have in their Emacs init file:
> >>   (fset 'yes-or-no-p 'y-or-n-p)
> >> So that they will be prompted with (y or n).
> >
> > More newbies than experts, methinks. ;-)
> 
> I have: (defalias 'yes-or-no-p 'y-or-n-p)
> so i am neither expert nor beginner (an outsider
> or a secret agent, maybe).

Actually, my reply was partly to discourage a possible
misimpression that such an alias is a sign of expertise
or will likely increase expertise.  (Not that you
suggested any such thing.)

But mainly: even (some) experts can benefit from
having to type `yes', and few (I think) really gain
much by just hitting `y'.

It's a cost/benefit thing.  If you never hit `y'
accidentally or too quickly in a critical situation
then the gain of not typing `es' and not hitting `RET'
is maybe worth it (maybe not).  If you do ever make
such a mistake then the cost can be great.

Experts (however defined) generally have more pilot
hours, and so are more likely to have been through a
few such crises and perhaps learned from them to be
careful.

A newbie, whether driving a car or driving Emacs,
can, from lack of such unfortunate experiences,
sometimes be overconfident and think that some
things, like looking in the rear-view mirror or not
texting, are just an unnecessary bother - something
only "newbies" really need.  Having a few accidents
can do wonders for teaching the value of paying
attention.

Wrt driving, a recent US study pointed out that the
youngest drivers (e.g. 16 years old) are much more
careful than are those who are just a little bit
older (e.g. 17 years old) - much more likely to
drive slower, to pay attention to other cars, not
to text, etc.  IOW, a little experience/knowledge
can be a dangerous thing.

Telling new drivers that some "expert" drivers
never need to look in the rear-view mirror would
not be a great thing to do (IMO).  And I doubt
that it would be true that some expert drivers
never do look in the mirror.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 16:06:02 GMT) Full text and rfc822 format available.

Message #29 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 27979 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: RE: bug#27979: tab completion for "(yes or no)?"
Date: Mon, 7 Aug 2017 01:05:46 +0900 (JST)
[Message part 1 (text/plain, inline)]

On Sun, 6 Aug 2017, Drew Adams wrote:

>>>> Some experts have in their Emacs init file:
>>>>   (fset 'yes-or-no-p 'y-or-n-p)
>>>> So that they will be prompted with (y or n).
>>>
>>> More newbies than experts, methinks. ;-)
>>
>> I have: (defalias 'yes-or-no-p 'y-or-n-p)
>> so i am neither expert nor beginner (an outsider
>> or a secret agent, maybe).
>
> Actually, my reply was partly to discourage a possible
> misimpression that such an alias is a sign of expertise
> or will likely increase expertise.  (Not that you
> suggested any such thing.)
>
> But mainly: even (some) experts can benefit from
> having to type `yes', and few (I think) really gain
> much by just hitting `y'.
>
> It's a cost/benefit thing.  If you never hit `y'
> accidentally or too quickly in a critical situation
> then the gain of not typing `es' and not hitting `RET'
> is maybe worth it (maybe not).  If you do ever make
> such a mistake then the cost can be great.
>
> Experts (however defined) generally have more pilot
> hours, and so are more likely to have been through a
> few such crises and perhaps learned from them to be
> careful.
>
> A newbie, whether driving a car or driving Emacs,
> can, from lack of such unfortunate experiences,
> sometimes be overconfident and think that some
> things, like looking in the rear-view mirror or not
> texting, are just an unnecessary bother - something
> only "newbies" really need.  Having a few accidents
> can do wonders for teaching the value of paying
> attention.
>
> Wrt driving, a recent US study pointed out that the
> youngest drivers (e.g. 16 years old) are much more
> careful than are those who are just a little bit
> older (e.g. 17 years old) - much more likely to
> drive slower, to pay attention to other cars, not
> to text, etc.  IOW, a little experience/knowledge
> can be a dangerous thing.
>
> Telling new drivers that some "expert" drivers
> never need to look in the rear-view mirror would
> not be a great thing to do (IMO).  And I doubt
> that it would be true that some expert drivers
> never do look in the mirror.
That's the reason i didn't want to admit i am one of those guys
overwritting 'yes-or-no-p'.  I tried to kept secret.  I want to be 
pedagogical with this topic: i cannot say don't do this thing that i am
doing (maybe because i am not father yet...).  So, please Dan, don't
use it! Plese write 'yes' or 'no'.  It's for your safety.

Someone from my circle lost important deta doing 'rm -rf' without
too much care.  Yeah, we must never encourage such bad habits.  I agree
with you: to use such things, as 'rm -rf' or `y-or-no-p' as `yes-or-no-p'
a long way must be walked (usualy with mistakes too).

Now some optimistic comment: IIRC, Newton suffered a fire in his home 
destroying all his notes.  After that he rewrote everything from his head
and published 'Philosophiæ Naturalis Principia Mathematica'.  The most
important is that we don't delete our heads.

I suffered car accidents after i got confident enough.  Yes, too much 
confident might decrease natural instinct brakes.  It's also true
that after the accidents i became a better driver.  We learn everyday.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 16:16:02 GMT) Full text and rfc822 format available.

Message #32 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Mon, 07 Aug 2017 00:15:03 +0800
I just want TAB to act consistently.
I don't think TAB knows passwords, so don't worry about completing those.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 16:49:01 GMT) Full text and rfc822 format available.

Message #35 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: RE: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 6 Aug 2017 09:48:15 -0700 (PDT)
Here's a thought -

Whoever writes a function that prompts for confirmation
decides whether to use `yes-or-no-p' or `y-or-n-p'.
A general choice is made for all users, based on the
importance of the decision, consequences, etc. in that
context.

But not all users will agree with that choice, for that
particular function's prompting.

We could perhaps give users a way to say, "From now on,
for this particular prompting (i.e., in this particular
function/context), use `y-or-n-p', not `yes-or-no-p'.

That would be a bit like what we do for commands, such
as `narrow-to-region', that are disabled out of the box.
We give users a way to enable them one by one.

Dunno how hard it would be to implement this.  Perhaps
`yes-or-no-p' could be changed somehow to:

1. Accept a third input, such as `use-y-or-n-p-here',
   that would record the current context as one in which
   `yes-or-no-p' would just use `y-or-n-p'.

2. Recognize the calling context somehow, and substitute
   `y-or-n-p' if that context is recognized and if it
   has been recorded by the user as one where `y-or-n-p'
   should be used.

Dunno how hard that would be - in particular #2.  Or
whether it would be worth doing.  But I can see the
possibility of someone not wanting to do `yes-or-no-p'
in some particular contexts but also not wanting to
replace `yes-or-no-p' by `y-or-n-p' everywhere.

(Of course, such a user could always advise or redefine
the particular calling function, replacing `yes-or-no-p'
by `y-or-n-p'.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 16:51:01 GMT) Full text and rfc822 format available.

Message #38 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 06 Aug 2017 19:49:55 +0300
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Sun, 06 Aug 2017 15:59:33 +0900
> Cc: 27979 <at> debbugs.gnu.org
> 
> IMO, Emacs prefers `yes-or-no-p' for dangerous actions, and it
> uses `y-or-n-p' for safe ones.  I think this is good, to protect
> beginners from lost important data; offering TAB completion would
> somehow contradict this idiom.

Agreed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 17:00:02 GMT) Full text and rfc822 format available.

Message #41 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 27979 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Mon, 07 Aug 2017 00:58:59 +0800
>>>>> "DA" == Drew Adams <drew.adams <at> oracle.com> writes:
DA> We could perhaps give users a way to say, "From now on,
DA> for this particular prompting (i.e., in this particular

Well to be complete, you would also have to offer them "never even ask,
just do it."

Once they accidentally choose that it is only a matter of time before
they delete themselves off the face of the earth.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 17:09:01 GMT) Full text and rfc822 format available.

Message #44 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 27979 <at> debbugs.gnu.org, tino.calancha <at> gmail.com
Subject: Re: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 06 Aug 2017 20:08:02 +0300
> From: 積丹尼 Dan Jacobson
> 	<jidanni <at> jidanni.org>
> Date: Mon, 07 Aug 2017 00:15:03 +0800
> Cc: 27979 <at> debbugs.gnu.org
> 
> I just want TAB to act consistently.
> I don't think TAB knows passwords, so don't worry about completing those.

These questions require explicit user consent, so TAB-completion is
not appropriate in those cases, IMO.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27979; Package emacs. (Sun, 06 Aug 2017 20:35:02 GMT) Full text and rfc822 format available.

Message #47 received at 27979 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 27979 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: RE: bug#27979: tab completion for "(yes or no)?"
Date: Sun, 6 Aug 2017 13:34:18 -0700 (PDT)
[Message part 1 (text/plain, inline)]
> We could perhaps give users a way to say, "From now on,
> for this particular prompting (i.e., in this particular
> function/context), use `y-or-n-p', not `yes-or-no-p'.

Here's a rough bit along those lines (attached), to play with.
Just something quick & dirty, unfinished (doc etc.) and only
summarily tested.  (I did nothing with the code for dialog
boxes and `noninteractive'.)

What it does:

1. Add a CALLER optional arg to `yes-or-no-p' and `y-or-n-p'.
   It is the symbol for the function that is calling the
   confirmation-prompt function.  If CALLER is not present,
   the behavior is the same as now.

   If something like this were adopted then we would presumably
   add CALLER to calls of these functions.  For example, in the
   definition of `help-mode-revert-buffer' we would use this:
   (yes-or-no-p "Revert help buffer? " 'help-mode-revert-buffer)

2. For `yes-or-no-p', if CALLER is present then: 

   * If CALLER has non-nil property `use-y-or-n-p' then
     use `y-or-n-p' (in place of the rest of `yes-or-no-p').

   * Otherwise, `use-y-or-n-p' is a possible user input.
     If this is the input then `(put CALLER 'use-y-or-n-p t)'
     and prompt again, but with `y-or-n-p'.

3. For `y-or-n-p', if CALLER is present then:

   * Input of `e' (bound to `edit-replacement' in the keymap)
     does `(put CALLER 'use-y-or-n-p nil)', then prompts again,
     but with `yes-or-no-p'.

Let me know if you find a problem.  (BTW, why is `yes-or-no-p'
defined in C code?)
[throw-yes-no.el (application/octet-stream, attachment)]

Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 07 Aug 2017 21:18:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 27979 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 15 Jul 2019 18:20:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Aug 2019 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.