help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Font-lock in .log file


From: Xah Lee
Subject: Re: Font-lock in .log file
Date: Thu, 17 Jan 2008 01:38:40 -0800 (PST)
User-agent: G2/1.0

Will wrote:
「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.
」


(defun highlite-it ()
"Highlight certain lines..."
(interactive)
(if (equal "log" (file-name-extension (buffer-file-name)))
    (progn
     (highlight-lines-matching-regexp "ERROR:" 'hi-red-b)
     (highlight-lines-matching-regexp "NOTE:" 'hi-blue-b)
    )
)
)

(add-hook 'find-file-hook 'highlite-it)

  Xah
  xah@xahlee.org
\xAD\xF4 http://xahlee.org/



reply via email to

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