Re: Color headers in pager based on message patterns

2018-02-07 Thread Cameron Simpson

On 07Feb2018 20:35, Scott Kostyshak  wrote:

Example (untested):

 message-hook . 'set my_hdr_colour=green'
 message-hook ~p!~l 'set my_hdr_colour=yellow'
 message-hook . 'color header $my_hdr_colour default'

so that a colour is chosen per message, then applied to your settings.


I think that does the trick! I had to change the last of the three hooks
to be the following (note the dot at the end):

 message-hook . 'color header $my_hdr_colour default .'


Ah, yes.


Thank you very much for taking the time to understand what I was trying
to achieve, and for the helpful solution, Cameron.


Glad to be of service,
Cameron Simpson  (formerly c...@zip.com.au)

All the doors in this ship have nice sunny dispositions. It is their
pleasure to open for you, and their satisfaction to close with the knowledge
of a job well done. - Marvin _The Hitchhiker's Guide to the Galaxy_


Re: Color headers in pager based on message patterns

2018-02-07 Thread Scott Kostyshak
On Wed, Feb 07, 2018 at 10:00:33PM +, Cameron Simpson wrote:
> On 07Feb2018 01:05, Scott Kostyshak  wrote:
> > I would like to color all header lines in the pager if a message pattern
> > matches.
> > 
> > As an example, I can use the following to color the index if a message
> > was sent to me and not sent to a list:
> > 
> >  color index yellow black ~p!~l
> > 
> > But I cannot do the following:
> > 
> >  color header yellow black ~p!~l
> > 
> > to color all headers in the pager if a message was sent to me and not
> > sent to a list. This is understandable, as the pattern is matched
> > against each header.
> > 
> > As for why I would like to do this, I rarely look at the index. I
> > configure mutt to go directly to the pager, so that I focus on one email
> > at a time. However, I find the message pattern matching useful so I
> > would like to be able to use them to color headers in the pager.
> > 
> > Is it possible to use the message pattern mechanism to color headers
> > showing in the pager?
> 
> Yes, you need to be a little indirect.
> 
> My setup has these lines:
> 
>  color header $colour_hl1 default "^(from|subject):"
>  color header $colour_hl1 default "^(x-spam-status):"
> 
> Where $colour_hl1 happens to be cyan. What you want to do is, instead of
> defining your header rules once, define them per message via a message-hook.
> Example (untested):
> 
>  message-hook . 'set my_hdr_colour=green'
>  message-hook ~p!~l 'set my_hdr_colour=yellow'
>  message-hook . 'color header $my_hdr_colour default'
> 
> so that a colour is chosen per message, then applied to your settings.
> 
> Cheers,
> Cameron Simpson  (formerly c...@zip.com.au)

I think that does the trick! I had to change the last of the three hooks
to be the following (note the dot at the end):

  message-hook . 'color header $my_hdr_colour default .'

Thank you very much for taking the time to understand what I was trying
to achieve, and for the helpful solution, Cameron.

Best,

Scott


-- 
Scott Kostyshak
Assistant Professor of Economics
University of Florida
https://people.clas.ufl.edu/skostyshak/



Re: Color headers in pager based on message patterns

2018-02-07 Thread Cameron Simpson

On 07Feb2018 01:05, Scott Kostyshak  wrote:

I would like to color all header lines in the pager if a message pattern
matches.

As an example, I can use the following to color the index if a message
was sent to me and not sent to a list:

 color index yellow black ~p!~l

But I cannot do the following:

 color header yellow black ~p!~l

to color all headers in the pager if a message was sent to me and not
sent to a list. This is understandable, as the pattern is matched
against each header.

As for why I would like to do this, I rarely look at the index. I
configure mutt to go directly to the pager, so that I focus on one email
at a time. However, I find the message pattern matching useful so I
would like to be able to use them to color headers in the pager.

Is it possible to use the message pattern mechanism to color headers
showing in the pager?


Yes, you need to be a little indirect.

My setup has these lines:

 color header $colour_hl1 default "^(from|subject):"
 color header $colour_hl1 default "^(x-spam-status):"

Where $colour_hl1 happens to be cyan. What you want to do is, instead of 
defining your header rules once, define them per message via a message-hook.  
Example (untested):


 message-hook . 'set my_hdr_colour=green'
 message-hook ~p!~l 'set my_hdr_colour=yellow'
 message-hook . 'color header $my_hdr_colour default'

so that a colour is chosen per message, then applied to your settings.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)


Color headers in pager based on message patterns

2018-02-06 Thread Scott Kostyshak
I would like to color all header lines in the pager if a message pattern
matches.

As an example, I can use the following to color the index if a message
was sent to me and not sent to a list:

  color index yellow black ~p!~l

But I cannot do the following:

  color header yellow black ~p!~l

to color all headers in the pager if a message was sent to me and not
sent to a list. This is understandable, as the pattern is matched
against each header.

As for why I would like to do this, I rarely look at the index. I
configure mutt to go directly to the pager, so that I focus on one email
at a time. However, I find the message pattern matching useful so I
would like to be able to use them to color headers in the pager.

Is it possible to use the message pattern mechanism to color headers
showing in the pager?

Thanks,

Scott


-- 
Scott Kostyshak
Assistant Professor of Economics
University of Florida
https://people.clas.ufl.edu/skostyshak/