GNU bug report logs - #62027
Subject: 29.0.60; Breaking change in forward-sentence/backward-sentence

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> runbox.com>

Date: Tue, 7 Mar 2023 07:33:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.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 62027 in the body.
You can then email your comments to 62027 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#62027; Package emacs. (Tue, 07 Mar 2023 07:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simen Heggestøyl <simenheg <at> runbox.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 07 Mar 2023 07:33:02 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> runbox.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 08:31:49 +0100
Hi.

Commit 460d5fd971489ba7b573d71a94cdaac2f9f1a767 introduced a new
function `count-sentences', which is nice, but it also silently changed
the return value of `forward-sentence' (and thus also
`backward-sentence') from returning the new value of point to returning
t/nil based on whether point moved or not.

I just discovered this because it caused one of my packages to break,
since it relies on the previous style return values from
`forward-sentence'/`backward-sentence'. It would be easy enough fix on
my part, but I'm wondering whether this change was intended, and if so,
whether it should be documented somewhere so package authors can adapt
more easily?

Or could perhaps the change in return values from
`forward-sentence'/`backward-sentence' be reverted to old behavior, and
the counting logic be left to `count-sentences' instead?

-- Simen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 09:36:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Simen Heggestøyl <simenheg <at> runbox.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 10:35:41 +0100
Simen Heggestøyl <simenheg <at> runbox.com> writes:

[...]

> Or could perhaps the change in return values from
> `forward-sentence'/`backward-sentence' be reverted to old behavior, and
> the counting logic be left to `count-sentences' instead?

Hi Simen,

Yes maybe I could change `count-sentences' a bit to do this.  What
others think of such a change?
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 11:04:02 GMT) Full text and rfc822 format available.

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

From: Daniel Martín <mardani29 <at> yahoo.es>
To: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Simen Heggestøyl <simenheg <at> runbox.com>,
 62027 <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 12:03:45 +0100
Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Simen Heggestøyl <simenheg <at> runbox.com> writes:
>
> [...]
>
>> Or could perhaps the change in return values from
>> `forward-sentence'/`backward-sentence' be reverted to old behavior, and
>> the counting logic be left to `count-sentences' instead?
>
> Hi Simen,
>
> Yes maybe I could change `count-sentences' a bit to do this.  What
> others think of such a change?

