unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
       [not found] ` <20210916073853.B90BA20ABE@vcs0.savannah.gnu.org>
@ 2023-01-03 14:31   ` Robert Pluim
  2023-01-03 15:33     ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Pluim @ 2023-01-03 14:31 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Kangas

>>>>> On Thu, 16 Sep 2021 03:38:53 -0400 (EDT), stefankangas@gmail.com (Stefan Kangas) said:
    Stefan>     * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space
    Stefan>     is no longer needed; one is added or removed automatically.

Hi Stefan,

I just tested this on master, and I donʼt think this is qute accurate:

- `y-or-n-p' will append a space if there is one
- it wonʼt remove one
- `yes-or-no-p' never modifies the passed prompt

Robert
-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-03 14:31   ` master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed Robert Pluim
@ 2023-01-03 15:33     ` Stefan Kangas
  2023-01-03 15:59       ` Robert Pluim
  2023-01-04  8:43       ` Jean Louis
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Kangas @ 2023-01-03 15:33 UTC (permalink / raw)
  To: Robert Pluim, emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

>>>>>> On Thu, 16 Sep 2021 03:38:53 -0400 (EDT), stefankangas@gmail.com (Stefan Kangas) said:
>     Stefan>     * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space
>     Stefan>     is no longer needed; one is added or removed automatically.
>
> I just tested this on master, and I donʼt think this is qute accurate:

Hmm, I guess you're right.  Not sure what I was smoking:

> - `y-or-n-p' will append a space if there is one
> - it wonʼt remove one

    (y-or-n-p "foo")     => prompt is "foo (y or n) "
    (y-or-n-p "foo ")    => prompt is "foo (y or n) "

> - `yes-or-no-p' never modifies the passed prompt

    (yes-or-no-p "foo")  => prompt is "foo(yes or no) "
    (yes-or-no-p "foo ") => prompt is "foo (yes or no) "

I think the best fix here is to change `yes-or-no-p' to work the same
way as `y-or-n-p'.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-03 15:33     ` Stefan Kangas
@ 2023-01-03 15:59       ` Robert Pluim
  2023-01-04  8:43       ` Jean Louis
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2023-01-03 15:59 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

>>>>> On Tue, 3 Jan 2023 15:33:21 +0000, Stefan Kangas <stefankangas@gmail.com> said:

    Stefan> Robert Pluim <rpluim@gmail.com> writes:
    >>>>>>> On Thu, 16 Sep 2021 03:38:53 -0400 (EDT), stefankangas@gmail.com (Stefan Kangas) said:
    Stefan> * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space
    Stefan> is no longer needed; one is added or removed automatically.
    >> 
    >> I just tested this on master, and I donʼt think this is qute accurate:

    Stefan> Hmm, I guess you're right.  Not sure what I was smoking:

    >> - `y-or-n-p' will append a space if there is one

*isnʼt* one, I meant. This stuff is hard :-)

    >> - it wonʼt remove one

    Stefan>     (y-or-n-p "foo")     => prompt is "foo (y or n) "
    Stefan>     (y-or-n-p "foo ")    => prompt is "foo (y or n) "

I was thinking (y-or-n-p "foo  ")    => prompt is "foo  (y or n)"

which we could consider fixing (but itʼs long-standing behaviour)

    >> - `yes-or-no-p' never modifies the passed prompt

    Stefan>     (yes-or-no-p "foo")  => prompt is "foo(yes or no) "
    Stefan>     (yes-or-no-p "foo ") => prompt is "foo (yes or no) "

    Stefan> I think the best fix here is to change `yes-or-no-p' to work the same
    Stefan> way as `y-or-n-p'.

ENOPATCH 😜

