emacs-devel
[Top][All Lists]
Advanced

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

Re: autorevert and vc


From: Luc Teirlinck
Subject: Re: autorevert and vc
Date: Tue, 30 Mar 2004 20:02:11 -0600 (CST)

Stefan Monnier wrote:

   > So, you might fine-tune your algorithm to only re-compute the vc-state
   > every five seconds *if* the backend has a state-heuristic function.
   > (You can use vc-find-backend-function to determine that.)

   Sounds fair.  I should adjust vc-arch accordingly, which is probably the
   right thihng to do anyway.

In that case, the suggested test would be meaningless for the current
six members of `vc-handled-backends'.  Indeed Arch is the _only_ one
of the six without a state-heuristic function, as determined by
`vc-find-backend-function'.  What if I just commit my patch as is and
then we can always add improvements later?  

One alternative is provided by the diff below, but I do not know
whether the added flexibility would be worth the corresponding added
complexity.  (I did neither carefully check nor test the patch, but
its intent is, I believe, clear, and the intent is what we are
discussing right now.)

Note that this is a variable whose default value is nil.  So by default,
the automatic updating every five seconds does _not_ take place.

===File ~/autorevert-diff3==================================
diff -c /home/teirllm/autorevert.save.el 
/home/teirllm/emacscvsdir/emacs/lisp/autorevert.el
*** /home/teirllm/autorevert.save.el    Mon Mar 29 19:47:20 2004
--- /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el  Tue Mar 30 19:36:24 2004
***************
*** 187,203 ****
  
  (defcustom auto-revert-check-vc-numbers nil
    "If non-nil Auto Revert Mode reliably updates version control info.
  This matters if a version controlled file is edited from several
! Emacs sessions.  In that case, if changes in one session are saved,
! any buffers visiting the file in other sessions are updated.
! However, if the changes are checked in, the version control number
! in the mode line, as well as other version control related
! information, may not be properly updated in the other sessions.
! If you are worried about this, set this variable to a non-nil value.
! This should not cause excessive CPU usage on a reasonably fast
! machine, if it does not apply to too many version controlled buffers."
    :group 'auto-revert
!   :type 'boolean
    :version "21.4")
  
  (defvar global-auto-revert-ignore-buffer nil
--- 187,218 ----
  
  (defcustom auto-revert-check-vc-numbers nil
    "If non-nil Auto Revert Mode reliably updates version control info.
+ The value is a list of version control systems, for which all
+ version control info will be updated reliably.  The valid
+ elements are nil and the members of `vc-handled-backends',
+ currently `RCS', `CVS', `SVN', `SCCS', `Arch', and `MCVS'.
+ Including nil in the list will just detect that a priorly
+ non-registered file has been put under version control.
+ 
  This matters if a version controlled file is edited from several
! Emacs sessions.  In that case, if changes in one session are
! saved, any buffers visiting the file in other sessions are
! reverted and their version control info is updated.  However, if
! the saved changes are later checked in, without further unsaved
! changes, the version control number in the mode line, as well as
! other version control related information, may not be properly
! updated in the other sessions.  If you are worried about this,
! set this variable to a non-nil value.
! 
! This currently works by automatically updating the version
! control info every `auto-revert-interval' seconds.  On a slow
! computer with a large number of version controlled buffers, this
! could lead to excessive CPU usage.  Also, CPU usage depends
! heavily on the version control system."
    :group 'auto-revert
!   :type '(choice (const :tag "Detect registration" nil)
!                (const RCS) (const CVS) (const SVN)
!                (const SCCS) (const MCVS) (const Arch))
    :version "21.4")
  
  (defvar global-auto-revert-ignore-buffer nil
***************
*** 309,315 ****
        (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))
        ;; `preserve-modes' avoids changing the (minor) modes.  But we
        ;; do want to reset the mode for VC, so we do it manually.
!       (when (or revert auto-revert-check-vc-numbers)
        (vc-find-file-hook)))))
  
  (defun auto-revert-buffers ()
--- 324,333 ----
        (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))
        ;; `preserve-modes' avoids changing the (minor) modes.  But we
        ;; do want to reset the mode for VC, so we do it manually.
!       (when (or revert
!               (and buffer-file-name
!                    (memq (vc-backend buffer-file-name)
!                          auto-revert-check-vc-numbers)))
        (vc-find-file-hook)))))
  
  (defun auto-revert-buffers ()

Diff finished.  Tue Mar 30 19:36:33 2004
============================================================




reply via email to

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