emacs-devel
[Top][All Lists]
Advanced

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

Re: autorevert and vc


From: Stefan Monnier
Subject: Re: autorevert and vc
Date: 30 Mar 2004 14:56:42 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> It apparently does not seem to take that much CPU to update the
> VC-state (without reverting the buffer) every five seconds, whether it
> is needed or not.

Of course that depends on the revision control being used.

> The patch below takes out all original vc-code, as you suggested.
> Then it takes care of the problem that code was intended to fix by
> calling `vc-find-file-hook' unconditionally if the user requests that
> through a customizable variable.  The default is nil, do not do this.
> If the user has a reasonably fast machine and worries about the
> problem, he sets it to t and forgets about it.  If the user knows he
> never is going to be in that situation, he keeps it nil.  Otherwise,
> he sets it to t whenever the need arises.

> Note that my patch works for all version control systems supported by
> VC (I checked it for RCS), whereas the original only worked for CVS.

> Does this look OK?

It looks fine to me.
To improve it we can add something like the following in vc-hooks.el:

   (defun vc-stale-state-p (file)
     (vc-call 'stale-state-p file))
   (defun vc-default-stale-state-p (backend file)
     t)

So you can then use `vc-stale-state-p' to check whether you need to call
vc-find-file-hook.  The default is to always return t but backends can
override it with something more precise in case it's possible to determine
freshness more efficiently than doing the refresh.

Pleased check with Andre <address@hidden>, to see whether he has a better
idea about what functionality VC should provide.


        Stefan




reply via email to

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