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.el Date: Thu, 4 Mar 2004 22:25:42 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200403050425.i254PgP21754@raven.dms.auburn.edu> References: <200403022319.i22NJbG01259@raven.dms.auburn.edu> <200403040508.i2458W811551@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1078762622 8702 80.91.224.253 (8 Mar 2004 16:17:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Mar 2004 16:17:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Mar 08 17:16:54 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 1B0NR0-0007Zo-00 for ; Mon, 08 Mar 2004 17:16:54 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B0NQz-00004v-00 for ; Mon, 08 Mar 2004 17:16:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B0NNr-0000Yw-Vs for emacs-devel@quimby.gnus.org; Mon, 08 Mar 2004 11:13:39 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1Az6vk-00021j-13 for emacs-devel@gnu.org; Thu, 04 Mar 2004 23:27:24 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1Az6vD-0001mw-JJ for emacs-devel@gnu.org; Thu, 04 Mar 2004 23:27:23 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Az6vD-0001mt-Ai for emacs-devel@gnu.org; Thu, 04 Mar 2004 23:26:51 -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 i254QlKt013839; Thu, 4 Mar 2004 22:26:47 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i254PgP21754; Thu, 4 Mar 2004 22:25:42 -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 04 Mar 2004 15:43:40 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 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:20270 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20270 While looking at autorevert.el I noticed another problem. The docstring of `auto-revert-interval' is wrong. It says that setting the variable will apply to buffers put in auto-revert mode afterwards, but not to buffers already in auto-revert mode. That would be bad enough if it were true, but the actual behavior is worse. The new value does not apply to _any_ buffers until Auto Revert mode calls `auto-revert-set-timer' for internal reasons, after which it applies to _all_ buffers. This is hyper-confusing and makes no sense. If I remember well, then back in December or so, when this first came up, you remarked that the behavior, rather than the docstring should be changed, but apparently the opposite was done. I did not realize at the time how bad the actual behavior really was, nor that the new docstring was wrong. Below is a patch mending the situation. Are there any objections against me applying this patch? While trying out my patch, I noticed another problem, however. The new value will take effect immediately when set through Custom, but not when set via `set-variable' (unless the user does `M-x auto-revert-set-timer' afterwards). Yet back in November we reached pretty much a consensus on the following conclusion (quoting Richard): So I guess we have to keep set-variable separate. However, when it operates on a variable that is customizable, and when the binding it sets is a global binding, then it could work through the Custom mechanism. This does not seem to have been implemented. Is anybody currently working or planning to work on this? ===File ~/autorevert-timer-diff============================= diff -c /home/teirllm/autorevert-pretimer.el /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el *** /home/teirllm/autorevert-pretimer.el Thu Mar 4 17:21:53 2004 --- /home/teirllm/emacscvsdir/emacs/lisp/autorevert.el Thu Mar 4 20:38:13 2004 *************** *** 103,115 **** Never set this variable directly, use the command `auto-revert-mode' instead.") (put 'auto-revert-mode 'permanent-local t) (defcustom auto-revert-interval 5 "Time, in seconds, between Auto-Revert Mode file checks. ! Setting this variable has no effect on buffers that are already in ! auto-revert-mode; it only affects buffers that are put into ! auto-revert-mode afterwards." ! :group 'auto-revert ! :type 'integer) (defcustom auto-revert-stop-on-user-input t "When non-nil Auto-Revert Mode stops checking files on user input." --- 103,129 ---- Never set this variable directly, use the command `auto-revert-mode' instead.") (put 'auto-revert-mode 'permanent-local t) + (defvar auto-revert-timer nil + "Timer used by Auto-Revert Mode.") + (defcustom auto-revert-interval 5 "Time, in seconds, between Auto-Revert Mode file checks. ! The value may be an integer or floating point number. ! ! If a timer is already active, there are two ways to make sure ! that the new value will take effect immediately. You can set ! this variable through Custom or you can call the command ! `auto-revert-set-timer' after setting the variable. Otherwise, ! the new value will take effect the first time Auto Revert Mode ! calls `auto-revert-set-timer' for internal reasons or in your ! next editing session." ! :group 'auto-revert ! :type 'number ! :set (lambda (variable value) ! (set-default variable value) ! (and (boundp 'auto-revert-timer) ! auto-revert-timer ! (auto-revert-set-timer)))) (defcustom auto-revert-stop-on-user-input t "When non-nil Auto-Revert Mode stops checking files on user input." *************** *** 205,213 **** The timer function `auto-revert-buffers' is responsible for purging the list of old buffers.") - (defvar auto-revert-timer nil - "Timer used by Auto-Revert Mode.") - (defvar auto-revert-remaining-buffers '() "Buffers not checked when user input stopped execution.") --- 219,224 ---- *************** *** 256,261 **** --- 267,273 ---- (defun auto-revert-set-timer () "Restart or cancel the timer." + (interactive) (if (timerp auto-revert-timer) (cancel-timer auto-revert-timer)) (setq auto-revert-timer Diff finished. Thu Mar 4 21:14:43 2004 ============================================================