# HG changeset patch # User Luc Teirlinck # Date 1117659063 0 # Node ID e8139030a8a940f993a350be3fd744875d63c522 # Parent 1cad4b59ad285aa14ee5f4a59330ef1b27a29e9b (auto-revert-buffers): Use save-match-data. diff -r 1cad4b59ad28 -r e8139030a8a9 lisp/autorevert.el --- a/lisp/autorevert.el Wed Jun 01 20:50:06 2005 +0000 +++ b/lisp/autorevert.el Wed Jun 01 20:51:03 2005 +0000 @@ -484,46 +484,47 @@ 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: