all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: 4515@emacsbugs.donarmstrong.com
Subject: 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	[thread overview]
Message-ID: <87skeckghp.fsf@telefonica.net> (raw)
In-Reply-To: <200909240424.n8O4OjLB004582@godzilla.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 23 Sep 2009 21:24:45 -0700 (PDT)")

Dan Nicolaescu <dann@ics.uci.edu> writes:

> Stefan Monnier <monnier@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@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.





  reply	other threads:[~2009-09-24  6:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-22  2:26 bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status =C3=93scar?= Fuentes
2009-09-23  5:53 ` Dan Nicolaescu
2009-09-23  6:49   ` Óscar Fuentes
2009-09-23 18:36     ` Dan Nicolaescu
2009-09-23 19:31       ` Óscar Fuentes
2009-09-23 21:21         ` Dan Nicolaescu
2009-09-24  2:08           ` Kevin Rodgers
2009-09-24  2:25         ` Stefan Monnier
2009-09-24  4:24           ` Dan Nicolaescu
2009-09-24  6:24             ` Óscar Fuentes [this message]
2009-09-24 17:20               ` Dan Nicolaescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skeckghp.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --cc=4515@emacsbugs.donarmstrong.com \
    --cc=dann@ics.uci.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.