info-gnus-english
[Top][All Lists]
Advanced

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

Re: Highlight key words


From: Ted Zlatanov
Subject: Re: Highlight key words
Date: Tue, 17 Feb 2009 09:10:02 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

On Tue, 17 Feb 2009 17:53:37 +0800 poppyer <poppyer@gmail.com> wrote: 

p> If you are talking about put some color in some keywords within the
p> *Article* view, you can write a simply function using article-goto-body,
p> re-search-forward and put-text-property; and add into 
gnus-article-prepare-hook.

I do this as follows (suggested by someone else long ago, of course):

(defun tzz-highlighting-install ()
  (interactive)
  (font-lock-mode -1)
  (font-lock-mode 1)
  (font-lock-add-keywords
   nil
   `(
     ("\\(FIXME\\|TONOTE\\|TODO\\)" (1 'font-lock-warning-face prepend)))))

(dolist  (hook '(emacs-lisp-mode-hook
                 cperl-mode-hook
                 shell-mode-hook
                 text-mode-hook
                 change-log-mode-hook
                 makefile-mode-hook
                 message-mode-hook
                 texinfo-mode-hook))
  (add-hook hook 'tzz-highlighting-install))

Obviously the list of modes, the keywords, and the face can be
customized, but the basic idea is simple.

I forget why I turn font-lock-mode off and back on, it's been a while
and I forgot to comment it.

Ted


reply via email to

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