/[emacs]/emacs/lisp/autorevert.el
ViewVC logotype

Diff of /emacs/lisp/autorevert.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.49 by lute, Mon Apr 4 08:51:19 2005 UTC revision 1.50 by teirllm, Wed Jun 1 20:51:03 2005 UTC
# Line 484  are checked first the next time this fun Line 484  are checked first the next time this fun
484  This function is also responsible for removing buffers no longer in  This function is also responsible for removing buffers no longer in
485  Auto-Revert mode from `auto-revert-buffer-list', and for canceling  Auto-Revert mode from `auto-revert-buffer-list', and for canceling
486  the timer when no buffers need to be checked."  the timer when no buffers need to be checked."
487    (let ((bufs (if global-auto-revert-mode    (save-match-data
488                    (buffer-list)      (let ((bufs (if global-auto-revert-mode
489                  auto-revert-buffer-list))                      (buffer-list)
490          (remaining ())                    auto-revert-buffer-list))
491          (new ()))            (remaining ())
492      ;; Partition `bufs' into two halves depending on whether or not            (new ()))
493      ;; the buffers are in `auto-revert-remaining-buffers'.  The two        ;; Partition `bufs' into two halves depending on whether or not
494      ;; halves are then re-joined with the "remaining" buffers at the        ;; the buffers are in `auto-revert-remaining-buffers'.  The two
495      ;; head of the list.        ;; halves are then re-joined with the "remaining" buffers at the
496      (dolist (buf auto-revert-remaining-buffers)        ;; head of the list.
497        (if (memq buf bufs)        (dolist (buf auto-revert-remaining-buffers)
498            (push buf remaining)))          (if (memq buf bufs)
499      (dolist (buf bufs)              (push buf remaining)))
500        (if (not (memq buf remaining))        (dolist (buf bufs)
501            (push buf new)))          (if (not (memq buf remaining))
502      (setq bufs (nreverse (nconc new remaining)))              (push buf new)))
503      (while (and bufs        (setq bufs (nreverse (nconc new remaining)))
504                  (not (and auto-revert-stop-on-user-input        (while (and bufs
505                            (input-pending-p))))                    (not (and auto-revert-stop-on-user-input
506        (let ((buf (car bufs)))                              (input-pending-p))))
507          (if (buffer-name buf)           ; Buffer still alive?          (let ((buf (car bufs)))
508              (with-current-buffer buf            (if (buffer-name buf)         ; Buffer still alive?
509                ;; Test if someone has turned off Auto-Revert Mode in a                (with-current-buffer buf
510                ;; non-standard way, for example by changing major mode.                  ;; Test if someone has turned off Auto-Revert Mode in a
511                (if (and (not auto-revert-mode)                  ;; non-standard way, for example by changing major mode.
512                         (not auto-revert-tail-mode)                  (if (and (not auto-revert-mode)
513                         (memq buf auto-revert-buffer-list))                           (not auto-revert-tail-mode)
514                    (setq auto-revert-buffer-list                           (memq buf auto-revert-buffer-list))
515                          (delq buf auto-revert-buffer-list)))                      (setq auto-revert-buffer-list
516                (when (auto-revert-active-p) (auto-revert-handler)))                            (delq buf auto-revert-buffer-list)))
517            ;; Remove dead buffer from `auto-revert-buffer-list'.                  (when (auto-revert-active-p) (auto-revert-handler)))
518            (setq auto-revert-buffer-list              ;; Remove dead buffer from `auto-revert-buffer-list'.
519                  (delq buf auto-revert-buffer-list))))              (setq auto-revert-buffer-list
520        (setq bufs (cdr bufs)))                    (delq buf auto-revert-buffer-list))))
521      (setq auto-revert-remaining-buffers bufs)          (setq bufs (cdr bufs)))
522      ;; Check if we should cancel the timer.        (setq auto-revert-remaining-buffers bufs)
523      (when (and (not global-auto-revert-mode)        ;; Check if we should cancel the timer.
524                 (null auto-revert-buffer-list))        (when (and (not global-auto-revert-mode)
525        (cancel-timer auto-revert-timer)                   (null auto-revert-buffer-list))
526        (setq auto-revert-timer nil))))          (cancel-timer auto-revert-timer)
527            (setq auto-revert-timer nil)))))
528    
529    
530  ;; The end:  ;; The end:

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26