;;; autorevert.el --- revert buffers when files on disk change
-;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2011 Free Software Foundation, Inc.
;; Author: Anders Lindgren <andersl@andersl.com>
;; Keywords: convenience
;; 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:
;;
;;; What's this?: ;; Autoload for the benefit of `make-mode-line-mouse-sensitive'.
;;; What's this?: ;;;###autoload
(defvar auto-revert-mode nil
- "*Non-nil when Auto-Revert Mode is active.
+ "Non-nil when Auto-Revert Mode is active.
Never set this variable directly, use the command `auto-revert-mode' instead.")
(put 'auto-revert-mode 'permanent-local t)
(defvar auto-revert-tail-mode nil
- "*Non-nil when Auto-Revert Tail Mode is active.
+ "Non-nil when Auto-Revert Tail Mode is active.
Never set this variable directly, use the command
`auto-revert-tail-mode' instead.")
(put 'auto-revert-tail-mode 'permanent-local t)
:version "22.1")
(defvar global-auto-revert-ignore-buffer nil
- "*When non-nil, Global Auto-Revert Mode will not revert this buffer.
-
+ "When non-nil, Global Auto-Revert Mode will not revert this buffer.
This variable becomes buffer local when set in any fashion.")
(make-variable-buffer-local 'global-auto-revert-ignore-buffer)
(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
+ ;; `remote-file-name-inhibit-cache' forces Tramp
+ ;; to reread the values.
+ (let ((remote-file-name-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
(when buffer-file-name
(setq eob (eobp))
(walk-windows
- #'(lambda (window)
- (and (eq (window-buffer window) buffer)
- (= (window-point window) (point-max))
- (push window eoblist)))
+ (lambda (window)
+ (and (eq (window-buffer window) buffer)
+ (= (window-point window) (point-max))
+ (push window eoblist)))
'no-mini t))
(if auto-revert-tail-mode
(auto-revert-tail-handler size)
(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)
(run-hooks 'auto-revert-load-hook)
-;; arch-tag: f6bcb07b-4841-477e-9e44-b18678e58876
;;; autorevert.el ends here