* Refontifying after revert in hi-lock-mode
@ 2006-11-22 0:24 Denis Bueno
0 siblings, 0 replies; 2+ messages in thread
From: Denis Bueno @ 2006-11-22 0:24 UTC (permalink / raw)
I would like a synergy between auto-revert-tail-mode and hi-lock-mode.
I frequently tail log files, and would like live updates of
highlighted terms in those log files. In my Emacs (GNU Emacs 22.0.90.2
(powerpc-apple-darwin8.8.0, Carbon Version 1.6.0) of 2006-11-11 on
ford.local), after a revert performed by auto-revert-tail-mode, I
would like any new terms matching active regexps to be highlighted.
But they aren't.
I tried the following hook, it my .emacs, and I'm not quite sure why it fails:
,----
| ;; 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 font-lock-mode
| (progn
| (message "Re-fontifying buffer...")
| (font-lock-fontify-buffer)))
| (message "dbueno's after-revert-hook finished.")))
`----
I looked into autorevert.el to verify that auto-revert-tail-mode
indeed uses `revert-buffer', so, I think that hook should be executed.
I figured that maybe there was a `revert-buffer-function' in use when
`revert-buffer' is called, which (as the doc for `revert-buffer' says:
"If the value of `revert-buffer-function' is non-nil, it is called to
do all the work for this command. Otherwise, the hooks
`before-revert-hook' and `after-revert-hook' are run at the beginning
and the end, and if `revert-buffer-insert-file-contents-function' is
non-nil, it is called instead of rereading visited file contents."
Does anyone know why my hook wouldn't run? and if so, how I can fix it?
Thanks in advance.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Refontifying after revert in hi-lock-mode
[not found] <mailman.967.1164155084.2155.help-gnu-emacs@gnu.org>
@ 2006-11-23 17:57 ` Robert Thorpe
0 siblings, 0 replies; 2+ messages in thread
From: Robert Thorpe @ 2006-11-23 17:57 UTC (permalink / raw)
Denis Bueno wrote:
> I would like a synergy between auto-revert-tail-mode and hi-lock-mode.
> I frequently tail log files, and would like live updates of
> highlighted terms in those log files. In my Emacs (GNU Emacs 22.0.90.2
> (powerpc-apple-darwin8.8.0, Carbon Version 1.6.0) of 2006-11-11 on
> ford.local), after a revert performed by auto-revert-tail-mode, I
> would like any new terms matching active regexps to be highlighted.
> But they aren't.
>
> I tried the following hook, it my .emacs, and I'm not quite sure why it fails:
>
> ,----
> | ;; 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 font-lock-mode
> | (progn
> | (message "Re-fontifying buffer...")
> | (font-lock-fontify-buffer)))
> | (message "dbueno's after-revert-hook finished.")))
> `----
>
> I looked into autorevert.el to verify that auto-revert-tail-mode
> indeed uses `revert-buffer', so, I think that hook should be executed.
> I figured that maybe there was a `revert-buffer-function' in use when
> `revert-buffer' is called, which (as the doc for `revert-buffer' says:
>
> "If the value of `revert-buffer-function' is non-nil, it is called to
> do all the work for this command. Otherwise, the hooks
> `before-revert-hook' and `after-revert-hook' are run at the beginning
> and the end, and if `revert-buffer-insert-file-contents-function' is
> non-nil, it is called instead of rereading visited file contents."
>
> Does anyone know why my hook wouldn't run? and if so, how I can fix it?
Looks like it should to me. I think you need to check that it isn't.
Instead of emitting a message at the end that could be wiped over by a
subsequent message try setting a variable, or look in the *Messages*
buffer.
In the bit starting (if font-lock-mode... note
The variable font-lock-mode is strange, even if you have
global-font-lock-mode set to t the global variable font-lock-mode will
stay nil. So the code will work if you're in the right context when it
is executed, but not otherwise.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-23 17:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.967.1164155084.2155.help-gnu-emacs@gnu.org>
2006-11-23 17:57 ` Refontifying after revert in hi-lock-mode Robert Thorpe
2006-11-22 0:24 Denis Bueno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).