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: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/autorevert.el,v
Date: Sat, 04 Aug 2007 02:31:36 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       07/08/04 02:31:36

Index: autorevert.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/autorevert.el,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- autorevert.el       26 Jul 2007 05:26:17 -0000      1.60
+++ autorevert.el       4 Aug 2007 02:31:36 -0000       1.61
@@ -334,9 +334,25 @@
       (auto-revert-tail-mode 0)
       (error "This buffer is not visiting a file"))
     (if (and (buffer-modified-p)
-            (not auto-revert-tail-pos) ; library was loaded only after finding 
file
+            (zerop auto-revert-tail-pos) ; library was loaded only after 
finding file
             (not (y-or-n-p "Buffer is modified, so tail offset may be wrong.  
Proceed? ")))
        (auto-revert-tail-mode 0)
+      ;; a-r-tail-pos stores the size of the file at the time of the
+      ;; last revert. After this package loads, it adds a
+      ;; find-file-hook to set this variable every time a file is
+      ;; loaded.  If the package is loaded only _after_ visiting the
+      ;; file to be reverted, then we have no idea what the value of
+      ;; a-r-tail-pos should have been when the file was visited.  If
+      ;; the file has changed on disk in the meantime, all we can do
+      ;; is offer to revert the whole thing. If you choose not to
+      ;; revert, then you might miss some output then happened
+      ;; between visiting the file and activating a-r-t-mode.
+      (and (zerop auto-revert-tail-pos)
+           (not (verify-visited-file-modtime (current-buffer)))
+           (y-or-n-p "File changed on disk, content may be missing.  \
+Perform a full revert? ")
+           ;; Use this (not just revert-buffer) for point-preservation.
+           (auto-revert-handler))
       ;; else we might reappend our own end when we save
       (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t)
       (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position




reply via email to

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