<<< Date Index >>>     <<< Thread Index >>>

Re: setting colours with hooks



BTW - Please don't reply to another post if you want to start a new
thread.  Doing so really screws up the thread display, and many people
will never see your post if they're ignoring the thread you've decided
to hijack.  (Judging by the number of posts I've contributed to that
thread, I'm guessing it's being ignored by many on our list.)

Anyway, Hi :-)

On Sun, Dec 28, 2003 at 01:56:19AM +1100, Ricky Buchanan wrote:

> I want to set old messages to be a different colour in my index.
> Following the directions (or so I thought) (for Mutt 1.5.4i) I got this:
> 
> # Message > 1 month old
> message-hook '~d >1m'       'color index brightwhite black'
> # Message > 1 year old
> message-hook '~d >1y'       'color index brightred black'
> 
> Only it doesn't work.

Even if the regexp syntax were okay, it wouldn't do what you mean for
it to.  Message hooks are executed when you view messages matching the
regexps, so in your case (assuming your regexp were correctly formed),
the first one would get called every time you viewed a message older than
a month, and the second would get called every time you viewed a message
older than a year.  Each of them would attempt to change the color of the
index, except that you missed the regexp argument to the color statement,
so you'd get runtime errors every time you tried executing one of those
hooks (i.e., each time you viewed a message older than a month, and two
errors every time you viewed a message older than a year, since it'd
also be older than a month by implication).

> If I try to use it, with OR without the single
> quotes around the 'color' lines, I get errors on mutt startup and it
> doesn't happen.

One problem has to do with your regexp - "~d >1m" doesn't work; you need
"~d>1m" instead.  (Don't ask me why.)

The other problem has to do with the color statement, and Benoit already
pointed out how to fix that.

> What's the Proper Way to do this?

Benoit already pointed out the "Proper Way" to do what you're trying
to accomplish.

 - Dave

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpw2KiAPtK9P.pgp
Description: PGP signature