Mercurial > emacs
changeset 62957:e8139030a8a9
(auto-revert-buffers): Use save-match-data.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Wed, 01 Jun 2005 20:51:03 +0000 |
parents | 1cad4b59ad28 |
children | a8aa893e7e77 |
files | lisp/autorevert.el |
diffstat | 1 files changed, 41 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- 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: