aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/autorevert.el22
2 files changed, 20 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 61a2109bc04..12eabe46e5a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12007-09-30 David Kastrup <dak@gnu.org> 12007-09-30 David Kastrup <dak@gnu.org>
2 2
3 * autorevert.el (auto-revert-handler): In `auto-revert-tail-mode',
4 check only for changed size.
5 (auto-revert-tail-handler): Get size from caller. If the file has
6 shrunk, tail the whole file again (the file presumably has been
7 rewritten).
8
3 * woman.el (woman-topic-all-completions, woman-mini-help): Fix 9 * woman.el (woman-topic-all-completions, woman-mini-help): Fix
4 fallout from 2007-09-07 introduction of `dolist' when the list 10 fallout from 2007-09-07 introduction of `dolist' when the list
5 actually was being manipulated in the loop. 11 actually was being manipulated in the loop.
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index f1e5b146058..49e83c514a9 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -416,12 +416,16 @@ will use an up-to-date value of `auto-revert-interval'"
416 "Revert current buffer, if appropriate. 416 "Revert current buffer, if appropriate.
417This is an internal function used by Auto-Revert Mode." 417This is an internal function used by Auto-Revert Mode."
418 (when (or auto-revert-tail-mode (not (buffer-modified-p))) 418 (when (or auto-revert-tail-mode (not (buffer-modified-p)))
419 (let* ((buffer (current-buffer)) 419 (let* ((buffer (current-buffer)) size
420 (revert 420 (revert
421 (or (and buffer-file-name 421 (or (and buffer-file-name
422 (not (file-remote-p buffer-file-name)) 422 (not (file-remote-p buffer-file-name))
423 (file-readable-p buffer-file-name) 423 (file-readable-p buffer-file-name)
424 (not (verify-visited-file-modtime buffer))) 424 (if auto-revert-tail-mode
425 (/= auto-revert-tail-pos
426 (setq size
427 (nth 7 (file-attributes buffer-file-name))))
428 (not (verify-visited-file-modtime buffer))))
425 (and (or auto-revert-mode 429 (and (or auto-revert-mode
426 global-auto-revert-non-file-buffers) 430 global-auto-revert-non-file-buffers)
427 revert-buffer-function 431 revert-buffer-function
@@ -445,7 +449,7 @@ This is an internal function used by Auto-Revert Mode."
445 (push window eoblist))) 449 (push window eoblist)))
446 'no-mini t)) 450 'no-mini t))
447 (if auto-revert-tail-mode 451 (if auto-revert-tail-mode
448 (auto-revert-tail-handler) 452 (auto-revert-tail-handler size)
449 ;; Bind buffer-read-only in case user has done C-x C-q, 453 ;; Bind buffer-read-only in case user has done C-x C-q,
450 ;; so as not to forget that. This gives undesirable results 454 ;; so as not to forget that. This gives undesirable results
451 ;; when the file's mode changes, but that is less common. 455 ;; when the file's mode changes, but that is less common.
@@ -460,20 +464,22 @@ This is an internal function used by Auto-Revert Mode."
460 (when (or revert auto-revert-check-vc-info) 464 (when (or revert auto-revert-check-vc-info)
461 (vc-find-file-hook))))) 465 (vc-find-file-hook)))))
462 466
463(defun auto-revert-tail-handler () 467(defun auto-revert-tail-handler (size)
464 (let ((size (nth 7 (file-attributes buffer-file-name))) 468 (let ((modified (buffer-modified-p))
465 (modified (buffer-modified-p))
466 (inhibit-read-only t) ; Ignore. 469 (inhibit-read-only t) ; Ignore.
467 (file buffer-file-name) 470 (file buffer-file-name)
468 (buffer-file-name nil)) ; Ignore that file has changed. 471 (buffer-file-name nil)) ; Ignore that file has changed.
469 (when (> size auto-revert-tail-pos) 472 (when (/= auto-revert-tail-pos size)
470 (run-hooks 'before-revert-hook) 473 (run-hooks 'before-revert-hook)
471 (undo-boundary) 474 (undo-boundary)
472 (save-restriction 475 (save-restriction
473 (widen) 476 (widen)
474 (save-excursion 477 (save-excursion
475 (goto-char (point-max)) 478 (goto-char (point-max))
476 (insert-file-contents file nil auto-revert-tail-pos size))) 479 (insert-file-contents file nil
480 (and (< auto-revert-tail-pos size)
481 auto-revert-tail-pos)
482 size)))
477 (run-hooks 'after-revert-hook) 483 (run-hooks 'after-revert-hook)
478 (undo-boundary) 484 (undo-boundary)
479 (setq auto-revert-tail-pos size) 485 (setq auto-revert-tail-pos size)