(and as someone pointed out elsewhere `y-or-n-p' and `yes-or-no-p'
could do with some refactoring.

Robert
-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-03 15:33     ` Stefan Kangas
  2023-01-03 15:59       ` Robert Pluim
@ 2023-01-04  8:43       ` Jean Louis
  2023-01-04 10:10         ` Robert Pluim
  1 sibling, 1 reply; 10+ messages in thread
From: Jean Louis @ 2023-01-04  8:43 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Robert Pluim, emacs-devel

* Stefan Kangas <stefankangas@gmail.com> [2023-01-03 18:35]:
> Robert Pluim <rpluim@gmail.com> writes:
> 
> >>>>>> On Thu, 16 Sep 2021 03:38:53 -0400 (EDT), stefankangas@gmail.com (Stefan Kangas) said:
> >     Stefan>     * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space
> >     Stefan>     is no longer needed; one is added or removed automatically.
> >
> > I just tested this on master, and I donʼt think this is qute accurate:
> 
> Hmm, I guess you're right.  Not sure what I was smoking:
> 
> > - `y-or-n-p' will append a space if there is one
> > - it wonʼt remove one
> 
>     (y-or-n-p "foo")     => prompt is "foo (y or n) "
>     (y-or-n-p "foo ")    => prompt is "foo (y or n) "
> 
> > - `yes-or-no-p' never modifies the passed prompt
> 
>     (yes-or-no-p "foo")  => prompt is "foo(yes or no) "
>     (yes-or-no-p "foo ") => prompt is "foo (yes or no) "
> 
> I think the best fix here is to change `yes-or-no-p' to work the same
> way as `y-or-n-p'.

At least one space shall be there, but please don't remove trailing
spaces, as that is users' choice, so that following unusual example
may work:

(y-or-n-p "                               Are you sure?             ")



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-04  8:43       ` Jean Louis
@ 2023-01-04 10:10         ` Robert Pluim
  2023-01-04 15:53           ` [External] : " Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Pluim @ 2023-01-04 10:10 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

>>>>> On Wed, 4 Jan 2023 11:43:41 +0300, Jean Louis <bugs@gnu.support> said:

    Jean> * Stefan Kangas <stefankangas@gmail.com> [2023-01-03 18:35]:
    >> Robert Pluim <rpluim@gmail.com> writes:
    >> 
    >> >>>>>> On Thu, 16 Sep 2021 03:38:53 -0400 (EDT), stefankangas@gmail.com (Stefan Kangas) said:
    >> >     Stefan>     * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space
    >> >     Stefan>     is no longer needed; one is added or removed automatically.
    >> >
    >> > I just tested this on master, and I donʼt think this is qute accurate:
    >> 
    >> Hmm, I guess you're right.  Not sure what I was smoking:
    >> 
    >> > - `y-or-n-p' will append a space if there is one
    >> > - it wonʼt remove one
    >> 
    >> (y-or-n-p "foo")     => prompt is "foo (y or n) "
    >> (y-or-n-p "foo ")    => prompt is "foo (y or n) "
    >> 
    >> > - `yes-or-no-p' never modifies the passed prompt
    >> 
    >> (yes-or-no-p "foo")  => prompt is "foo(yes or no) "
    >> (yes-or-no-p "foo ") => prompt is "foo (yes or no) "
    >> 
    >> I think the best fix here is to change `yes-or-no-p' to work the same
    >> way as `y-or-n-p'.

    Jean> At least one space shall be there, but please don't remove trailing
    Jean> spaces, as that is users' choice, so that following unusual example
    Jean> may work:

    Jean> (y-or-n-p "                               Are you sure?             ")

You mean 'yes-or-no-p', right? 😺

Thatʼs the historical behaviour, I donʼt see a strong case for
changing it (but `yes-or-no-p' should be fixed to add a space if there
isnʼt one).

Robert
-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [External] : Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-04 10:10         ` Robert Pluim
@ 2023-01-04 15:53           ` Drew Adams
  2023-01-04 16:07             ` Robert Pluim
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2023-01-04 15:53 UTC (permalink / raw)
  To: Robert Pluim, Stefan Kangas; +Cc: emacs-devel@gnu.org

> (but `yes-or-no-p' should be fixed to add a space if there
> isnʼt one).

I'm not following this thread, so apologies if
my comment is irrelevant or misguided.

I disagree that functions such as `yes-or-no-p'
should mess with the prompt.  If a user wants
a space after the colon, and the user forgets
to add one, that's on the user.

If a user wants NO space after the colon for
some reason, however misguided the author of
`yes-or-no-p' might think that choice is, it
should be respected - there's no reason _not_
to respect it.

`yes-or-no-p' and the like shouldn't try to
second-guess users.  Don't let it suffer from
"dwim" lameness, please.  It's up to users to
provide the prompt text they want - they have
tons of ways to do that, including `format'.

Pretty much all of the prompting functions
that append a space, or a colon plus a space,
are misguided.  OK, there's legacy, and we
accommodate that.  But let's please not ADD
to the problem by introducing more examples
of it.  Not willingly and knowingly, at any
rate.

Again, I'm not following this thread.  But
even the Subject line bit "trailing space is
no longer needed" makes me cringe, at least
in my ignorance of what "fix" is intended.

Lots of what exists might be considered "no
longer needed" by someone.  Whether users
already make use of it shouldn't be ignored.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [External] : Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-04 15:53           ` [External] : " Drew Adams
@ 2023-01-04 16:07             ` Robert Pluim
  2023-01-04 16:12               ` Drew Adams
  2023-01-04 17:31               ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Robert Pluim @ 2023-01-04 16:07 UTC (permalink / raw)
  To: Drew Adams; +Cc: Stefan Kangas, emacs-devel@gnu.org

