GNU bug report logs - #4515
23.1.50; Reverting changes on versioned file does not revert vc modeline status

Previous Next

Package: emacs;

Reported by: ofv <at> wanadoo.es (Óscar Fuentes)

Date: Tue, 22 Sep 2009 02:35:03 UTC

Severity: normal

Done: Juanma Barranquero <lekktu <at> gmail.com>

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 4515 in the body.
You can then email your comments to 4515 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Tue, 22 Sep 2009 02:35:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to ofv <at> wanadoo.es (Óscar Fuentes):
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 22 Sep 2009 02:35:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: ofv <at> wanadoo.es (Óscar Fuentes)
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Tue, 22 Sep 2009 04:26:57 +0200
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 emacs-pretest-bug <at> gnu.org 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".

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/share/emacs/23.1.50/etc/DEBUG for instructions.


In GNU Emacs 23.1.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2009-09-06 on qcore
Windowing system distributor `The X.Org Foundation', version 11.0.10600000
configured using `configure  '--with-x-toolkit=lucid''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: C++/lah

Minor modes in effect:
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  show-paren-mode: t
  diff-auto-refine-mode: t
  iswitchb-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  abbrev-mode: t

Recent input:
n d ( ) SPC ) ; } <return> / / - - - - - - - - - - 
- - - <return> <up> <up> <up> <up> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> M-d <up> 
<up> <up> <return> / / - - - - - - - - - - - - - - 
- - <backspace> <backspace> <backspace> <backspace> 
- <return> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> C-x C-s M-x c m a k e C-g 
M-x s e t SPC a c t i v e SPC c o m <tab> <return> 
g c c <return> M-x c m a k e <return> <f2> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> C-x 
b e x e <return> C-r t y p e d e f C-a C-x b <return> 
M-d <right> C-y C-x C-s <f9> <f2> C-e <C-left> <C-left> 
<backspace> - > <f2> <up> C-a C-k C-k C-x C-s <f9> 
<down> <down> <down> C-e <C-left> <C-left> <C-right> 
<right> <right> M-d f f i c g C-x C-s <f9> C-x o <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <return> <down> <right> <right> M-d C-d C-x 
C-s <f9> <help-echo> M-x g n u s <return> <return> 
d q <down> <return> d q q y M-x g n u s <return> q 
y <help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <menu-bar> <help-menu> <se
nd-emacs-bug-report>

Recent messages:
Opening nnfolder server on archive...done
Reading active file from archive via nnfolder...done
Generating the cache active file...done
No new newsgroups
Checking new news...
Opening nntp server on news.gmane.org...done
Checking new news...done
No more unread newsgroups
Are you sure you want to quit reading news? (y or n) 
(No changes need to be saved)

Load-path shadows:
None found.

-- 
Óscar Fuentes
Desarrollo de Software



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Wed, 23 Sep 2009 06:00:04 GMT) Full text and rfc822 format available.

Message #8 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: =C3=93scar?= Fuentes <ofv <at> wanadoo.es>
Cc: 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Tue, 22 Sep 2009 22:53:14 -0700 (PDT)
ofv <at> wanadoo.es. "(Ó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 emacs-pretest-bug <at> gnu.org 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?



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Wed, 23 Sep 2009 07:00:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Óscar Fuentes <ofv <at> wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 23 Sep 2009 07:00:06 GMT) Full text and rfc822 format available.

Message #13 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Wed, 23 Sep 2009 08:49:56 +0200
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> ofv <at> wanadoo.es. "(Ó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 emacs-pretest-bug <at> gnu.org 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.

-- 
Óscar



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Wed, 23 Sep 2009 18:45:03 GMT) Full text and rfc822 format available.

Message #16 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Wed, 23 Sep 2009 11:36:06 -0700 (PDT)
Óscar Fuentes <ofv <at> wanadoo.es> writes:

  > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > 
  > > ofv <at> wanadoo.es. "(Ó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 emacs-pretest-bug <at> gnu.org 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.