I'm all for reverting to the traditional return values of the sentence
commands, specially if they don't complicate the new command much.  The
return value was not documented, but Hyrum's Law
(https://www.hyrumslaw.com/) tells us that there is an unknown amount of
code out there that depends on the traditional return value, anyway.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 11:04:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 13:08:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: simenheg <at> runbox.com, manuel <at> ledu-giraud.fr, 62027 <at> debbugs.gnu.org
Subject: Re: bug#62027: Subject: 29.0.60;
 Breaking change in forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 15:07:24 +0200
> Cc: simenheg <at> runbox.com, manuel <at> ledu-giraud.fr
> Date: Tue, 07 Mar 2023 12:03:45 +0100
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
> 
> > Simen Heggestøyl <simenheg <at> runbox.com> writes:
> >
> > [...]
> >
> >> Or could perhaps the change in return values from
> >> `forward-sentence'/`backward-sentence' be reverted to old behavior, and
> >> the counting logic be left to `count-sentences' instead?
> >
> > Hi Simen,
> >
> > Yes maybe I could change `count-sentences' a bit to do this.  What
> > others think of such a change?
> 
> I'm all for reverting to the traditional return values of the sentence
> commands, specially if they don't complicate the new command much.  The
> return value was not documented, but Hyrum's Law
> (https://www.hyrumslaw.com/) tells us that there is an unknown amount of
> code out there that depends on the traditional return value, anyway.

Agreed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 16:08:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: simenheg <at> runbox.com, 62027 <at> debbugs.gnu.org,
 Daniel Martín <mardani29 <at> yahoo.es>
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 17:07:14 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

>> I'm all for reverting to the traditional return values of the sentence
>> commands, specially if they don't complicate the new command much.  The
>> return value was not documented, but Hyrum's Law
>> (https://www.hyrumslaw.com/) tells us that there is an unknown amount of
>> code out there that depends on the traditional return value, anyway.
>
> Agreed.

Ok.  I've tried to fix this.  I've done some testing, it works for me™.
If it is ok, I think it should go in emacs-29 (if this is still
possible).
[0001-Revert-forward-sentence-default-function-to-return-t.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
-- 
Manuel Giraud

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 16:19:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: simenheg <at> runbox.com, 62027 <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 18:17:56 +0200
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: Daniel Martín <mardani29 <at> yahoo.es>,
>   62027 <at> debbugs.gnu.org,
>   simenheg <at> runbox.com
> Date: Tue, 07 Mar 2023 17:07:14 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> [...]
> 
> >> I'm all for reverting to the traditional return values of the sentence
> >> commands, specially if they don't complicate the new command much.  The
> >> return value was not documented, but Hyrum's Law
> >> (https://www.hyrumslaw.com/) tells us that there is an unknown amount of
> >> code out there that depends on the traditional return value, anyway.
> >
> > Agreed.
> 
> Ok.  I've tried to fix this.  I've done some testing, it works for me™.
> If it is ok, I think it should go in emacs-29 (if this is still
> possible).

Yes, please.  This command is new in Emacs 29, so it needs to be
corrected there.

> Subject: [PATCH] Revert 'forward-sentence-default-function' to return the
>  point
> 
> * lisp/textmodes/paragraphs.el
> (forward-sentence-default-function): Revert to return the point
> position.
> (count-sentences): Adapt to this change.

Don't forget to mention the bug number in the commit log message when
you install this.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 16:43:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: simenheg <at> runbox.com, 62027 <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 17:42:46 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

> Don't forget to mention the bug number in the commit log message when
> you install this.

I can add the bug number if you want but I cannot install on Emacs
repository.  Could you do that for me?
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 17:20:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: simenheg <at> runbox.com, 62027 <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 19:19:41 +0200
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: mardani29 <at> yahoo.es,  62027 <at> debbugs.gnu.org,  simenheg <at> runbox.com
> Date: Tue, 07 Mar 2023 17:42:46 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> [...]
> 
> > Don't forget to mention the bug number in the commit log message when
> > you install this.
> 
> I can add the bug number if you want but I cannot install on Emacs
> repository.  Could you do that for me?

I tried, but it doesn't apply.  Did you produce the patch from the
emacs-29 branch or from some other branch?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Tue, 07 Mar 2023 19:08:01 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: simenheg <at> runbox.com, 62027 <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 20:07:44 +0100
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

> I tried, but it doesn't apply.  Did you produce the patch from the
> emacs-29 branch or from some other branch?

Sorry, I produced it on master.  Here is the one for emacs-29.  Will
this appear on master at a later time?
-- 
Manuel Giraud
[0001-Revert-forward-sentence-default-function-to-return-t.patch (text/x-patch, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 07 Mar 2023 19:33:01 GMT) Full text and rfc822 format available.

Notification sent to Simen Heggestøyl <simenheg <at> runbox.com>:
bug acknowledged by developer. (Tue, 07 Mar 2023 19:33:01 GMT) Full text and rfc822 format available.

Message #37 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: simenheg <at> runbox.com, 62027-done <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Tue, 07 Mar 2023 21:32:32 +0200
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: mardani29 <at> yahoo.es,  62027 <at> debbugs.gnu.org,  simenheg <at> runbox.com
> Date: Tue, 07 Mar 2023 20:07:44 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> [...]
> 
> > I tried, but it doesn't apply.  Did you produce the patch from the
> > emacs-29 branch or from some other branch?
> 
> Sorry, I produced it on master.  Here is the one for emacs-29.

Thanks, installed.

> Will this appear on master at a later time?

Yes, in a day or two.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 06:51:02 GMT) Full text and rfc822 format available.

Message #40 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Simen Heggestøyl <simenheg <at> runbox.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62027-done <at> debbugs.gnu.org, Manuel Giraud <manuel <at> ledu-giraud.fr>,
 mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 08 Mar 2023 07:50:16 +0100
Thanks for the quick fix!

Should perhaps the return values of
`forward-sentence'/`backward-sentence' be documented to prevent this
from happening again?

-- Simen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 08:39:02 GMT) Full text and rfc822 format available.

Message #43 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Simen Heggestøyl <simenheg <at> runbox.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 62027-done <at> debbugs.gnu.org,
 mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 08 Mar 2023 09:38:03 +0100
Simen Heggestøyl <simenheg <at> runbox.com> writes:

> Thanks for the quick fix!
>
> Should perhaps the return values of
> `forward-sentence'/`backward-sentence' be documented to prevent this
> from happening again?

Why not: Hyrum's law might have won here.  But OTOH in master,
'forward-sentence' is a now call to 'forward-sentence-function' that
could be changed by the user.  Maybe should we document
'forward-sentence-default-function'?
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 15:54:01 GMT) Full text and rfc822 format available.

Message #46 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>,
 Simen Heggestøyl <simenheg <at> runbox.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "62027-done <at> debbugs.gnu.org" <62027-done <at> debbugs.gnu.org>,
 "mardani29 <at> yahoo.es" <mardani29 <at> yahoo.es>
Subject: RE: [External] : bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 8 Mar 2023 15:52:51 +0000
> > Should perhaps the return values of
> > `forward-sentence'/`backward-sentence' be documented
> > to prevent this from happening again?
> 
> Why not: Hyrum's law might have won here.  But OTOH in master,
> 'forward-sentence' is a now call to 'forward-sentence-function' that
> could be changed by the user.  Maybe should we document
> 'forward-sentence-default-function'?

Yes, but _both_ should mention the return value.
And not just "to prevent this from happening again."
Documenting this helps users use the functions.

For `forward-sentence' the doc should say that the
value of var `forward-sentence-default-function'
is called, and it returns what that function returns,
and _by default_ that is the new position (point).

Functions that have useful return values should be
documented to mention what the return value is.


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 16:52:02 GMT) Full text and rfc822 format available.

Message #49 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: simenheg <at> runbox.com, 62027-done <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 08 Mar 2023 18:51:35 +0200
> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  mardani29 <at> yahoo.es,
>   62027-done <at> debbugs.gnu.org
> Date: Wed, 08 Mar 2023 09:38:03 +0100
> 
> Simen Heggestøyl <simenheg <at> runbox.com> writes:
> 
> > Thanks for the quick fix!
> >
> > Should perhaps the return values of
> > `forward-sentence'/`backward-sentence' be documented to prevent this
> > from happening again?
> 
> Why not: Hyrum's law might have won here.  But OTOH in master,
> 'forward-sentence' is a now call to 'forward-sentence-function' that
> could be changed by the user.  Maybe should we document
> 'forward-sentence-default-function'?

I see no reason to document that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 16:53:02 GMT) Full text and rfc822 format available.

Message #52 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: simenheg <at> runbox.com, 62027-done <at> debbugs.gnu.org, manuel <at> ledu-giraud.fr,
 mardani29 <at> yahoo.es
Subject: Re: [External] : bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 08 Mar 2023 18:52:36 +0200
> From: Drew Adams <drew.adams <at> oracle.com>
> CC: Eli Zaretskii <eliz <at> gnu.org>,
>         "62027-done <at> debbugs.gnu.org"
> 	<62027-done <at> debbugs.gnu.org>,
>         "mardani29 <at> yahoo.es" <mardani29 <at> yahoo.es>
> Date: Wed, 8 Mar 2023 15:52:51 +0000
> 
> > > Should perhaps the return values of
> > > `forward-sentence'/`backward-sentence' be documented
> > > to prevent this from happening again?
> > 
> > Why not: Hyrum's law might have won here.  But OTOH in master,
> > 'forward-sentence' is a now call to 'forward-sentence-function' that
> > could be changed by the user.  Maybe should we document
> > 'forward-sentence-default-function'?
> 
> Yes, but _both_ should mention the return value.
> And not just "to prevent this from happening again."
> Documenting this helps users use the functions.

Not when the value is a simple consequence of the implementation, no.

forward-sentence does its job by side effect, not by the value it
returns.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 17:53:01 GMT) Full text and rfc822 format available.

