changeset 104126:5170ba97b7f8

* autorevert.el (auto-revert-handler): Allow `auto-revert-tail-mode' for remote files.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 02 Aug 2009 17:20:39 +0000
parents fd4d8124e329
children bd19355318cc
files lisp/autorevert.el
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/autorevert.el	Sun Aug 02 17:16:39 2009 +0000
+++ b/lisp/autorevert.el	Sun Aug 02 17:20:39 2009 +0000
@@ -66,6 +66,7 @@
 ;; change by growing at the end.  It only appends the new output,
 ;; instead of reverting the entire buffer.  It does so even if the
 ;; buffer contains unsaved changes.  (Because they will not be lost.)
+;; Auto Revert Tail Mode works also for remote files.
 
 ;; Usage:
 ;;
@@ -432,13 +433,18 @@
     (let* ((buffer (current-buffer)) size
 	   (revert
 	    (or (and buffer-file-name
-		     (not (file-remote-p buffer-file-name))
 		     (file-readable-p buffer-file-name)
 		     (if auto-revert-tail-mode
-			 (/= auto-revert-tail-pos
-			    (setq size
-				  (nth 7 (file-attributes buffer-file-name))))
-		       (not (verify-visited-file-modtime buffer))))
+			 ;; Tramp caches the file attributes.  Setting
+			 ;; `tramp-cache-inhibit' forces Tramp to
+			 ;; reread the values.
+			 (let ((tramp-cache-inhibit-cache t))
+			   (/= auto-revert-tail-pos
+			       (setq size
+				     (nth 7 (file-attributes
+					     buffer-file-name)))))
+		       (and (not (file-remote-p buffer-file-name))
+			    (not (verify-visited-file-modtime buffer)))))
 		(and (or auto-revert-mode
 			 global-auto-revert-non-file-buffers)
 		     revert-buffer-function
@@ -477,7 +483,7 @@
       (when (or revert auto-revert-check-vc-info)
 	(vc-find-file-hook)))))
 
-(defun auto-revert-tail-handler (size)  
+(defun auto-revert-tail-handler (size)
   (let ((modified (buffer-modified-p))
 	(inhibit-read-only t)		; Ignore.
 	(file buffer-file-name)