GNU bug report logs - #65414
save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil

Previous Next

Package: emacs;

Reported by: Joseph Turner <joseph <at> breatheoutbreathe.in>

Date: Mon, 21 Aug 2023 04:54:02 UTC

Severity: normal

Tags: patch

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 65414 in the body.
You can then email your comments to 65414 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#65414; Package emacs. (Mon, 21 Aug 2023 04:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joseph Turner <joseph <at> breatheoutbreathe.in>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 21 Aug 2023 04:54:02 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: bug-gnu-emacs <at> gnu.org
Cc: jonas <at> bernoul.li
Subject: save-some-buffers-functions are unexpectedly called when
 save-some-buffers pred is non-nil
Date: Sun, 20 Aug 2023 21:06:54 -0700
Functions which are added to save-some-buffers-functions are always
called when save-some-buffers runs, even when a PRED argument is
specified. This leads to unexpected behavior when PRED is intended to
limit saving buffers to a specific set of file buffers, as in Magit's
magit-save-repository-buffers function.

abbrev--possibly-save is added to save-some-buffers-functions by default
now, so whenever magit-save-repository-buffers runs, Emacs prompts to
save unsaved abbrevs (as well any other functions in the list).

I propose that we pass along the PRED argument of save-some-buffers to
each of save-some-buffers-functions, allowing them to determine what is
appropriate to do. Alternatively, we could pass along the return value
of files--buffers-needing-to-be-saved, which is a list of buffers.

Thoughts?

Joseph




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Mon, 21 Aug 2023 11:57:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Mon, 21 Aug 2023 14:56:59 +0300
> Cc: jonas <at> bernoul.li
> Date: Sun, 20 Aug 2023 21:06:54 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Functions which are added to save-some-buffers-functions are always
> called when save-some-buffers runs, even when a PRED argument is
> specified. This leads to unexpected behavior when PRED is intended to
> limit saving buffers to a specific set of file buffers, as in Magit's
> magit-save-repository-buffers function.
> 
> abbrev--possibly-save is added to save-some-buffers-functions by default
> now, so whenever magit-save-repository-buffers runs, Emacs prompts to
> save unsaved abbrevs (as well any other functions in the list).

Why is asking whether to save the abbrevs a problem in the case of
magit-save-repository-buffers?

And are you saying that before the change which added
save-some-buffers-functions, Emacs was not saving the abbrevs when
save-some-buffers was called?  If so, in what Emacs version was this
so?

> I propose that we pass along the PRED argument of save-some-buffers to
> each of save-some-buffers-functions, allowing them to determine what is
> appropriate to do. Alternatively, we could pass along the return value
> of files--buffers-needing-to-be-saved, which is a list of buffers.

