changeset 81721:59741e45a674

(auto-revert-tail-handler): Use inhibit-read-only. Run before-revert-hook. Suggested by Denis Bueno <denbuen@sandia.gov>. Use run-hooks rather than run-mode-hooks.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 06 Jul 2007 12:58:16 +0000
parents 72f269f335c9
children 8215e5c92612
files lisp/ChangeLog lisp/autorevert.el
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jul 06 03:58:00 2007 +0000
+++ b/lisp/ChangeLog	Fri Jul 06 12:58:16 2007 +0000
@@ -1,3 +1,9 @@
+2007-07-06  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* autorevert.el (auto-revert-tail-handler): Use inhibit-read-only.
+	Run before-revert-hook.  Suggested by Denis Bueno <denbuen@sandia.gov>.
+	Use run-hooks rather than run-mode-hooks.
+
 2007-07-05  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc/calc-comb.el (math-random-digit): Rename to
@@ -16,8 +22,8 @@
 
 2007-07-05  Chong Yidong  <cyd@stupidchicken.com>
 
-	* wid-edit.el (widget-documentation-string-value-create): Insert
-	indentation spaces.
+	* wid-edit.el (widget-documentation-string-value-create):
+	Insert indentation spaces.
 
 2007-07-05  Thien-Thi Nguyen  <ttn@gnuvola.org>
 
--- a/lisp/autorevert.el	Fri Jul 06 03:58:00 2007 +0000
+++ b/lisp/autorevert.el	Fri Jul 06 12:58:16 2007 +0000
@@ -447,20 +447,21 @@
 (defun auto-revert-tail-handler ()
   (let ((size (nth 7 (file-attributes buffer-file-name)))
 	(modified (buffer-modified-p))
-	buffer-read-only		; ignore
+	(inhibit-read-only t)		; Ignore.
 	(file buffer-file-name)
-	buffer-file-name)		; ignore that file has changed
+	(buffer-file-name nil))		; Ignore that file has changed.
     (when (> size auto-revert-tail-pos)
+      (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)))
-      (run-mode-hooks 'after-revert-hook)
+      (run-hooks 'after-revert-hook)
       (undo-boundary)
       (setq auto-revert-tail-pos size)
-      (set-buffer-modified-p modified)))
+      (restore-buffer-modified-p modified)))
   (set-visited-file-modtime))
 
 (defun auto-revert-buffers ()
@@ -534,5 +535,5 @@
 
 (run-hooks 'auto-revert-load-hook)
 
-;;; arch-tag: f6bcb07b-4841-477e-9e44-b18678e58876
+;; arch-tag: f6bcb07b-4841-477e-9e44-b18678e58876
 ;;; autorevert.el ends here