>>>>> On Wed, 4 Jan 2023 15:53:59 +0000, Drew Adams <drew.adams@oracle.com> said:

    >> (but `yes-or-no-p' should be fixed to add a space if there
    >> isnʼt one).

    Drew> I'm not following this thread, so apologies if
    Drew> my comment is irrelevant or misguided.

If you were, your comments would have been shorter

- `y-or-n-p' has, since emacs 24.3 or so, appended a space to the prompt
if there wasnʼt one
- `yes-or-no-p' doesnʼt mess with the prompt

This discussion is about the documentation of those two facts, which
needs adjusting since itʼs currently incorrect. There was a suggestion
by me to maybe align `yes-or-no-p' behaviour (what you call "dwim") to
match `y-or-n-p', but since thatʼs 'legacy' I doubt itʼs going to be
done.

Robert
-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [External] : Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-04 16:07             ` Robert Pluim
@ 2023-01-04 16:12               ` Drew Adams
  2023-01-04 16:14                 ` Robert Pluim
  2023-01-04 17:31               ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Drew Adams @ 2023-01-04 16:12 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Stefan Kangas, emacs-devel@gnu.org

>     >> (but `yes-or-no-p' should be fixed to add a space if there
>     >> isnʼt one).
> 
>     Drew> I'm not following this thread, so apologies if
>     Drew> my comment is irrelevant or misguided.
> 
> If you were, your comments would have been shorter

If I were what?

> - `y-or-n-p' has, since emacs 24.3 or so, appended a space to the prompt
>   if there wasnʼt one
> - `yes-or-no-p' doesnʼt mess with the prompt
> 
> This discussion is about the documentation of those two facts, which
> needs adjusting since itʼs currently incorrect. 

Oh, it's the _doc_ that needs adjusting to those facts?
OK, then.  So no change in the _behavior_ is being
considered.

> There was a suggestion by me to maybe align `yes-or-no-p'
> behaviour (what you call "dwim") to match `y-or-n-p',
> but since thatʼs 'legacy' I doubt itʼs going to be done.

OK, so nothing is changing, apparently.  Sorry for the noise.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [External] : Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-04 16:12               ` Drew Adams
@ 2023-01-04 16:14                 ` Robert Pluim
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2023-01-04 16:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: Stefan Kangas, emacs-devel@gnu.org

>>>>> On Wed, 4 Jan 2023 16:12:23 +0000, Drew Adams <drew.adams@oracle.com> said:

    >> >> (but `yes-or-no-p' should be fixed to add a space if there
    >> >> isnʼt one).
    >> 
    Drew> I'm not following this thread, so apologies if
    Drew> my comment is irrelevant or misguided.
    >> 
    >> If you were, your comments would have been shorter

    Drew> If I were what?

following the thread

    >> - `y-or-n-p' has, since emacs 24.3 or so, appended a space to the prompt
    >> if there wasnʼt one
    >> - `yes-or-no-p' doesnʼt mess with the prompt
    >> 
    >> This discussion is about the documentation of those two facts, which
    >> needs adjusting since itʼs currently incorrect. 

    Drew> Oh, it's the _doc_ that needs adjusting to those facts?
    Drew> OK, then.  So no change in the _behavior_ is being
    Drew> considered.

Not seriously, no

    >> There was a suggestion by me to maybe align `yes-or-no-p'
    >> behaviour (what you call "dwim") to match `y-or-n-p',
    >> but since thatʼs 'legacy' I doubt itʼs going to be done.

    Drew> OK, so nothing is changing, apparently.  Sorry for the noise.

See, this is why you should follow the thread :-)

Robert
-- 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [External] : Re: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
  2023-01-04 16:07             ` Robert Pluim
  2023-01-04 16:12               ` Drew Adams
@ 2023-01-04 17:31               ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2023-01-04 17:31 UTC (permalink / raw)
  To: Robert Pluim; +Cc: drew.adams, stefankangas, emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Stefan Kangas <stefankangas@gmail.com>,  "emacs-devel@gnu.org"
>  <emacs-devel@gnu.org>
> Date: Wed, 04 Jan 2023 17:07:37 +0100
> 
> - `y-or-n-p' has, since emacs 24.3 or so, appended a space to the prompt
> if there wasnʼt one
> - `yes-or-no-p' doesnʼt mess with the prompt
> 
> This discussion is about the documentation of those two facts, which
> needs adjusting since itʼs currently incorrect. There was a suggestion
> by me to maybe align `yes-or-no-p' behaviour (what you call "dwim") to
> match `y-or-n-p', but since thatʼs 'legacy' I doubt itʼs going to be
> done.

I don't see any reasons whatsoever to mention this DWIM-ish behavior
in a doc string.  We made these functions behave like that because we
believe that would silently DTRT in every reasonable use case, so
unless someone complains about this behavior, and documenting it
somehow satisfies the complaint, we should not confuse Lisp
programmers with these details, about which they should not care.

So I've went ahead and removed this detail from the two doc string,
including the fact that y-or-n-p adds a space _before_ the
parentheses.  I hope this will put this thread to rest.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-04 17:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210916073852.6025.85941@vcs0.savannah.gnu.org>
     [not found] ` <20210916073853.B90BA20ABE@vcs0.savannah.gnu.org>
2023-01-03 14:31   ` master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed Robert Pluim
2023-01-03 15:33     ` Stefan Kangas
2023-01-03 15:59       ` Robert Pluim
2023-01-04  8:43       ` Jean Louis
2023-01-04 10:10         ` Robert Pluim
2023-01-04 15:53           ` [External] : " Drew Adams
2023-01-04 16:07             ` Robert Pluim
2023-01-04 16:12               ` Drew Adams
2023-01-04 16:14                 ` Robert Pluim
2023-01-04 17:31               ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).