Subject: Re: bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil

From: Joseph Turner <[email-masked]>
Date: Wed, 23 Aug 2023 16:57:06 -0700

Eli Zaretskii <[email-masked]> 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