unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* autorevert and vc
@ 2004-03-29  3:52 Luc Teirlinck
  2004-03-29  4:24 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Luc Teirlinck @ 2004-03-29  3:52 UTC (permalink / raw)


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."
============================================================

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-04-01 16:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-29  3:52 autorevert and vc Luc Teirlinck
2004-03-29  4:24 ` Stefan Monnier
2004-03-29  4:43   ` Luc Teirlinck
2004-03-30  2:27   ` Luc Teirlinck
2004-03-30 19:56     ` Stefan Monnier
2004-04-01 10:27     ` Jari Aalto
2004-04-01 16:46       ` Luc Teirlinck
2004-03-30 15:17   ` Luc Teirlinck
2004-03-30 20:51     ` Andre Spiegel
2004-03-31  0:24       ` Stefan Monnier
2004-03-31  2:02         ` Luc Teirlinck
2004-03-31  2:15           ` Luc Teirlinck
2004-03-31  7:19           ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).