summaryrefslogtreecommitdiff
path: root/lisp/autorevert.el
diff options
context:
space:
mode:
authorLuc Teirlinck <teirllm@auburn.edu>2005-06-01 20:51:03 +0000
committerLuc Teirlinck <teirllm@auburn.edu>2005-06-01 20:51:03 +0000
commit33512cbeb168764f83f5a740090ce40b4b948591 (patch)
tree446e3d5b1582cd2a934c2a5b3f1dc1bf3b55f0f3 /lisp/autorevert.el
parentbfadb7ecfaf2b2daf18f7d694f05c6bb2080fa6a (diff)
downloademacs-33512cbeb168764f83f5a740090ce40b4b948591.tar.gz
(auto-revert-buffers): Use save-match-data.
Diffstat (limited to 'lisp/autorevert.el')
-rw-r--r--lisp/autorevert.el81
1 files changed, 41 insertions, 40 deletions
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 36b5a6f5a37..1769a992f7b 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -484,46 +484,47 @@ are checked first the next time this function is called.
This function is also responsible for removing buffers no longer in
Auto-Revert mode from `auto-revert-buffer-list', and for canceling
the timer when no buffers need to be checked."
- (let ((bufs (if global-auto-revert-mode
- (buffer-list)
- auto-revert-buffer-list))
- (remaining ())
- (new ()))
- ;; Partition `bufs' into two halves depending on whether or not
- ;; the buffers are in `auto-revert-remaining-buffers'. The two
- ;; halves are then re-joined with the "remaining" buffers at the
- ;; head of the list.
- (dolist (buf auto-revert-remaining-buffers)
- (if (memq buf bufs)
- (push buf remaining)))
- (dolist (buf bufs)
- (if (not (memq buf remaining))
- (push buf new)))
- (setq bufs (nreverse (nconc new remaining)))
- (while (and bufs
- (not (and auto-revert-stop-on-user-input
- (input-pending-p))))
- (let ((buf (car bufs)))
- (if (buffer-name buf) ; Buffer still alive?
- (with-current-buffer buf
- ;; Test if someone has turned off Auto-Revert Mode in a
- ;; non-standard way, for example by changing major mode.
- (if (and (not auto-revert-mode)
- (not auto-revert-tail-mode)
- (memq buf auto-revert-buffer-list))
- (setq auto-revert-buffer-list
- (delq buf auto-revert-buffer-list)))
- (when (auto-revert-active-p) (auto-revert-handler)))
- ;; Remove dead buffer from `auto-revert-buffer-list'.
- (setq auto-revert-buffer-list
- (delq buf auto-revert-buffer-list))))
- (setq bufs (cdr bufs)))
- (setq auto-revert-remaining-buffers bufs)
- ;; Check if we should cancel the timer.
- (when (and (not global-auto-revert-mode)
- (null auto-revert-buffer-list))
- (cancel-timer auto-revert-timer)
- (setq auto-revert-timer nil))))
+ (save-match-data
+ (let ((bufs (if global-auto-revert-mode
+ (buffer-list)
+ auto-revert-buffer-list))
+ (remaining ())
+ (new ()))
+ ;; Partition `bufs' into two halves depending on whether or not
+ ;; the buffers are in `auto-revert-remaining-buffers'. The two
+ ;; halves are then re-joined with the "remaining" buffers at the
+ ;; head of the list.
+ (dolist (buf auto-revert-remaining-buffers)
+ (if (memq buf bufs)
+ (push buf remaining)))
+ (dolist (buf bufs)
+ (if (not (memq buf remaining))
+ (push buf new)))
+ (setq bufs (nreverse (nconc new remaining)))
+ (while (and bufs
+ (not (and auto-revert-stop-on-user-input
+ (input-pending-p))))
+ (let ((buf (car bufs)))
+ (if (buffer-name buf) ; Buffer still alive?
+ (with-current-buffer buf
+ ;; Test if someone has turned off Auto-Revert Mode in a
+ ;; non-standard way, for example by changing major mode.
+ (if (and (not auto-revert-mode)
+ (not auto-revert-tail-mode)
+ (memq buf auto-revert-buffer-list))
+ (setq auto-revert-buffer-list
+ (delq buf auto-revert-buffer-list)))
+ (when (auto-revert-active-p) (auto-revert-handler)))
+ ;; Remove dead buffer from `auto-revert-buffer-list'.
+ (setq auto-revert-buffer-list
+ (delq buf auto-revert-buffer-list))))
+ (setq bufs (cdr bufs)))
+ (setq auto-revert-remaining-buffers bufs)
+ ;; Check if we should cancel the timer.
+ (when (and (not global-auto-revert-mode)
+ (null auto-revert-buffer-list))
+ (cancel-timer auto-revert-timer)
+ (setq auto-revert-timer nil)))))
;; The end: