emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with latest CVS.


From: Luc Teirlinck
Subject: Re: Problems with latest CVS.
Date: Tue, 17 Feb 2004 10:47:31 -0600 (CST)

Eli Zaretskii wrote:

   At Richard's request, I installed yesterday several changes in
   autorevert.el, perhaps some of them cause these problems.

Yes they do cause the problems.  I installed a fix for the more urgent
part of the problem yesterday.  The patch below seems to fix the
second part of the problem.  Because the remaining problem only occurs
if `global-auto-revert-non-file-buffers' is non-nil and the default is
nil, fixing the remaining part of the problem is less urgent.  Hence, I
will let people take a look at it before installing.  I can install if
desired.  

Note that part of the patch, namely checking (buffer-modified-p), is,
in addition to the reasons already mentioned, also necessary to allow
auto-reverting dired buffers to co-exist with commands such as
dired-undo and the like.

In my own testing, the patch seems to work well and no significant
CPU-usage seems to occur, even after visiting tons of dired buffers.
My dired-listing-switches's value is "-AltF" and without the patch,
Emacs becomes essentially unusable (and chews up tons of CPU) if
`global-auto-revert-non-file-buffers' is set to t.

===File ~/autorevert-diff===================================
*** autorevert.el.~1.21.~       Mon Feb 16 20:04:45 2004
--- autorevert.el       Tue Feb 17 09:53:15 2004
***************
*** 283,312 ****
        (forward-line 1)))
      list))
  
- (defun auto-revert-dired-changed-p ()
-   "Check if dired buffer has changed."
-   (when (and (stringp dired-directory)
-            ;;   Exclude remote buffers, would be too slow for user
-            ;;   modem, timeouts, network lag ... all is possible
-            (not (string-match "@" dired-directory))
-            (file-directory-p dired-directory))
-     (let ((files (directory-files dired-directory))
-         (dired (auto-revert-dired-file-list)))
-       (or (not (eq (length files) (length dired)))
-         (auto-revert-list-diff files dired)))))
- 
  (defun auto-revert-buffer-p ()
    "Check if current buffer should be reverted."
!   ;;  - Always include dired buffers to list.  It would be too expensive
    ;;  to test the "revert" status here each time timer launches.
-   ;;  - Same for VC buffers.
    (or (and (eq major-mode 'dired-mode)
           (or (and global-auto-revert-mode
                    global-auto-revert-non-file-buffers)
!              auto-revert-mode))
!       (and (not (buffer-modified-p))
           (auto-revert-vc-buffer-p))
!       (and (not (buffer-modified-p))
           (if (buffer-file-name)
               (and (file-readable-p (buffer-file-name))
                    (not (verify-visited-file-modtime (current-buffer))))
--- 283,314 ----
        (forward-line 1)))
      list))
  
  (defun auto-revert-buffer-p ()
    "Check if current buffer should be reverted."
!   ;;  - Always include VC buffers to list.  It would be too expensive
    ;;  to test the "revert" status here each time timer launches.
    (or (and (eq major-mode 'dired-mode)
           (or (and global-auto-revert-mode
                    global-auto-revert-non-file-buffers)
!              auto-revert-mode)
!          (not (buffer-modified-p))
!          (stringp dired-directory)
!          ;; Exclude remote buffers, would be too slow for user
!          ;; modem, timeouts, network lag ... all is possible
!          (not (string-match "@" dired-directory))
!          (file-directory-p dired-directory)
!            (file-readable-p dired-directory)
!          (not (let ((attributes (file-attributes dired-directory))
!                     (modtime (visited-file-modtime)))
!                 (or (eq modtime 0)
!                     (not (eq (car attributes) t))
!                     (and (= (car (nth 5 attributes)) (car modtime))
!                          (= (nth 1 (nth 5 attributes)) (cdr modtime)))))))
!       (and (not (eq major-mode 'dired-mode))
!          (not (buffer-modified-p))
           (auto-revert-vc-buffer-p))
!       (and (not (eq major-mode 'dired-mode))
!          (not (buffer-modified-p))
           (if (buffer-file-name)
               (and (file-readable-p (buffer-file-name))
                    (not (verify-visited-file-modtime (current-buffer))))
***************
*** 375,382 ****
      (cond
       ((eq major-mode 'dired-mode)
        ;;  Dired includes revert-buffer-function
!       (when (and revert-buffer-function
!                (auto-revert-dired-changed-p))
        (setq revert t)))
       ((auto-revert-vc-buffer-p)
        (when (auto-revert-handler-vc)
--- 377,383 ----
      (cond
       ((eq major-mode 'dired-mode)
        ;;  Dired includes revert-buffer-function
!       (when revert-buffer-function
        (setq revert t)))
       ((auto-revert-vc-buffer-p)
        (when (auto-revert-handler-vc)
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]