Mercurial > emacs
comparison lisp/autorevert.el @ 54609:b35a0c2934f9
(auto-revert-verbose, global-auto-revert-non-file-buffers)
(global-auto-revert-mode, auto-revert-set-timer)
(auto-revert-handler, auto-revert-buffers): Doc fixes.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Sun, 28 Mar 2004 03:56:53 +0000 |
parents | 959316c3db53 |
children | ce6a58ba4c84 |
comparison
equal
deleted
inserted
replaced
54608:9c5d02cd28b1 | 54609:b35a0c2934f9 |
---|---|
130 :group 'auto-revert | 130 :group 'auto-revert |
131 :type 'boolean) | 131 :type 'boolean) |
132 | 132 |
133 (defcustom auto-revert-verbose t | 133 (defcustom auto-revert-verbose t |
134 "When nil, Auto-Revert Mode will not generate any messages. | 134 "When nil, Auto-Revert Mode will not generate any messages. |
135 | 135 When non-nil, a message is generated whenever a file is reverted." |
136 Currently, messages are generated when the mode is activated or | |
137 deactivated, and whenever a file is reverted." | |
138 :group 'auto-revert | 136 :group 'auto-revert |
139 :type 'boolean) | 137 :type 'boolean) |
140 | 138 |
141 (defcustom auto-revert-mode-text " ARev" | 139 (defcustom auto-revert-mode-text " ARev" |
142 "String to display in the mode line when Auto-Revert Mode is active. | 140 "String to display in the mode line when Auto-Revert Mode is active. |
168 | 166 |
169 (defcustom global-auto-revert-non-file-buffers nil | 167 (defcustom global-auto-revert-non-file-buffers nil |
170 "When nil only file buffers are reverted by Global Auto-Revert Mode. | 168 "When nil only file buffers are reverted by Global Auto-Revert Mode. |
171 | 169 |
172 When non-nil, both file buffers and buffers with a custom | 170 When non-nil, both file buffers and buffers with a custom |
173 `revert-buffer-function' are reverted by Global Auto-Revert Mode. | 171 `revert-buffer-function' and a `buffer-stale-function' are |
172 reverted by Global Auto-Revert Mode. | |
174 | 173 |
175 Use this option with care since it could lead to excessive reverts. | 174 Use this option with care since it could lead to excessive reverts. |
176 Note also that for some non-file buffers the check whether the | 175 Note also that for some non-file buffers the check whether the |
177 buffer needs updating may be imperfect, due to efficiency | 176 buffer needs updating may be imperfect, due to efficiency |
178 considerations, and may not take all information listed in the | 177 considerations, and may not take all information listed in the |
242 (auto-revert-mode 1)) | 241 (auto-revert-mode 1)) |
243 | 242 |
244 | 243 |
245 ;;;###autoload | 244 ;;;###autoload |
246 (define-minor-mode global-auto-revert-mode | 245 (define-minor-mode global-auto-revert-mode |
247 "Revert any buffer when file on disk change. | 246 "Revert any buffer when file on disk changes. |
248 | 247 |
249 With arg, turn Auto Revert mode on globally if and only if arg is positive. | 248 With arg, turn Auto Revert mode on globally if and only if arg is positive. |
250 This is a minor mode that affects all buffers. | 249 This is a minor mode that affects all buffers. |
251 Use `auto-revert-mode' to revert a particular buffer." | 250 Use `auto-revert-mode' to revert a particular buffer." |
252 :global t :group 'auto-revert :lighter global-auto-revert-mode-text | 251 :global t :group 'auto-revert :lighter global-auto-revert-mode-text |
254 (when global-auto-revert-mode | 253 (when global-auto-revert-mode |
255 (auto-revert-buffers))) | 254 (auto-revert-buffers))) |
256 | 255 |
257 | 256 |
258 (defun auto-revert-set-timer () | 257 (defun auto-revert-set-timer () |
259 "Restart or cancel the timer." | 258 "Restart or cancel the timer used by Auto-Revert Mode. |
259 If such a timer is running, cancel it. Start a new timer if | |
260 Global Auto-Revert Mode is active or if Auto-Revert Mode is active | |
261 in some buffer. Restarting the timer ensures that Auto-Revert Mode | |
262 will use an up-to-date value of `auto-revert-interval'" | |
260 (interactive) | 263 (interactive) |
261 (if (timerp auto-revert-timer) | 264 (if (timerp auto-revert-timer) |
262 (cancel-timer auto-revert-timer)) | 265 (cancel-timer auto-revert-timer)) |
263 (setq auto-revert-timer | 266 (setq auto-revert-timer |
264 (if (or global-auto-revert-mode auto-revert-buffer-list) | 267 (if (or global-auto-revert-mode auto-revert-buffer-list) |
329 ((eq backend 'RCS) | 332 ((eq backend 'RCS) |
330 ;; TODO: | 333 ;; TODO: |
331 )))))) | 334 )))))) |
332 | 335 |
333 (defun auto-revert-handler () | 336 (defun auto-revert-handler () |
334 "Revert current buffer." | 337 "Revert current buffer, if appropriate. |
338 This is an internal function used by Auto-Revert Mode." | |
335 (unless (buffer-modified-p) | 339 (unless (buffer-modified-p) |
336 (let (revert) | 340 (let (revert) |
337 (cond | 341 (cond |
338 ((auto-revert-vc-buffer-p) | 342 ((auto-revert-vc-buffer-p) |
339 (when (auto-revert-handler-vc) | 343 (when (auto-revert-handler-vc) |
363 Should `global-auto-revert-mode' be active all file buffers are checked. | 367 Should `global-auto-revert-mode' be active all file buffers are checked. |
364 | 368 |
365 Should `auto-revert-mode' be active in some buffers, those buffers | 369 Should `auto-revert-mode' be active in some buffers, those buffers |
366 are checked. | 370 are checked. |
367 | 371 |
368 Non-file buffers that have a custom `revert-buffer-function' are | 372 Non-file buffers that have a custom `revert-buffer-function' and |
369 reverted either when Auto-Revert Mode is active in that buffer, or | 373 a `buffer-stale-function' are reverted either when Auto-Revert |
370 when the variable `global-auto-revert-non-file-buffers' is non-nil | 374 Mode is active in that buffer, or when the variable |
371 and Global Auto-Revert Mode is active. | 375 `global-auto-revert-non-file-buffers' is non-nil and Global |
376 Auto-Revert Mode is active. | |
372 | 377 |
373 This function stops whenever there is user input. The buffers not | 378 This function stops whenever there is user input. The buffers not |
374 checked are stored in the variable `auto-revert-remaining-buffers'. | 379 checked are stored in the variable `auto-revert-remaining-buffers'. |
375 | 380 |
376 To avoid starvation, the buffers in `auto-revert-remaining-buffers' | 381 To avoid starvation, the buffers in `auto-revert-remaining-buffers' |