emacs-devel
[Top][All Lists]
Advanced

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

autorevert and vc


From: Luc Teirlinck
Subject: autorevert and vc
Date: Sun, 28 Mar 2004 21:52:29 -0600 (CST)

As I already said before, the one part of the recent changes to
autorevert.el (prior to the ones I made) which I did not check are
the vc-part of those changes.  There seem to be bugs, or at the very
least nuisance features, associated with them.

Unlike the non-file features, the vc features are enabled by default,
if global-auto-revert-mode is enabled.  If nothing else, one needs a
way to disable them, which the patch below provides.  I personally do
not know enough about vc to do a lot more than that.

If one visit a file that is using RCS, it does not auto-revert, until
one loads 'vc.  Then it auto-reverts every auto-revert-interval
seconds, regardless of whether there is any need for that.

The reasons for this behavior are obvious from the code:

Part of the check of whether the file needs reverting is 
(featurep 'vc).  So no version controlled file, RCS or CVS, will be
auto-reverted until vc is loaded.  Apparently, that does not
automatically happen by visiting a version controlled file.  It does
happen if one does C-x v =.  I do not see what requesting a diff has
to do with requesting auto-reverting.

The following explains the other part of the RCS-problem:
     
     ((eq backend 'RCS)
       ;; TODO:
         )

If vc is loade that code is equivalent with:

((eq backend 'RCS) t)

That can get obnoxious.

When using CVS, automatic reverting every five seconds seems to occur
if there is an out-of-date version backup.  Maybe that is not a bug
and one just should make sure to always delete such obsolete files.

Since RCS and CVS are the two only version control systems I use, I do
not know what happens with other systems.  But no part of the code
even _tries_ to handle them.

I really do not know enough about vc to investigate this further.

However, I believe that, even though vc-mode is not a major mode, it
plays a somewhat similar role in as far as Auto-Revert mode is
concerned.  Hence, I propose the following patch which would allow to
include vc-mode in global-auto-revert-ignore-modes.   Are there any
objections to this patch?

===File ~/autorevert-diff===================================
*** autorevert.el       28 Mar 2004 07:51:54 -0600      1.27
--- autorevert.el       28 Mar 2004 19:42:05 -0600      
***************
*** 181,187 ****
    :type 'boolean)
  
  (defcustom global-auto-revert-ignore-modes '()
!   "List of major modes Global Auto-Revert Mode should not check."
    :group 'auto-revert
    :type '(repeat sexp))
  
--- 181,189 ----
    :type 'boolean)
  
  (defcustom global-auto-revert-ignore-modes '()
!   "List of major modes Global Auto-Revert Mode should not check.
! This list can also include `vc-mode', meaning that Auto-Revert
! Mode should not check version controlled buffers."
    :group 'auto-revert
    :type '(repeat sexp))
  
***************
*** 276,283 ****
        (and
         global-auto-revert-mode
         (not global-auto-revert-ignore-buffer)
!        (not (memq major-mode
!                 global-auto-revert-ignore-modes)))))
  
  (defun auto-revert-vc-cvs-file-version (file)
    "Get version of FILE by reading control file on disk."
--- 278,286 ----
        (and
         global-auto-revert-mode
         (not global-auto-revert-ignore-buffer)
!        (not (memq major-mode global-auto-revert-ignore-modes))
!        (not (and (auto-revert-vc-buffer-p)
!                (memq 'vc-mode global-auto-revert-ignore-modes))))))
  
  (defun auto-revert-vc-cvs-file-version (file)
    "Get version of FILE by reading control file on disk."
============================================================




reply via email to

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