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

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

Re: Highlight words in the subject line?


From: Bastien
Subject: Re: Highlight words in the subject line?
Date: Wed, 05 Mar 2008 23:17:27 +0000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Wed, 05 Mar 2008 15:53:41 +0000 Bastien <bzg@altern.org> wrote: 
>
> B> In the meanwhile, how can I access the group parameters from the
> B> prepared summary, and use the value of highlight-words instead of a
> B> default regexp?
>
> (Gnus hacking digression)

[...Great!...]

> (end of digression)

So finally the code is this:

--8<---------------cut here---------------start------------->8---
(add-hook 'gnus-summary-prepared-hook 'bzg-gnus-hl-sum-words)

(defun bzg-gnust-hl-sum-words nil
  "Highlight words in the summary buffer."
  (let* ((group gnus-newsgroup-name)
         (hl-words
          (gnus-group-fast-parameter group 'highlight-words t))
         buffer-read-only hl-word)
    (dolist (hlw hl-words)
      (save-excursion
        (goto-char (point-min))
        (while (re-search-forward (car hlw) nil t)
          (add-text-properties
           (match-beginning 0) (match-end 0)
           (list 'face (car (reverse hlw)))))))
    (setq buffer-read-only t)))
--8<---------------cut here---------------end--------------->8---

So that I spot the important message in the summary buffer depending on
the group parameter.  Neat.  Thanks again,

-- 
Bastien




reply via email to

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