emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/autorevert.el,v


From: David Kastrup
Subject: [Emacs-diffs] Changes to emacs/lisp/autorevert.el,v
Date: Sun, 30 Sep 2007 20:26:56 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     David Kastrup <dak>     07/09/30 20:26:56

Index: autorevert.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/autorevert.el,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- autorevert.el       13 Aug 2007 13:41:01 -0000      1.62
+++ autorevert.el       30 Sep 2007 20:26:54 -0000      1.63
@@ -416,12 +416,16 @@
   "Revert current buffer, if appropriate.
 This is an internal function used by Auto-Revert Mode."
   (when (or auto-revert-tail-mode (not (buffer-modified-p)))
-    (let* ((buffer (current-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)
-                    (not (verify-visited-file-modtime buffer)))
+                    (if auto-revert-tail-mode
+                        (/= auto-revert-tail-pos
+                           (setq size
+                                 (nth 7 (file-attributes buffer-file-name))))
+                      (not (verify-visited-file-modtime buffer))))
                (and (or auto-revert-mode
                         global-auto-revert-non-file-buffers)
                     revert-buffer-function
@@ -445,7 +449,7 @@
                    (push window eoblist)))
           'no-mini t))
        (if auto-revert-tail-mode
-           (auto-revert-tail-handler)
+           (auto-revert-tail-handler size)
          ;; Bind buffer-read-only in case user has done C-x C-q,
          ;; so as not to forget that.  This gives undesirable results
          ;; when the file's mode changes, but that is less common.
@@ -460,20 +464,22 @@
       (when (or revert auto-revert-check-vc-info)
        (vc-find-file-hook)))))
 
-(defun auto-revert-tail-handler ()
-  (let ((size (nth 7 (file-attributes buffer-file-name)))
-       (modified (buffer-modified-p))
+(defun auto-revert-tail-handler (size)  
+  (let ((modified (buffer-modified-p))
        (inhibit-read-only t)           ; Ignore.
        (file buffer-file-name)
        (buffer-file-name nil))         ; Ignore that file has changed.
-    (when (> size auto-revert-tail-pos)
+    (when (/= auto-revert-tail-pos size)
       (run-hooks 'before-revert-hook)
       (undo-boundary)
       (save-restriction
        (widen)
        (save-excursion
          (goto-char (point-max))
-         (insert-file-contents file nil auto-revert-tail-pos size)))
+         (insert-file-contents file nil
+                               (and (< auto-revert-tail-pos size)
+                                    auto-revert-tail-pos)
+                               size)))
       (run-hooks 'after-revert-hook)
       (undo-boundary)
       (setq auto-revert-tail-pos size)




reply via email to

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