Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status

From: Dan Nicolaescu <[email-masked]>
Date: Wed, 23 Sep 2009 14:21:37 -0700 (PDT)

Óscar Fuentes <[email-masked]> writes:

  > Dan Nicolaescu <[email-masked]> writes:
  > 
  > > Óscar Fuentes <[email-masked]> writes:
  > >
  > >   > Dan Nicolaescu <[email-masked]> writes:
  > >   > 
  > >   > > [email-masked]. "(Óscar" Fuentes) writes:
  > >   > >
  > >   > >   > Please write in English if possible, because the Emacs maintainers
  > >   > >   > usually do not have translators to read other languages for them.
  > >   > >   > 
  > >   > >   > Your bug report will be posted to the [email-masked] mailing list.
  > >   > >   > 
  > >   > >   > Please describe exactly what actions triggered the bug
  > >   > >   > and the precise symptoms of the bug:
  > >   > >   > 
  > >   > >   > When a modified versioned file is edited in such a way that the
  > >   > >   > modifications undoes previous changes to the file, after saving it the
  > >   > >   > VC-dired buffer for the working copy is automatically updated showing
  > >   > >   > that the status of the file is "up to date", but the VC modeline for the
  > >   > >   > buffer that visits the file does not change and keeps indicating that
  > >   > >   > the file state is "locally modified".
  > >   > >
  > >   > > Can you please describe step by step the actions necessary to reproduce
  > >   > > this starting from emacs -Q?
  > >   > 
  > >   > emacs -Q
  > >   > 
  > >   > C-x C-f some-versioned-unmodified-file
  > >   > do some edition
  > >   > C-x C-s (the VC status modeline indicator changes from `-' to `:')
  > >   > undo previous edition
  > >   > C-x C-s
  > >   > 
  > >   > Now you just turned the file to its original state and is unmodified as
  > >   > far as the version control system is concerned, but the VC modeline
  > >   > keeps showing `:' (for example Bzr:836) indicating that the file is
  > >   > edited. After saving a versioned file, VC should check if the VC backend
  > >   > flags the file as edited and update the modeline accordingly.
  > >
  > > You can do M-x revert-buffer or C-x v u and that would reset the VC
  > > state accordingly.
  > 
  > Yes, I know.
  > 
  > > Checking for this condition after each save is prohibitively expensive,
  > > and it's an extremely rare event, so it's not worth optimizing for.
  > 
  > Automatically checking the VC state after each save is actually
  > performed if there is a vc-dired buffer for the working copy where the
  > file resides. That check updates the vc-dired with the correct state of
  > the saved file.
  > 
  > Part of my job is experimenting tweaks and micro-improvements on
  > existing code bases. After every session I end with lots of buffers
  > showing the "edited" vc modeline indicator when in fact only one or two
  > are effectively edited. This renders useless the vc state indicator and
  > turns its meaning into "When `:' is shown, this file was edited, but it
  > may be up-to-date now".
  > 
  > > So this is neither a bug, not something worth improving.
  > 
  > Well, the vc status on the modeline is showing the wrong state.

  > Would you accept a patch that implements an option for checking after
  > every save and updating the vc state on the modeline accordingly?

Although I've done a lot of work on VC, I am not an official maintainer
of VC, so I am in no position to do that.  But I don't think such a
change is a good idea.