Message #55 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "simenheg <at> runbox.com" <simenheg <at> runbox.com>,
 "62027-done <at> debbugs.gnu.org" <62027-done <at> debbugs.gnu.org>,
 "manuel <at> ledu-giraud.fr" <manuel <at> ledu-giraud.fr>,
 "mardani29 <at> yahoo.es" <mardani29 <at> yahoo.es>
Subject: RE: [External] : bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 8 Mar 2023 17:52:54 +0000
> > > > Should perhaps the return values of
> > > > `forward-sentence'/`backward-sentence' be documented
> > > > to prevent this from happening again?
> > >
> > > Why not: Hyrum's law might have won here.  But OTOH in master,
> > > 'forward-sentence' is a now call to 'forward-sentence-function' that
> > > could be changed by the user.  Maybe should we document
> > > 'forward-sentence-default-function'?
> >
> > Yes, but _both_ should mention the return value.
> > And not just "to prevent this from happening again."
> > Documenting this helps users use the functions.
> 
> Not when the value is a simple consequence
> of the implementation, no.

Are you suggesting that to discover that
the position is returned users need to check
the implementation to see what's returned?

There are plenty of movement functions that
don't return point, even though it's not
obvious that their implementation wouldn't
return point.

How would you guess that `next-line' doesn't
return point, without checking its
implementation?  It seems to go out of its
way to return nil (not point), but it's not
obvious (to me) why that is.

More typically we return nil when a non-nil
value indicates something particular - but
not here.  Or we do so when we specifically,
i.e., for some reason, don't want users to
depend on any particular return value.

Not to mention that to know whether returning
point is "a simple consequence of the
implementation" isn't possible for a command
implemented in C, unless you happen to have
the C source code.

> forward-sentence does its job by side effect,
> not by the value it returns.

If you define "its job" that narrowly, yes.

But then why does it return (point)?  A (happy)
accident/coincidence or design/intended?

In any case, even if you define its job as only
moving, and not also as returning point, that
doesn't prevent it being useful that it returns
the position value.  It's useful to allow/use
code such as this:

(act-on-region some-position
               (forward-sentence N))

rather than

(act-on-region some-position
               (progn (forward-sentence N)
                      (point)))

For setq you could define "its job" as just
changing variable values.  But we return the
value.  Why do we?  Because that's useful.

I don't know why Emacs wouldn't want to let
users know about the useful return value of
a function such as `forward-sentence'.

