bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4515: 23.1.50; Reverting changes on versioned file does not revert v


From: Óscar Fuentes
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Dan Nicolaescu <address@hidden> writes:

> Stefan Monnier <address@hidden> 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  <address@hidden>

        * 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 via email to

[Prev in Thread] Current Thread [Next in Thread]