From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andre Spiegel Newsgroups: gmane.emacs.devel Subject: Re: autorevert and vc Date: Tue, 30 Mar 2004 22:51:46 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <1080679906.29733.143.camel@localhost> References: <200403290352.i2T3qTP07266@raven.dms.auburn.edu> <200403301517.i2UFHa613876@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1080680175 8936 80.91.224.253 (30 Mar 2004 20:56:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 Mar 2004 20:56:15 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Mar 30 22:56:06 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 1B8QHF-0000m0-00 for ; Tue, 30 Mar 2004 22:56:05 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B8QHF-0005oh-00 for ; Tue, 30 Mar 2004 22:56:05 +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 1B8QG6-0005Zw-AV for emacs-devel@quimby.gnus.org; Tue, 30 Mar 2004 15:54:54 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B8QF1-00054r-55 for emacs-devel@gnu.org; Tue, 30 Mar 2004 15:53:47 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B8QDl-00045j-UW for emacs-devel@gnu.org; Tue, 30 Mar 2004 15:53:01 -0500 Original-Received: from [193.113.160.16] (helo=mail.o2.co.uk) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B8QDL-0003Z6-JO for emacs-devel@gnu.org; Tue, 30 Mar 2004 15:52:03 -0500 Original-Received: from [217.81.123.32] (217.81.123.32) by mail.o2.co.uk (7.0.020) (authenticated as andre.spiegel@o2online.de) id 40557866005BC7E0; Tue, 30 Mar 2004 21:51:48 +0100 Original-To: Luc Teirlinck In-Reply-To: <200403301517.i2UFHa613876@raven.dms.auburn.edu> X-Mailer: Ximian Evolution 1.4.5 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:21104 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21104 On Tue, 2004-03-30 at 17:17, Luc Teirlinck wrote: > 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. [...] I do not know very much about VC, but at > first sight, I would be inclined to believe that probably the real > way to do it would be to check the file modification times of the > control files. When you call vc-find-file-hook to recompute the version control state, all that happens for CVS, RCS and SCCS is a check of file modification times or permissions (for MCVS it's similar, SVN and Arch are slightly more expensive, I think). The idea is that backends can provide a vc-BACKEND-state-heuristic function, which guesses the state by doing a fast operation like a permission check or mtime check. If no state-heuristic function is provided, then each computation of the state likely involves an expensive call to the backend system. 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.) Stefan's suggestion (vc-stale-state-p) is potentially more generic, but perhaps it's better to wait until there is a backend where the existing mechanism really isn't expressive enough. Stefan, what do you think?