I can get you part of the way, but someone else will have to help with the last 
part (if it's possible at all).

I have mutt set up to use a different index_format on a per-message basis, so 
that I can see more detailed time information for messages that are newer, and 
courser and courser as the message gets older.  For example, '  4:41pm' for a 
message less than a day old, up to '01/20/22' for a message over 30 days old.

I do this by adding this line to .muttrc:
set index_format="/home/edgewood/.mutt/bin/format_date '%[%s]' '%1<%s>' |"

That sets the index_format for each individual message by running the 
format_date command and passing information from the message, in this case the 
datetime of the message in epoch seconds, and the current datetime in epoch 
seconds.

The command then prints a different index command depending on the difference 
between them.

(Note, it looks like http://www.mutt.org/doc/manual/#index-format-hook is the 
modern way to do this.)

You could do this:
set index_format="/path/to/format_subject '%s' |"

That command would need to examine the passed subject, and print something 
different depending on what it was.

But that's where I run out of ideas.  I don't *think* you can embed ANSI color 
commands in the index format, and I don't know of a way to run shell commands 
in the pattern for color commands.

Maybe this inspires someone else that can get you closer.

Ed

On Thu, Jul 07, 2022 at 04:40:26PM +0300, dm1...@gmail.com wrote:
> Hi all,
> 
> I have some messages with a subject line containing the "due:[here
> goes some date]" text. I want mutt to color these messages differently
> and dynamically (at every opening or refreshing the mailbox) according
> to whether the date in the subject is in the past or the future
> compared with the current date.
> Is it possible to accomplish?
> 
> It would be nice to enchance the "todo.txt" approach with the "to-do
> mailbox" advantages :-)
> 
> Best,
> 
> --
> Dmitry

-- 
Ed Blackman

Reply via email to