(By "let users know" I mean help commands,
not just by providing the source code.)

And yes, it wouldn't hurt if _more_ motion
functions (including commands) returned
point. Some do (e.g. `move-beginning-of-line').
Some don't (e.g. `end-of-line', `forward-char').
Probably most don't.

And yes, of course there are motion functions
(e.g. `forward-line') that return a value
other than point - a value that's otherwise
useful.

The point isn't that motion functions should
always return point.  The point is that unless
there's a good reason not to return a useful
value, it's helpful to return a useful value -
and for movement, point can be useful to return.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 19:47:02 GMT) Full text and rfc822 format available.

Message #58 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: simenheg <at> runbox.com, 62027-done <at> debbugs.gnu.org, manuel <at> ledu-giraud.fr,
 mardani29 <at> yahoo.es
Subject: Re: [External] : bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 08 Mar 2023 21:46:24 +0200
> From: Drew Adams <drew.adams <at> oracle.com>
> CC: "manuel <at> ledu-giraud.fr" <manuel <at> ledu-giraud.fr>,
>         "simenheg <at> runbox.com"
> 	<simenheg <at> runbox.com>,
>         "62027-done <at> debbugs.gnu.org"
> 	<62027-done <at> debbugs.gnu.org>,
>         "mardani29 <at> yahoo.es" <mardani29 <at> yahoo.es>
> Date: Wed, 8 Mar 2023 17:52:54 +0000
> 
> > > Yes, but _both_ should mention the return value.
> > > And not just "to prevent this from happening again."
> > > Documenting this helps users use the functions.
> > 
> > Not when the value is a simple consequence
> > of the implementation, no.
> 
> Are you suggesting that to discover that
> the position is returned users need to check
> the implementation to see what's returned?

No.

And sorry, I cannot afford reading all that you wrote in response to
my 2 sentences.  It's too much.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62027; Package emacs. (Wed, 08 Mar 2023 21:03:02 GMT) Full text and rfc822 format available.

Message #61 received at 62027-done <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: simenheg <at> runbox.com, 62027-done <at> debbugs.gnu.org, mardani29 <at> yahoo.es
Subject: Re: bug#62027: Subject: 29.0.60; Breaking change in
 forward-sentence/backward-sentence
Date: Wed, 08 Mar 2023 22:02:08 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

>> Why not: Hyrum's law might have won here.  But OTOH in master,
>> 'forward-sentence' is a now call to 'forward-sentence-function' that
>> could be changed by the user.  Maybe should we document
>> 'forward-sentence-default-function'?
>
> I see no reason to document that.

Fine by me.
-- 
Manuel Giraud




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 06 Apr 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 357 days ago.

Previous Next


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