Checking for this condition after each save is prohibitively expensive,
and it's an extremely rare event, so it's not worth optimizing for.
So this is neither a bug, not something worth improving.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Wed, 23 Sep 2009 20:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Óscar Fuentes <ofv <at> wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 23 Sep 2009 20:45:04 GMT) Full text and rfc822 format available.

Message #21 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Wed, 23 Sep 2009 21:31:03 +0200
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> Óscar Fuentes <ofv <at> wanadoo.es> writes:
>
>   > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
>   > 
>   > > ofv <at> wanadoo.es. "(Ó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 emacs-pretest-bug <at> gnu.org 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?

-- 
Óscar



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Wed, 23 Sep 2009 21:30:03 GMT) Full text and rfc822 format available.

Message #24 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Wed, 23 Sep 2009 14:21:37 -0700 (PDT)
Óscar Fuentes <ofv <at> wanadoo.es> writes:

  > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > 
  > > Óscar Fuentes <ofv <at> wanadoo.es> writes:
  > >
  > >   > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > >   > 
  > >   > > ofv <at> wanadoo.es. "(Ó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 emacs-pretest-bug <at> gnu.org 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.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Thu, 24 Sep 2009 02:25:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kevin Rodgers <kevin.d.rodgers <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 24 Sep 2009 02:25:07 GMT) Full text and rfc822 format available.

Message #29 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#4515: 23.1.50;   Reverting changes on versioned file does
 not revert vc modeline   status
Date: Wed, 23 Sep 2009 20:08:50 -0600
Dan Nicolaescu wrote:
> Óscar Fuentes <ofv <at> wanadoo.es> writes:
> 
>   > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
...
>   > > 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.
...
>   > > 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.

Should that feature be removed from vc-dired, so that it is consistent with the
buffer's mode line?

(No, I'm not serious.)

-- 
Kevin Rodgers
Denver, Colorado, USA





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Thu, 24 Sep 2009 02:35:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 24 Sep 2009 02:35:04 GMT) Full text and rfc822 format available.

Message #34 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 4515 <at> debbugs.gnu.org, Dan Nicolaescu <dann <at> ics.uci.edu>
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Wed, 23 Sep 2009 22:25:31 -0400
> 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.

Indeed.  That requires the status info to be obtainable cheaply.

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

I'd consider it, yes.


        Stefan



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Thu, 24 Sep 2009 04:35:04 GMT) Full text and rfc822 format available.

Message #37 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Óscar Fuentes <ofv <at> wanadoo.es>,
        4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Wed, 23 Sep 2009 21:24:45 -0700 (PDT)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

  > > 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.
  > 
  > Indeed.  That requires the status info to be obtainable cheaply.

There's a major difference: vc-dir is asynchronous, whereas updating the
same info when saving a file is synchronous, so it will be on the
critical path.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Thu, 24 Sep 2009 06:30:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Óscar Fuentes <ofv <at> wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 24 Sep 2009 06:30:04 GMT) Full text and rfc822 format available.

Message #42 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Thu, 24 Sep 2009 08:24:02 +0200
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>   > > 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.
>   > 
>   > Indeed.  That requires the status info to be obtainable cheaply.
>
> There's a major difference: vc-dir is asynchronous, whereas updating the
> same info when saving a file is synchronous, so it will be on the
> critical path.