We need a better understanding of the situation before we can discuss
solutions, so please fill-in the blanks outlined above.  (The solution
you propose is not very backward-compatible, so probably not
acceptable anyway, as Emacs 29 was already released with the current
code.  But let's defer this discussion until the issue is more clear.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Thu, 24 Aug 2023 00:22:02 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Wed, 23 Aug 2023 16:57:06 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

> Why is asking whether to save the abbrevs a problem in the case of
> magit-save-repository-buffers?

magit-save-repository-buffers docstring reads "Save file-visiting
buffers belonging to the current repository." IIUC, prompting to save
abbrevs here is an undesirable implementation side-effect.

Another example: hyperdrive.el adds to save-some-buffers-functions for
saving hyperdrive file buffers:

https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99

After this change, magit-save-repository-buffers now prompts to save
irrelevant hyperdrive file buffers. I would like some way to tell
hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
buffers from inside magit-save-repository-buffers.

> And are you saying that before the change which added
> save-some-buffers-functions, Emacs was not saving the abbrevs when
> save-some-buffers was called?  If so, in what Emacs version was this
> so?

The behavior of saving abbrevs when a PRED function is passed to
save-some-buffers has not changed in Emacs 29. I just think that there
may be room for improvement now that save-some-buffers-functions allows
any package to add to save-some-buffers-functions.

> We need a better understanding of the situation before we can discuss
> solutions, so please fill-in the blanks outlined above.

I hope the explanation above is clear. Sorry for starting off on the
wrong foot with an XY problem!

Thank you!

Joseph




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Thu, 24 Aug 2023 05:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Thu, 24 Aug 2023 08:16:26 +0300
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li
> Date: Wed, 23 Aug 2023 16:57:06 -0700
> 
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Why is asking whether to save the abbrevs a problem in the case of
> > magit-save-repository-buffers?
> 
> magit-save-repository-buffers docstring reads "Save file-visiting
> buffers belonging to the current repository." IIUC, prompting to save
> abbrevs here is an undesirable implementation side-effect.

Why is it undesirable?  save-some-buffers always saved abbrevs, didn't
it?  And it did so independently of PRED, right?  So how did this
problem suddenly started affecting Magit?

IOW, I still don't have a clear idea what caused this problem, if
(AFAIU) it is a problem that started happening recently.

> Another example: hyperdrive.el adds to save-some-buffers-functions for
> saving hyperdrive file buffers:
> 
> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99
> 
> After this change, magit-save-repository-buffers now prompts to save
> irrelevant hyperdrive file buffers. I would like some way to tell
> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
> buffers from inside magit-save-repository-buffers.

Why do you want to do that?  Whether or not to prompt the user abides
by the common protocol defined by save-some-buffers: if it's called
with the argument ARG non-nil (which should happen interactively when
the user invokes the command with a prefix argument), there's no
prompt, otherwise Emacs prompts.  Why magit-save-repository-buffers
wants to break this common protocol?

I feel that I'm still missing something important, which causes you to
want a different behavior from magit-save-repository-buffers.  For
starters, can you describe how magit-save-repository-buffers ends up
calling save-some-buffers-functions in enough detail for me to
understand why you think saving these buffers is deemed "undesirable"?

> > And are you saying that before the change which added
> > save-some-buffers-functions, Emacs was not saving the abbrevs when
> > save-some-buffers was called?  If so, in what Emacs version was this
> > so?
> 
> The behavior of saving abbrevs when a PRED function is passed to
> save-some-buffers has not changed in Emacs 29. I just think that there
> may be room for improvement now that save-some-buffers-functions allows
> any package to add to save-some-buffers-functions.

We could try thinking about some backward-compatible change to the
save-some-buffers-functions feature, but a better understanding of the
issue is still needed.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sat, 26 Aug 2023 06:51:02 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Fri, 25 Aug 2023 23:38:18 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
>> Cc: 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li
>> Date: Wed, 23 Aug 2023 16:57:06 -0700
>>
>> magit-save-repository-buffers docstring reads "Save file-visiting
>> buffers belonging to the current repository." IIUC, prompting to save
>> abbrevs here is an undesirable implementation side-effect.
>
> Why is it undesirable?  save-some-buffers always saved abbrevs, didn't
> it?  And it did so independently of PRED, right?  So how did this
> problem suddenly started affecting Magit?
>
> IOW, I still don't have a clear idea what caused this problem, if
> (AFAIU) it is a problem that started happening recently.

This problem is not new. However, now that save-some-buffers-functions
has been added, the problem goes beyond abbrevs.

>> Another example: hyperdrive.el adds to save-some-buffers-functions for
>> saving hyperdrive file buffers:
>>
>> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99
>>
>> After this change, magit-save-repository-buffers now prompts to save
>> irrelevant hyperdrive file buffers. I would like some way to tell
>> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
>> buffers from inside magit-save-repository-buffers.
>
> Why do you want to do that?  Whether or not to prompt the user abides
> by the common protocol defined by save-some-buffers: if it's called
> with the argument ARG non-nil (which should happen interactively when
> the user invokes the command with a prefix argument), there's no
> prompt, otherwise Emacs prompts.  Why magit-save-repository-buffers
> wants to break this common protocol?

I think magit-save-repository-buffers follows the common protocol
correctly.

> I feel that I'm still missing something important, which causes you to
> want a different behavior from magit-save-repository-buffers.  For
> starters, can you describe how magit-save-repository-buffers ends up
> calling save-some-buffers-functions in enough detail for me to
> understand why you think saving these buffers is deemed "undesirable"?

The issue is not that save-some-buffers prompts instead of saving
without questions.

What is undesirable to me is that save-some-buffers unconditionally
calls each one of save-some-buffers-functions, regardless of PRED. This
means that when save-some-buffers is used with the intention to save
only a handful of files (as with magit-save-repository-buffers),
save-some-buffers-functions are all called, even when irrelevant.

Thanks again for your patience :)

