summaryrefslogtreecommitdiff
path: root/lisp/autorevert.el
diff options
context:
space:
mode:
authorLuc Teirlinck <teirllm@auburn.edu>2004-03-21 00:30:12 +0000
committerLuc Teirlinck <teirllm@auburn.edu>2004-03-21 00:30:12 +0000
commita2ac68f1ee4d388206e852388b62e647f3cc0910 (patch)
tree83c758f3ff480f1723e016d0dbe902c50f4cf2dd /lisp/autorevert.el
parente8a84b6c3a220110ea9a9209782ccc674918e49d (diff)
downloademacs-a2ac68f1ee4d388206e852388b62e647f3cc0910.tar.gz
(auto-revert-interval): Make new value take effect immediately when
set through Custom. (auto-revert-set-timer): Add interactive declaration.
Diffstat (limited to 'lisp/autorevert.el')
-rw-r--r--lisp/autorevert.el26
1 files changed, 19 insertions, 7 deletions
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index b1f0d7b7bfa..c2620a1940e 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -103,13 +103,27 @@ Global Auto-Revert Mode applies to all buffers."
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.
-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."
+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 'integer)
+ :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."
@@ -191,9 +205,6 @@ buffers to this list.
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.")
@@ -242,6 +253,7 @@ Use `auto-revert-mode' to revert a particular buffer."
(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