Refering to current message headers in mutt macros

Suvayu Ali fatkasuvayu+linux at gmail.com
Sun Aug 12 23:11:18 UTC 2012


Hello Heinz,

On Sun, Aug 12, 2012 at 11:29:37PM +0200, Heinz Diehl wrote:
> Hei,
> 
> On 12.08.2012, Suvayu Ali wrote: 
> 
> > I am trying to write a mutt macro where I need to refer to a header from
> > the current message.  The use case is something like this:
> [....]
> 
> I'm not quite shure what you want mutt to do in this case. Functions
> as e.g. "limit" can match on specific content of a message-id (~i),
> but I doubt you can extract the current message-id via pure mutt
> functionality (please correct me if I'm wrong).
> 

No I think you are correct; I was asking hoping that there might be a
way/hack known to other that would allow me to get that information.

> You could use a short python or perl-script to extract the message-id,
> e.g. something like this
> 
>  perl -ne '/^Message-Id:\s+(.*)/; print "$1\n";'
> 

How do I say, run that command on the current message (or pipe it)
inside the macro definition?

I am using a mutt fork with notmuch search integrtion.  This macro is to
search for all messages matching the same subject as the current
message.  E.g. I want something like the following as the macro:

"<vfolder-from-query>subject:\"`<shell-cmd> <cur-msg-file>`\"&limit=threads\n"

or,

"<vfolder-from-query>subject:\"`<pipe-cur-msg>|<shell-cmd>`\"&limit=threads\n"

In my case I have a sed oneliner as <shell-cmd>.  I hope that clarifies
what I'm attempting better.

Thanks a lot,

-- 
Suvayu

Open source is the future. It sets us free.


More information about the users mailing list