Subject: bug#55310: 27.2; vc-revert: unhelpful error message when modified buffers exist

From: Sean Whitton <[email-masked]>
Date: Fri, 14 Mar 2025 11:37:13 +0800

Hello,

On Wed 12 Mar 2025 at 10:11am +02, Dmitry Gutov wrote:

> On 10/03/2025 09:06, Sean Whitton wrote:
>>>> Idea (ideas are cheap): maybe if one could add some sort of
>>>> high-light, or something in vc-dired that shows that this or that file
>>>> has a open buffer that is unmodified, and then the error could be the
>>>> same but just saying that one should check the highlighted buffers.
>>> I think that's a good idea -- perhaps Dmitry has some comments; added to
>>> the CCs.
>> ISTM that a project-save-some-buffers is what's wanted here.
>> Dmitry, has there been a discussion about having something like that?
>
> Last time this came up, a new value for save-some-buffers-default-predicate
> was added: save-some-buffers-root (bug#46374). So:
>
>   (setopt save-some-buffers-default-predicate #'save-some-buffers-root)

Ah, thanks for the reference.

I would like to do one of the following things:

(1) Do add the call to save-some-buffers in Lars's message.
    We can change the error message to
      "Some unsaved buffers remain; cannot revert"
    and then I don't agree with him that the situation is confusing.

(2) Add a project-save-some-buffers which just binds
    save-some-buffers-default-predicate around a call to
    save-some-buffers, bind is to 'C-x p C-x s' (useful anyway, I think)
    and change the message to suggest using it:
      "Use C-x p C-x s to save or kill modified buffers before reverting"

WDYT?

-- 
Sean Whitton