Are you saying that vc-dir updates the file status asynchronously after
a file is saved? vc-dir-recompute-file-state does

	 (state (vc-call-backend vc-dir-backend 'state fname))
	 (extra (vc-call-backend vc-dir-backend
				 'status-fileinfo-extra fname)))

which looks like the same stuff vc-after-save is trying to avoid.

I've implemented the option for checking the state after every save. It
is almost instantaneous on a GNU/Linux machine with bzr. On a Windows XP
netbook there is almost no noticeable delay with a hot cache. Using bzr
2.0rc on a 1000 rev branch. The option is off by default so the user
must toggle the option before complaining about the performance. The
docstring of the defcustom warns about that posibility.


2009-09-24  Oscar Fuentes  <ofv <at> wanadoo.es>

	* lisp/vc-hooks.el (vc-always-update-modeline-after-save):
        new defcustom.
        (vc-after-save): Use it and when non-nil check the vc file state
        so the modeline reflects its actual state.


diff -cp "c:/apps/emacs/lisp/vc-hooks.el" "d:/vc-hooks.el"
*** c:/apps/emacs/lisp/vc-hooks.el	2009-09-24 07:25:53.000000000 +0200
--- d:/vc-hooks.el	2009-09-24 08:10:01.062500000 +0200
*************** If nil (the default), files covered by v
*** 96,101 ****
--- 96,110 ----
    :group 'vc
    :group 'backup)
  
+ (defcustom vc-always-update-modeline-after-save nil
+   "If non-nil, always update the state shown in the modeline
+ after saving the file. This may be time-consuming for some
+ backends. If nil, the modeline changes to `edited' when the file
+ is saved for the first time and it is not updated on subsequent
+ saves."
+   :type 'boolean
+   :group 'vc)
+ 
  (defcustom vc-follow-symlinks 'ask
    "What to do if visiting a symbolic link to a file under version control.
  Editing such a file through the link bypasses the version control system,
*************** Before doing that, check if there are an
*** 743,751 ****
  		  ;; to avoid confusion.
  		  (vc-file-setprop file 'vc-checkout-time nil))
  	     t)
-          (vc-up-to-date-p file)
           (eq (vc-checkout-model backend (list file)) 'implicit)
!          (vc-file-setprop file 'vc-state 'edited)
  	 (vc-mode-line file backend)
  	 ;; Try to avoid unnecessary work, a *vc-dir* buffer is
  	 ;; present if and only if this is true.
--- 752,766 ----
  		  ;; to avoid confusion.
  		  (vc-file-setprop file 'vc-checkout-time nil))
  	     t)
           (eq (vc-checkout-model backend (list file)) 'implicit)
! 	 (if vc-always-update-modeline-after-save
! 	     (progn
! 	       ;; Avoid using cached value on `vc-state':
! 	       (vc-file-setprop file 'vc-state 'nil)
! 	       (vc-file-setprop file 'vc-state (vc-state file backend)))
! 	   (and
! 	    (vc-up-to-date-p file)
! 	    (vc-file-setprop file 'vc-state 'edited)))
  	 (vc-mode-line file backend)
  	 ;; Try to avoid unnecessary work, a *vc-dir* buffer is
  	 ;; present if and only if this is true.



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4515; Package emacs. (Thu, 24 Sep 2009 17:30:03 GMT) Full text and rfc822 format available.

Message #45 received at 4515 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 4515 <at> debbugs.gnu.org
Subject: Re: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status
Date: Thu, 24 Sep 2009 10:20:51 -0700 (PDT)
Óscar Fuentes <ofv <at> wanadoo.es> writes:

  > Dan Nicolaescu <dann <at> ics.uci.edu> writes:
  > 
  > > Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
  > >
  > >   > > 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.
  > >   > 
  > >   > Indeed.  That requires the status info to be obtainable cheaply.
  > >
  > > There's a major difference: vc-dir is asynchronous, whereas updating the
  > > same info when saving a file is synchronous, so it will be on the
  > > critical path.
  > 
  > Are you saying that vc-dir updates the file status asynchronously after
  > a file is saved? vc-dir-recompute-file-state does

Hmm, I implemented that probably 2 years ago ago, but it does not look
like I checked it in...  and I can't seem to find that patch anymore.  :-(

  > 	 (state (vc-call-backend vc-dir-backend 'state fname))
  > 	 (extra (vc-call-backend vc-dir-backend
  > 				 'status-fileinfo-extra fname)))

This function should instead be using `vc-dir-refresh-files' to work
asynchronously.

Given that nobody noticed this until now, maybe it's not too bad.



bug closed, send any further explanations to ofv <at> wanadoo.es (Óscar Fuentes) Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Thu, 22 Oct 2009 09:40:24 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Thu, 19 Nov 2009 15:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 212 days ago.

Previous Next


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