* Re: Highlight words in the subject line?
[not found] ` <mailman.8351.1204732451.18990.info-gnus-english@gnu.org>
@ 2008-03-05 20:00 ` Ted Zlatanov
2008-03-05 23:17 ` Bastien
0 siblings, 1 reply; 3+ messages in thread
From: Ted Zlatanov @ 2008-03-05 20:00 UTC (permalink / raw)
To: info-gnus-english
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)
Well, with `G p' you can set any parameter AFAIK and then you can do , but to get the full
effect you can do (see gnus.el for examples)
(gnus-define-group-parameter
highlight-words
:function-document
"...."
:variable-document
"...."
:variable-group gnus-group-parameter
:parameter-type 'string
:parameter-document "\
...")
That will automatically give you the function call
(gnus-parameter-highlight-words group-name)
(end of digression)
The good news is, there's already a "Highlight words" group/topic
parameter in gnus-cus.el :)
It's not defined as I show above, so you need to look at
gnus-group-highlight-words-alist and gnus-emphasis-alist to get it
working:
...
(highlight-words
(choice :tag "Highlight words"
:value nil
(repeat (list (regexp :tag "Highlight regexp")
(number :tag "Group for entire word" 0)
(number :tag "Group for displayed part" 0)
(symbol :tag "Face"
gnus-emphasis-highlight-words))))
"highlight regexps.
See `gnus-emphasis-alist'.")
...
Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Highlight words in the subject line?
2008-03-05 20:00 ` Ted Zlatanov
@ 2008-03-05 23:17 ` Bastien
0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2008-03-05 23:17 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: info-gnus-english
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Highlight words in the subject line?
[not found] <87hcfli6w3.fsf@bzg.ath.cx>
@ 2008-03-05 15:53 ` Bastien
[not found] ` <mailman.8351.1204732451.18990.info-gnus-english@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2008-03-05 15:53 UTC (permalink / raw)
To: info-gnus-english
(I sent this to ding@gnus.org, but It seems down.)
Hi,
I'm using this to highlight words in the subject line:
,----
| (add-hook 'gnus-summary-prepared-hook 'highlight-my-words)
|
| (defun highlight-my-words nil
| "Highlight some words."
| (let (buffer-read-only)
| (save-excursion
| (goto-char (point-min))
| (while (re-search-forward "ducation\\|OLPC\\|wiki" nil t)
| (add-text-properties
| (match-beginning 0) (match-end 0)
| (list 'face my-summary-highlight-words)))))
| (setq buffer-read-only t))
|
| (setq my-summary-highlight-words '((t (:foreground "yellow"))))
`----
But this is only a workaround. It would be nice to have it implemented
in Gnus, maybe with a new group parameter: `highlight-summary-words'.
In the meanwhile, how can I access the group parameters from the
prepared summary, and use the value of highlight-words instead of a
default regexp?
Thanks for any pointer,
--
Bastien
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-05 23:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <87hcfli6w3.fsf@bzg.ath.cx>
2008-03-05 15:53 ` Highlight words in the subject line? Bastien
[not found] ` <mailman.8351.1204732451.18990.info-gnus-english@gnu.org>
2008-03-05 20:00 ` Ted Zlatanov
2008-03-05 23:17 ` Bastien
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).