Joseph




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sat, 26 Aug 2023 07:27:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sat, 26 Aug 2023 10:26:30 +0300
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li
> Date: Fri, 25 Aug 2023 23:38:18 -0700
> 
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Why is it undesirable?  save-some-buffers always saved abbrevs, didn't
> > it?  And it did so independently of PRED, right?  So how did this
> > problem suddenly started affecting Magit?
> >
> > IOW, I still don't have a clear idea what caused this problem, if
> > (AFAIU) it is a problem that started happening recently.
> 
> This problem is not new. However, now that save-some-buffers-functions
> has been added, the problem goes beyond abbrevs.
> 
> >> Another example: hyperdrive.el adds to save-some-buffers-functions for
> >> saving hyperdrive file buffers:
> >>
> >> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99
> >>
> >> After this change, magit-save-repository-buffers now prompts to save
> >> irrelevant hyperdrive file buffers. I would like some way to tell
> >> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
> >> buffers from inside magit-save-repository-buffers.
> >
> > Why do you want to do that?  Whether or not to prompt the user abides
> > by the common protocol defined by save-some-buffers: if it's called
> > with the argument ARG non-nil (which should happen interactively when
> > the user invokes the command with a prefix argument), there's no
> > prompt, otherwise Emacs prompts.  Why magit-save-repository-buffers
> > wants to break this common protocol?
> 
> I think magit-save-repository-buffers follows the common protocol
> correctly.
> 
> > I feel that I'm still missing something important, which causes you to
> > want a different behavior from magit-save-repository-buffers.  For
> > starters, can you describe how magit-save-repository-buffers ends up
> > calling save-some-buffers-functions in enough detail for me to
> > understand why you think saving these buffers is deemed "undesirable"?
> 
> The issue is not that save-some-buffers prompts instead of saving
> without questions.
> 
> What is undesirable to me is that save-some-buffers unconditionally
> calls each one of save-some-buffers-functions, regardless of PRED. This
> means that when save-some-buffers is used with the intention to save
> only a handful of files (as with magit-save-repository-buffers),
> save-some-buffers-functions are all called, even when irrelevant.

So your problem is with Lisp programs that add functions to
save-some-buffers-functions, but don't expect or don't want those
functions to be called each time save-some-buffers is invoked?

I'm not sure how did those Lisp programs get the idea that
save-some-buffers-functions will not be called always -- is it hinted
by some documentation somewhere?  If not, I'd say that those Lisp
programs have a bug that needs to be fixed in those programs.  Right?

In any case, not calling save-some-buffers-functions when PRED is
non-nil is not something we can do, as that would be an incompatible
behavior change.  We could perhaps add PRED to the arguments with
which save-some-buffers-functions are called, as an optional argument.
Would that be satisfactory?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sat, 26 Aug 2023 07:54:01 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sat, 26 Aug 2023 00:32:23 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
> So your problem is with Lisp programs that add functions to
> save-some-buffers-functions, but don't expect or don't want those
> functions to be called each time save-some-buffers is invoked?

Yes.

> I'm not sure how did those Lisp programs get the idea that
> save-some-buffers-functions will not be called always -- is it hinted
> by some documentation somewhere?  If not, I'd say that those Lisp
> programs have a bug that needs to be fixed in those programs.  Right?

I agree.

> In any case, not calling save-some-buffers-functions when PRED is
> non-nil is not something we can do, as that would be an incompatible
> behavior change.  We could perhaps add PRED to the arguments with
> which save-some-buffers-functions are called, as an optional argument.
> Would that be satisfactory?

Yes, that would solve the interference between Magit and hyperdrive.el.

See patch.

Thank you!

Joseph

