emacs-devel
[Top][All Lists]
Advanced

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

Re: Tramp with global-auto-revert-mode.


From: Stefan Monnier
Subject: Re: Tramp with global-auto-revert-mode.
Date: 14 May 2004 00:16:49 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> I believe that the freezes are not an Emacs or Tramp bug, but the
> inevitable result of a slow connection.  Hence we need a user option
> to deal with them.

If C-g does not get you out of the hang, it's a bug.
As I said, the with-local-quit should be put in Tramp.
You might be right that auto-reverting remote files needs to be turned off
or customizable, but the problems you're experiencing could also be
triggered by other packages than auto-revert, so we should fix them.

Among all the problems, one of them is actually in autorevert.el:
the auto-revert timer should not be re-run if it hasn't finished running
yet.  One way to do that is to not use a repeating timer, but instead to
reset the timer manually at the end of auto-revert-buffers.  Another is to
bind auto-revert-running to t in auto-revert-buffers and check it before
running, as in the patch below.  A third option is to do this kind of
re-entrance-check directly in the C code.


        Stefan


--- orig/lisp/autorevert.el
+++ mod/lisp/autorevert.el
@@ -1,6 +1,6 @@
 ;;; autorevert.el --- revert buffers when files on disk change
 
-;; Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 98, 1999, 2001, 2004  Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren <address@hidden>
 ;; Keywords: convenience
@@ -343,7 +343,7 @@
       ;; do want to reset the mode for VC, so we do it manually.
       (when (or revert auto-revert-check-vc-info)
        (vc-find-file-hook)))))
-
+(defvar auto-revert-running nil)
 (defun auto-revert-buffers ()
   "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode.
 
@@ -367,9 +367,13 @@
 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."
+  (if auto-revert-running
+      ;; Don't re-run if we're not finished executing the previous run.
+      nil
   (let ((bufs (if global-auto-revert-mode
                  (buffer-list)
                auto-revert-buffer-list))
+       (auto-revert-running t)
        (remaining '())
        (new '()))
     ;; Partition `bufs' into two halves depending on whether or not
@@ -405,7 +409,7 @@
     (when (and (not global-auto-revert-mode)
               (null auto-revert-buffer-list))
       (cancel-timer auto-revert-timer)
-      (setq auto-revert-timer nil))))
+      (setq auto-revert-timer nil)))))
 
 
 ;; The end:




reply via email to

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