Gnus development mailing list
 help / color / mirror / Atom feed
* Highlight words in the subject line?
@ 2008-03-05 14:26 Bastien
  2008-03-06 14:02 ` Wes Hardaker
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2008-03-05 14:26 UTC (permalink / raw)
  To: ding

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] 6+ messages in thread

* Re: Highlight words in the subject line?
  2008-03-05 14:26 Highlight words in the subject line? Bastien
@ 2008-03-06 14:02 ` Wes Hardaker
  2008-03-06 14:29   ` Bastien
  2008-03-07 22:36   ` Reiner Steib
  0 siblings, 2 replies; 6+ messages in thread
From: Wes Hardaker @ 2008-03-06 14:02 UTC (permalink / raw)
  To: Bastien; +Cc: ding

>>>>> "B" == Bastien  <bzg@altern.org> writes:

B> I'm using this to highlight words in the subject line:

I think you want "gnus-highlight" from my page:

  http://www.hardakers.net/elisp/

Which lets you do things like this (a snippit of my list):

(setq gnus-article-highlight-expressions
      '(
	(".*autolearn=\\(hame\\|spam\\|no\\)"            . ((fg . "red1")))
	(".*BAYES_\\([0-9][0-9]\\)"            . ((bg . "#70e070")))
	(".*Subject: \\(.*\\)"            . ((fg . "red3")))
	))

For you the last one is the one you want...  put the words you're
looking for in the \(\) matches and it'll change to the color you requested.
-- 
"In the bathtub of history the truth is harder to hold than the soap,
 and much more difficult to find."  -- Terry Pratchett



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

* Re: Highlight words in the subject line?
  2008-03-06 14:02 ` Wes Hardaker
@ 2008-03-06 14:29   ` Bastien
  2008-03-07 20:38     ` Wes Hardaker
  2008-03-07 22:36   ` Reiner Steib
  1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2008-03-06 14:29 UTC (permalink / raw)
  To: Wes Hardaker; +Cc: ding

Wes Hardaker <wes@hardakers.net> writes:

> I think you want "gnus-highlight" from my page:
>
>   http://www.hardakers.net/elisp/

I had a look, sounds useful -- thanks.

Since I was not sure my message was posted to ding@gnus.org, I also sent
it to info-gnus-english@ and with help of Ted Z I came to this solution:

--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---

Which works fine.  I'll eventually check gnus-highlight.el for other
needs.  Thanks again,

-- 
Bastien



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

* Re: Highlight words in the subject line?
  2008-03-06 14:29   ` Bastien
@ 2008-03-07 20:38     ` Wes Hardaker
  0 siblings, 0 replies; 6+ messages in thread
From: Wes Hardaker @ 2008-03-07 20:38 UTC (permalink / raw)
  To: Bastien; +Cc: ding

>>>>> "B" == Bastien  <bzg@altern.org> writes:

>> I think you want "gnus-highlight" from my page:
>> 
>> http://www.hardakers.net/elisp/

B> I had a look, sounds useful -- thanks.

It's designed to be easy to use and can do summary and article
highlighting both, so it should be.
-- 
"In the bathtub of history the truth is harder to hold than the soap,
 and much more difficult to find."  -- Terry Pratchett



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

* Re: Highlight words in the subject line?
  2008-03-06 14:02 ` Wes Hardaker
  2008-03-06 14:29   ` Bastien
@ 2008-03-07 22:36   ` Reiner Steib
  2008-03-09  3:12     ` Wes Hardaker
  1 sibling, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2008-03-07 22:36 UTC (permalink / raw)
  To: ding

On Thu, Mar 06 2008, Wes Hardaker wrote:

> I think you want "gnus-highlight" from my page:
>   http://www.hardakers.net/elisp/

In 2004, we discussed to include it in Gnus.  I'd still like to
include it, but some issues have not been addressed yet.

,----[ http://article.gmane.org/gmane.emacs.gnus.general/56474 ]
| Some remarks and questions:
| 
| - `gnus-summary-highlight-expressions' and
|   `gnus-article-highlight-expressions' are declared with defcustom,
|   but cannot be customized (custom type declarations are missing).

This hasn't been addressed.  Any volunteer?

| - Could you run `M-x checkdoc RET' on the file and fix the style
|   errors?

There are some left, but I can fix those.
 
| - Shouldn't the initialization part (and *-treat-* variables) be moved
|   to `gnus-art.el' (or`gnus-sum.el')?

This can be done after the integration.
 
| - How about text for the manual (texi/gnus.texi) and the NEWS file
|   (texi/gnus-news.texi)?

We need text for the manual.  Something like the documentation of
`gnus-summary-highlight-expressions', at least.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Highlight words in the subject line?
  2008-03-07 22:36   ` Reiner Steib
@ 2008-03-09  3:12     ` Wes Hardaker
  0 siblings, 0 replies; 6+ messages in thread
From: Wes Hardaker @ 2008-03-09  3:12 UTC (permalink / raw)
  To: ding

>>>>> "RS" == Reiner Steib <reinersteib+gmane@imap.cc> writes:

RS> In 2004, we discussed to include it in Gnus.  I'd still like to
RS> include it, but some issues have not been addressed yet.

Yeah...  I'll take the blame for that.  I haven't had time to fix the
issues.

RS> | - `gnus-summary-highlight-expressions' and
RS> |   `gnus-article-highlight-expressions' are declared with defcustom,
RS> |   but cannot be customized (custom type declarations are missing).

RS> This hasn't been addressed.  Any volunteer?

Yep, they were place holders.  I do it via variables but knew eventually
they should be customs.

RS> | - Shouldn't the initialization part (and *-treat-* variables) be moved
RS> |   to `gnus-art.el' (or`gnus-sum.el')?

RS> This can be done after the integration.

Obviously, I can't do that easily.  I'd need to create a patch instead
of a separate file (which I haven't done).
 
RS> | - How about text for the manual (texi/gnus.texi) and the NEWS file
RS> |   (texi/gnus-news.texi)?

RS> We need text for the manual.  Something like the documentation of
RS> `gnus-summary-highlight-expressions', at least.

Ah, always documentation...  That's always the last thing to be done.
-- 
"In the bathtub of history the truth is harder to hold than the soap,
 and much more difficult to find."  -- Terry Pratchett



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

end of thread, other threads:[~2008-03-09  3:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 14:26 Highlight words in the subject line? Bastien
2008-03-06 14:02 ` Wes Hardaker
2008-03-06 14:29   ` Bastien
2008-03-07 20:38     ` Wes Hardaker
2008-03-07 22:36   ` Reiner Steib
2008-03-09  3:12     ` Wes Hardaker

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).