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

Re: color vs. folder-hook ???



On 2004-01-10, Michael D Schleif <mds@xxxxxxxxxxx> wrote:
> Is there some necessary precedence between folder-hook's and standalone
> color commands?
> 
> I use a non-trivial color setup in ~/.muttrc, which works as expected.
> When I do this:
> 
>    folder-hook cnn "color index blue default '~A'"
> 
> color is nowhere as I expect it -- even in folders without `cnn' in
> their label.  In other words, this folder-hook destroys all other
> colors, and interferes with other folder-hooks, as well.
> 
> What do you think?

It looks to me like it's doing what you told it to do.  When you
enter the cnn folder, the folder-hook is adding

    color index blue default '~A'

to the end of the list of color commands so that it is executed last
and therefore takes precedence over any earlier color commands.
Since the pattern matches every message, you should see every
message colored blue-on-default.  Unless you have another folder-
hook to undo this when you enter other folders, e.g.,

    folder-hook . "uncolor index '~A'"

this coloring will remain in effect forever after entering the cnn
folder.

If you want to change a low-priority color rule like that one when
you change folders, you'll have to put your other color commands in
folder-hooks, too.  I think your hooks will look something like
this:

    folder-hook . "uncolor index '~A'"
    folder-hook . "uncolor index <pattern A>"
    folder-hook . "uncolor index <pattern B>"
    folder-hook cnn "color index blue default '~A'"
    folder-hook xyz "color index green default '~A'"
    folder-hook . "color index <colors for A> <pattern A>"
    folder-hook . "color index <colors for B> <pattern B>"

HTH,
Gary

-- 
Gary Johnson                               | Agilent Technologies
garyjohn@xxxxxxxxxxxxxxx                   | Wireless Division
http://www.spocom.com/users/gjohnson/mutt/ | Spokane, Washington, USA