From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: autorevert and vc Date: 30 Mar 2004 14:56:42 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <200403290352.i2T3qTP07266@raven.dms.auburn.edu> <200403300227.i2U2Rp111731@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1080677274 879 80.91.224.253 (30 Mar 2004 20:07:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 Mar 2004 20:07:54 +0000 (UTC) Cc: spiegel@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Mar 30 22:07:42 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B8PWQ-0005NQ-00 for ; Tue, 30 Mar 2004 22:07:42 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B8PWQ-0003rZ-00 for ; Tue, 30 Mar 2004 22:07:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B8PMz-0000mo-D0 for emacs-devel@quimby.gnus.org; Tue, 30 Mar 2004 14:57:57 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B8PMY-0000lT-A2 for emacs-devel@gnu.org; Tue, 30 Mar 2004 14:57:30 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B8PLz-0000hg-Qo for emacs-devel@gnu.org; Tue, 30 Mar 2004 14:57:28 -0500 Original-Received: from [206.47.199.166] (helo=simmts8-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B8PLp-0000gi-6o; Tue, 30 Mar 2004 14:56:45 -0500 Original-Received: from empanada.local ([67.71.25.239]) by simmts8-srv.bellnexxia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20040330195641.HJRN21833.simmts8-srv.bellnexxia.net@empanada.local>; Tue, 30 Mar 2004 14:56:41 -0500 Original-Received: by empanada.local (Postfix, from userid 502) id B223014B5AB; Tue, 30 Mar 2004 14:56:42 -0500 (EST) Original-To: Luc Teirlinck In-Reply-To: <200403300227.i2U2Rp111731@raven.dms.auburn.edu> Original-Lines: 38 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21101 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21101 > 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 , to see whether he has a better idea about what functionality VC should provide. Stefan