all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Font-lock in .log file
@ 2008-01-16 15:12 Will
  2008-01-17  9:38 ` Xah Lee
  2008-01-17 10:48 ` Niels Giesen
  0 siblings, 2 replies; 3+ messages in thread
From: Will @ 2008-01-16 15:12 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Thanks for help in advance,

Will

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Font-lock in .log file
  2008-01-16 15:12 Font-lock in .log file Will
@ 2008-01-17  9:38 ` Xah Lee
  2008-01-17 10:48 ` Niels Giesen
  1 sibling, 0 replies; 3+ messages in thread
From: Xah Lee @ 2008-01-17  9:38 UTC (permalink / raw)
  To: help-gnu-emacs

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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Font-lock in .log file
  2008-01-16 15:12 Font-lock in .log file Will
  2008-01-17  9:38 ` Xah Lee
@ 2008-01-17 10:48 ` Niels Giesen
  1 sibling, 0 replies; 3+ messages in thread
From: Niels Giesen @ 2008-01-17 10:48 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-17 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-16 15:12 Font-lock in .log file Will
2008-01-17  9:38 ` Xah Lee
2008-01-17 10:48 ` Niels Giesen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.