From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: autorevert and vc Date: Tue, 30 Mar 2004 20:02:11 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200403310202.i2V22BT17108@raven.dms.auburn.edu> References: <200403290352.i2T3qTP07266@raven.dms.auburn.edu> <200403301517.i2UFHa613876@raven.dms.auburn.edu> <1080679906.29733.143.camel@localhost> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1080699137 9769 80.91.224.253 (31 Mar 2004 02:12:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 31 Mar 2004 02:12:17 +0000 (UTC) Cc: spiegel@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Mar 31 04:12:03 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 1B8VD1-00022e-00 for ; Wed, 31 Mar 2004 04:12:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B8VD1-0008U7-00 for ; Wed, 31 Mar 2004 04:12:03 +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 1B8V7h-0001uQ-2b for emacs-devel@quimby.gnus.org; Tue, 30 Mar 2004 21:06:33 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B8V69-0001RV-SY for emacs-devel@gnu.org; Tue, 30 Mar 2004 21:04:57 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B8V5Y-0001Bu-9p for emacs-devel@gnu.org; Tue, 30 Mar 2004 21:04:52 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B8V5X-0001BT-S0; Tue, 30 Mar 2004 21:04:19 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i2V24JKt008128; Tue, 30 Mar 2004 20:04:19 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i2V22BT17108; Tue, 30 Mar 2004 20:02:11 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@iro.umontreal.ca In-reply-to: (message from Stefan Monnier on 30 Mar 2004 19:24:39 -0500) 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:21114 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21114 Stefan Monnier wrote: > 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.) Sounds fair. I should adjust vc-arch accordingly, which is probably the right thihng to do anyway. In that case, the suggested test would be meaningless for the current six members of `vc-handled-backends'. Indeed Arch is the _only_ one of the six without a state-heuristic function, as determined by `vc-find-backend-function'. What if I just commit my patch as is and then we can always add improvements later? One alternative is provided by the diff below, but I do not know whether the added flexibility would be worth the corresponding added complexity. (I did neither carefully check nor test the patch, but its intent is, I believe, clear, and the intent is what we are discussing right now.) Note that this is a variable whose default value is nil. So by default, the automatic updating every five seconds does _not_ take place. ===File ~/autorevert-diff3================================== diff -c /home/teirllm/autorevert.save.el /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el *** /home/teirllm/autorevert.save.el Mon Mar 29 19:47:20 2004 --- /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el Tue Mar 30 19:36:24 2004 *************** *** 187,203 **** (defcustom auto-revert-check-vc-numbers nil "If non-nil Auto Revert Mode reliably updates version control info. This matters if a version controlled file is edited from several ! Emacs sessions. In that case, if changes in one session are saved, ! any buffers visiting the file in other sessions are updated. ! However, if the changes are checked in, the version control number ! in the mode line, as well as other version control related ! information, may not be properly updated in the other sessions. ! If you are worried about this, set this variable to a non-nil value. ! This should not cause excessive CPU usage on a reasonably fast ! machine, if it does not apply to too many version controlled buffers." :group 'auto-revert ! :type 'boolean :version "21.4") (defvar global-auto-revert-ignore-buffer nil --- 187,218 ---- (defcustom auto-revert-check-vc-numbers nil "If non-nil Auto Revert Mode reliably updates version control info. + The value is a list of version control systems, for which all + version control info will be updated reliably. The valid + elements are nil and the members of `vc-handled-backends', + currently `RCS', `CVS', `SVN', `SCCS', `Arch', and `MCVS'. + Including nil in the list will just detect that a priorly + non-registered file has been put under version control. + This matters if a version controlled file is edited from several ! Emacs sessions. In that case, if changes in one session are ! saved, any buffers visiting the file in other sessions are ! reverted and their version control info is updated. However, if ! the saved changes are later checked in, without further unsaved ! changes, the version control number in the mode line, as well as ! other version control related information, may not be properly ! updated in the other sessions. If you are worried about this, ! set this variable to a non-nil value. ! ! This currently works by automatically updating the version ! control info every `auto-revert-interval' seconds. On a slow ! computer with a large number of version controlled buffers, this ! could lead to excessive CPU usage. Also, CPU usage depends ! heavily on the version control system." :group 'auto-revert ! :type '(choice (const :tag "Detect registration" nil) ! (const RCS) (const CVS) (const SVN) ! (const SCCS) (const MCVS) (const Arch)) :version "21.4") (defvar global-auto-revert-ignore-buffer nil *************** *** 309,315 **** (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)) ;; `preserve-modes' avoids changing the (minor) modes. But we ;; do want to reset the mode for VC, so we do it manually. ! (when (or revert auto-revert-check-vc-numbers) (vc-find-file-hook))))) (defun auto-revert-buffers () --- 324,333 ---- (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)) ;; `preserve-modes' avoids changing the (minor) modes. But we ;; do want to reset the mode for VC, so we do it manually. ! (when (or revert ! (and buffer-file-name ! (memq (vc-backend buffer-file-name) ! auto-revert-check-vc-numbers))) (vc-find-file-hook))))) (defun auto-revert-buffers () Diff finished. Tue Mar 30 19:36:33 2004 ============================================================