[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Font-lock in .log file
From: |
Niels Giesen |
Subject: |
Re: Font-lock in .log file |
Date: |
Thu, 17 Jan 2008 11:48:58 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Will <schimpanski@gmx.de> writes:
> Hi,
>
> i'd like to highlight lines containing "Error:" in red and lines containing
> "Note:" in blue every time a xxx.log file is opened or a xxx.log buffer is
> reverted from a file.
>
> Currently I am using the functions
> (highlight-lines-matching-regexp "ERROR:" 'hi-red-b)
> (highlight-lines-matching-regexp "NOTE:" 'hi-blue-b)
> but I don't know to what hook I should add them.
>
> Does anybody have an idea?
>
look at find-file-hook and after-revert-hook
does something like
(add-hook 'find-file-hook
(lambda ()
(when (and (buffer-file-name)
(string-match "\\.log\\'" (buffer-file-name)))
(highlight-lines-matching-regexp "ERROR:" 'hi-red-b)
(highlight-lines-matching-regexp "NOTE:" 'hi-blue-b))))
work for you?
> Thanks for help in advance,
>
> Will
--
http://niels.kicks-ass.org