[0001-Pass-PRED-to-each-of-save-some-buffers-functions.patch (text/x-diff, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 26 Aug 2023 11:59:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sat, 02 Sep 2023 07:32:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sat, 02 Sep 2023 10:30:31 +0300
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li
> Date: Sat, 26 Aug 2023 00:32:23 -0700
> 
> 
> > In any case, not calling save-some-buffers-functions when PRED is
> > non-nil is not something we can do, as that would be an incompatible
> > behavior change.  We could perhaps add PRED to the arguments with
> > which save-some-buffers-functions are called, as an optional argument.
> > Would that be satisfactory?
> 
> Yes, that would solve the interference between Magit and hyperdrive.el.
> 
> See patch.

Hmm... but how to make this change backward-compatible?  I mean, if
there's some function out there that is used in
save-some-buffers-functions, and it was written to accept only 2
arguments, we cannot safely call it with 3 arguments, can we?

Stefan, do we have any way of doing that without causing errors?

If not, perhaps the way forward is to bind some variable around the
call to these functions, whose value will be PRED?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 17:17:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org,
 Joseph Turner <joseph <at> breatheoutbreathe.in>
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 13:06:07 -0400
>> > In any case, not calling save-some-buffers-functions when PRED is
>> > non-nil is not something we can do, as that would be an incompatible
>> > behavior change.  We could perhaps add PRED to the arguments with
>> > which save-some-buffers-functions are called, as an optional argument.
>> > Would that be satisfactory?
>> Yes, that would solve the interference between Magit and hyperdrive.el.
>> See patch.

[ Sorry, `debbugs.gnu.org` appears to be down, so I couldn't read the
  whole bug report, so I haven't seen the patch among other things.
  Hopefully that doesn't invalidate my comment :-)  ]

> Hmm... but how to make this change backward-compatible?  I mean, if
> there's some function out there that is used in
> save-some-buffers-functions, and it was written to accept only 2
> arguments, we cannot safely call it with 3 arguments, can we?

AFAICT `save-some-buffers-functions` is brand new in Emacs-29.1 and
currently gets called sometimes with 1 and sometimes with 2 arguments
(that's a somewhat unusual API in this respect), so it's probably OK to
break backward compatibility because it will only affect fresh code that
can easily be adjusted.

[ Arguably, it would be even better to arrange for `hyperdrive.el` to
  save its buffers "in the usual way", i.e. relying on
  `buffer-offer-save`, `save-buffer`, `buffer-save-without-query, ...  ]


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 17:30:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org, joseph <at> breatheoutbreathe.in
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 20:29:00 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Joseph Turner <joseph <at> breatheoutbreathe.in>,  65414 <at> debbugs.gnu.org,
>   jonas <at> bernoul.li
> Date: Sun, 03 Sep 2023 13:06:07 -0400
> 
>  Sorry, `debbugs.gnu.org` appears to be down

It is back up.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 17:36:03 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li,
 Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Joseph Turner <joseph <at> breatheoutbreathe.in>
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 20:22:56 +0300
>> > In any case, not calling save-some-buffers-functions when PRED is
>> > non-nil is not something we can do, as that would be an incompatible
>> > behavior change.  We could perhaps add PRED to the arguments with
>> > which save-some-buffers-functions are called, as an optional argument.
>> > Would that be satisfactory?
>>
>> Yes, that would solve the interference between Magit and hyperdrive.el.
>>
>> See patch.
>
> Hmm... but how to make this change backward-compatible?  I mean, if
> there's some function out there that is used in
> save-some-buffers-functions, and it was written to accept only 2
> arguments, we cannot safely call it with 3 arguments, can we?

If nothing else helps, just catch 'wrong-number-of-arguments',
then call with an obsolete signature again.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 17:46:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li, monnier <at> iro.umontreal.ca,
 joseph <at> breatheoutbreathe.in
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 20:44:45 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: Joseph Turner <joseph <at> breatheoutbreathe.in>,  Stefan Monnier
>  <monnier <at> iro.umontreal.ca>,  jonas <at> bernoul.li,  65414 <at> debbugs.gnu.org
> Date: Sun, 03 Sep 2023 20:22:56 +0300
> 
> > Hmm... but how to make this change backward-compatible?  I mean, if
> > there's some function out there that is used in
> > save-some-buffers-functions, and it was written to accept only 2
> > arguments, we cannot safely call it with 3 arguments, can we?
> 
> If nothing else helps, just catch 'wrong-number-of-arguments',
> then call with an obsolete signature again.

I was hoping for a cleaner, more elegant solution.  Still do.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 18:32:02 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 10:52:39 -0700
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> [ Arguably, it would be even better to arrange for `hyperdrive.el` to
>   save its buffers "in the usual way", i.e. relying on
>   `buffer-offer-save`, `save-buffer`, `buffer-save-without-query, ...  ]

I was not aware of `buffer-offer-save`. Thank you for the suggestion!
Since we already rely on `save-buffer`, setting `buffer-offer-save` to t
is much simpler than adding to `save-some-buffers-functions`. It also
resolves the interference between Magit and hyperdrive.el.

However... I wonder what the intended purpose of
`save-some-buffers-functions` is if packages like `hyperdrive.el` are
intended to use `buffer-offer-save`?

Joseph




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 19:04:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: Eli Zaretskii <eliz <at> gnu.org>, jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 15:03:25 -0400
> However... I wonder what the intended purpose of
> `save-some-buffers-functions` is if packages like `hyperdrive.el` are
> intended to use `buffer-offer-save`?

IIUC the purpose is to save things that are kept in variables rather
than buffers.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Sun, 03 Sep 2023 19:06:01 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, jonas <at> bernoul.li, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Sun, 03 Sep 2023 12:04:54 -0700
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> However... I wonder what the intended purpose of
>> `save-some-buffers-functions` is if packages like `hyperdrive.el` are
>> intended to use `buffer-offer-save`?
>
> IIUC the purpose is to save things that are kept in variables rather
> than buffers.

Good to know. Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Mon, 04 Sep 2023 10:54:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: jonas <at> bernoul.li, monnier <at> iro.umontreal.ca, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Mon, 04 Sep 2023 13:53:24 +0300
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li
> Date: Sun, 03 Sep 2023 10:52:39 -0700
> 
> 
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> 
> > [ Arguably, it would be even better to arrange for `hyperdrive.el` to
> >   save its buffers "in the usual way", i.e. relying on
> >   `buffer-offer-save`, `save-buffer`, `buffer-save-without-query, ...  ]
> 
> I was not aware of `buffer-offer-save`. Thank you for the suggestion!
> Since we already rely on `save-buffer`, setting `buffer-offer-save` to t
> is much simpler than adding to `save-some-buffers-functions`. It also
> resolves the interference between Magit and hyperdrive.el.

Does this mean we can close this issue without any changes to the
save-some-buffers-functions machinery?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65414; Package emacs. (Mon, 04 Sep 2023 15:55:02 GMT) Full text and rfc822 format available.

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

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: jonas <at> bernoul.li, monnier <at> iro.umontreal.ca, 65414 <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
Date: Mon, 04 Sep 2023 08:54:52 -0700

On September 4, 2023 3:53:24 AM PDT, Eli Zaretskii <eliz <at> gnu.org> wrote:
>Does this mean we can close this issue without any changes to the
>save-some-buffers-functions machinery?

That's fine by me, yes.

Thank you for taking the time to walk me through to a solution!!

Joseph




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 04 Sep 2023 16:00:02 GMT) Full text and rfc822 format available.

Notification sent to Joseph Turner <joseph <at> breatheoutbreathe.in>:
bug acknowledged by developer. (Mon, 04 Sep 2023 16:00:03 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>
Cc: jonas <at> bernoul.li, monnier <at> iro.umontreal.ca, 65414-done <at> debbugs.gnu.org
Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called
 when save-some-buffers pred is non-nil
Date: Mon, 04 Sep 2023 18:59:22 +0300
> Date: Mon, 04 Sep 2023 08:54:52 -0700
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> CC: monnier <at> iro.umontreal.ca, 65414 <at> debbugs.gnu.org, jonas <at> bernoul.li
> 
> 
> 
> On September 4, 2023 3:53:24 AM PDT, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >Does this mean we can close this issue without any changes to the
> >save-some-buffers-functions machinery?
> 
> That's fine by me, yes.

Done.

> Thank you for taking the time to walk me through to a solution!!

You are welcome.




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

This bug report was last modified 1 year and 220 days ago.

Previous Next


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