emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for lisp/autorevert.el


From: Denis Bueno
Subject: Patch for lisp/autorevert.el
Date: Mon, 27 Nov 2006 19:28:35 -0500

I would expect `auto-revert-tail-mode' to run `after-revert-hook'
after it reverts the buffer, on an append. Currently it doesn't. The
patch I've included [1] fixes that.

Would anyone consider installing this?

I use it to run the following hook, in my .emacs:

;; In auto-revert mode, after reverting, if font-lock is turned on,
;; fontify the buffer. I intend for this to re-fontify my buffers when they
;; revert and I'm using hi-lock-mode.
(require 'autorevert)
(add-hook 'after-revert-hook
         (lambda ()
           (if (and font-lock-mode
                    (boundp 'hi-lock-mode)
                    hi-lock-mode)
               (progn
                 (message "Re-fontifying buffer...")
                 (font-lock-fontify-buffer)))))


This keeps highlighting terms as they get appended to a log file being
tailed by `auto-revert-tail-mode'.

-Denis

[1]
$ cdiff lisp/autorevert.el
Index: lisp/autorevert.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/autorevert.el,v
retrieving revision 1.55
diff -u -r1.55 autorevert.el
--- lisp/autorevert.el  6 May 2006 14:38:07 -0000       1.55
+++ lisp/autorevert.el  28 Nov 2006 00:24:29 -0000
@@ -457,6 +457,7 @@
       (save-excursion
         (goto-char (point-max))
         (insert-file-contents file nil auto-revert-tail-pos size)))
+      (run-mode-hooks 'after-revert-hook)
      (undo-boundary)
      (setq auto-revert-tail-pos size)
      (set-buffer-modified-p modified)))




reply via email to

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