diff options
| author | Luc Teirlinck | 2004-03-21 00:30:12 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-03-21 00:30:12 +0000 |
| commit | a2ac68f1ee4d388206e852388b62e647f3cc0910 (patch) | |
| tree | 83c758f3ff480f1723e016d0dbe902c50f4cf2dd | |
| parent | e8a84b6c3a220110ea9a9209782ccc674918e49d (diff) | |
| download | emacs-a2ac68f1ee4d388206e852388b62e647f3cc0910.tar.gz emacs-a2ac68f1ee4d388206e852388b62e647f3cc0910.zip | |
(auto-revert-interval): Make new value take effect immediately when
set through Custom.
(auto-revert-set-timer): Add interactive declaration.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/autorevert.el | 26 |
2 files changed, 25 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f9ad6ef801d..f0cb0af79c9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2004-03-20 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * autorevert.el (auto-revert-interval): Make new value take | ||
| 4 | effect immediately when set through Custom. | ||
| 5 | (auto-revert-set-timer): Add interactive declaration. | ||
| 6 | |||
| 1 | 2004-03-19 David Ponce <david@dponce.com> | 7 | 2004-03-19 David Ponce <david@dponce.com> |
| 2 | 8 | ||
| 3 | * ruler-mode.el (ruler-mode-header-line-format-old): Don't | 9 | * ruler-mode.el (ruler-mode-header-line-format-old): Don't |
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." | |||
| 103 | Never set this variable directly, use the command `auto-revert-mode' instead.") | 103 | Never set this variable directly, use the command `auto-revert-mode' instead.") |
| 104 | (put 'auto-revert-mode 'permanent-local t) | 104 | (put 'auto-revert-mode 'permanent-local t) |
| 105 | 105 | ||
| 106 | (defvar auto-revert-timer nil | ||
| 107 | "Timer used by Auto-Revert Mode.") | ||
| 108 | |||
| 106 | (defcustom auto-revert-interval 5 | 109 | (defcustom auto-revert-interval 5 |
| 107 | "Time, in seconds, between Auto-Revert Mode file checks. | 110 | "Time, in seconds, between Auto-Revert Mode file checks. |
| 108 | Setting this variable has no effect on buffers that are already in | 111 | The value may be an integer or floating point number. |
| 109 | auto-revert-mode; it only affects buffers that are put into | 112 | |
| 110 | auto-revert-mode afterwards." | 113 | If a timer is already active, there are two ways to make sure |
| 114 | that the new value will take effect immediately. You can set | ||
| 115 | this variable through Custom or you can call the command | ||
| 116 | `auto-revert-set-timer' after setting the variable. Otherwise, | ||
| 117 | the new value will take effect the first time Auto Revert Mode | ||
| 118 | calls `auto-revert-set-timer' for internal reasons or in your | ||
| 119 | next editing session." | ||
| 111 | :group 'auto-revert | 120 | :group 'auto-revert |
| 112 | :type 'integer) | 121 | :type 'number |
| 122 | :set (lambda (variable value) | ||
| 123 | (set-default variable value) | ||
| 124 | (and (boundp 'auto-revert-timer) | ||
| 125 | auto-revert-timer | ||
| 126 | (auto-revert-set-timer)))) | ||
| 113 | 127 | ||
| 114 | (defcustom auto-revert-stop-on-user-input t | 128 | (defcustom auto-revert-stop-on-user-input t |
| 115 | "When non-nil Auto-Revert Mode stops checking files on user input." | 129 | "When non-nil Auto-Revert Mode stops checking files on user input." |
| @@ -191,9 +205,6 @@ buffers to this list. | |||
| 191 | The timer function `auto-revert-buffers' is responsible for purging | 205 | The timer function `auto-revert-buffers' is responsible for purging |
| 192 | the list of old buffers.") | 206 | the list of old buffers.") |
| 193 | 207 | ||
| 194 | (defvar auto-revert-timer nil | ||
| 195 | "Timer used by Auto-Revert Mode.") | ||
| 196 | |||
| 197 | (defvar auto-revert-remaining-buffers '() | 208 | (defvar auto-revert-remaining-buffers '() |
| 198 | "Buffers not checked when user input stopped execution.") | 209 | "Buffers not checked when user input stopped execution.") |
| 199 | 210 | ||
| @@ -242,6 +253,7 @@ Use `auto-revert-mode' to revert a particular buffer." | |||
| 242 | 253 | ||
| 243 | (defun auto-revert-set-timer () | 254 | (defun auto-revert-set-timer () |
| 244 | "Restart or cancel the timer." | 255 | "Restart or cancel the timer." |
| 256 | (interactive) | ||
| 245 | (if (timerp auto-revert-timer) | 257 | (if (timerp auto-revert-timer) |
| 246 | (cancel-timer auto-revert-timer)) | 258 | (cancel-timer auto-revert-timer)) |
| 247 | (setq auto-revert-timer | 259 | (setq auto-revert-timer |