summaryrefslogtreecommitdiff
path: root/lisp/autorevert.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-07-06 12:58:16 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-07-06 12:58:16 +0000
commitddd7c238540f6e8365d45408f8560d32db1e4510 (patch)
tree7df372c4ab3e798ec1fd9c52535189709412da4c /lisp/autorevert.el
parent9ae06d96f6c1a35ef6c663165b226af7ea6ecfc4 (diff)
downloademacs-ddd7c238540f6e8365d45408f8560d32db1e4510.tar.gz
(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.
Diffstat (limited to 'lisp/autorevert.el')
-rw-r--r--lisp/autorevert.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 170ca4b88c2..3831d7c1c05 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -447,20 +447,21 @@ This is an internal function used by Auto-Revert Mode."
(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 @@ the timer when no buffers need to be checked."
(run-hooks 'auto-revert-load-hook)
-;;; arch-tag: f6bcb07b-4841-477e-9e44-b18678e58876
+;; arch-tag: f6bcb07b-4841-477e-9e44-b18678e58876
;;; autorevert.el ends here