aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-08-04 02:35:10 +0000
committerGlenn Morris2007-08-04 02:35:10 +0000
commitb1ab8c381057452c4ad8010c4da8be2ddfeed1cf (patch)
tree57aab4795e4fa7759538e55be39f36d2683876c1
parente9bfd3a3f9953520b99e4dac4cc0e59b6a9fc83c (diff)
downloademacs-b1ab8c381057452c4ad8010c4da8be2ddfeed1cf.tar.gz
emacs-b1ab8c381057452c4ad8010c4da8be2ddfeed1cf.zip
(auto-revert-tail-mode): auto-revert-tail-pos is zero, not nil, when
the library is first loaded. Check for a file that has been modified on disk.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/autorevert.el16
2 files changed, 26 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f1103f0e126..ca8741013f5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12007-08-04 Glenn Morris <rgm@gnu.org>
2
3 * autorevert.el (auto-revert-tail-mode): auto-revert-tail-pos is
4 zero, not nil, when the library is first loaded. Check for a file
5 that has been modified on disk.
6
7 * progmodes/cperl-mode.el (cperl-compilation-error-regexp-alist):
8 Remove duplicate defvar preventing initialization.
9 (cperl-mode): Fix compilation-error-regexp-alist-alist setting.
10
12007-08-03 Miles Bader <miles@gnu.org> 112007-08-03 Miles Bader <miles@gnu.org>
2 12
3 * vc-hooks.el (vc-handled-backends): Change capitalization of VC 13 * vc-hooks.el (vc-handled-backends): Change capitalization of VC
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 1f4ebc57b19..cad94e789d6 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -337,6 +337,22 @@ Use `auto-revert-mode' for changes other than appends!"
337 (not auto-revert-tail-pos) ; library was loaded only after finding file 337 (not auto-revert-tail-pos) ; library was loaded only after finding file
338 (not (y-or-n-p "Buffer is modified, so tail offset may be wrong. Proceed? "))) 338 (not (y-or-n-p "Buffer is modified, so tail offset may be wrong. Proceed? ")))
339 (auto-revert-tail-mode 0) 339 (auto-revert-tail-mode 0)
340 ;; a-r-tail-pos stores the size of the file at the time of the
341 ;; last revert. After this package loads, it adds a
342 ;; find-file-hook to set this variable every time a file is
343 ;; loaded. If the package is loaded only _after_ visiting the
344 ;; file to be reverted, then we have no idea what the value of
345 ;; a-r-tail-pos should have been when the file was visited. If
346 ;; the file has changed on disk in the meantime, all we can do
347 ;; is offer to revert the whole thing. If you choose not to
348 ;; revert, then you might miss some output then happened
349 ;; between visiting the file and activating a-r-t-mode.
350 (and (zerop auto-revert-tail-pos)
351 (not (verify-visited-file-modtime (current-buffer)))
352 (y-or-n-p "File changed on disk, content may be missing. \
353Perform a full revert? ")
354 ;; Use this (not just revert-buffer) for point-preservation.
355 (auto-revert-handler))
340 ;; else we might reappend our own end when we save 356 ;; else we might reappend our own end when we save
341 (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t) 357 (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t)
342 (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position 358 (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position