Thanks a lot David,

I went for approach B. It's not pretty but it works.

Here is how i implemented my dynamic filter:

macro index ,f '<pipe-message>formail -c -x From: | perl -pe 
"s/.*<([\w\.]+@[\w\.]+\w+)>.*/push \"\<limit\> ~f \$1 \<enter\>\"/" > 
~/tmp/header<enter>:source ~/tmp/header<enter>'

On 28/10/12 15:14, David Champion wrote:
> * On 28 Oct 2012, Alexis Letessier wrote: 
> > Hello,
> > 
> > When on the index view, i would like to build a dynamic filter with
> > parameters from the current mail under the pointer.  For example i would
> > like to limit the display to all threads where the current person has
> > been involved in.
> > 
> > Is there a way to do that?
> 
> Yes, but it's not convenient or pretty.  There are two appraoches which
> are roughly equivalent:
> 
> Approach A. Your macro should:
> 
> 1. save the current e-mail to a well-known location
> 2. source a program -- that is, use "source" with a pipe at the end
>    in order to treat the program's output as muttrc commands.
> 
> The program that you source would:
> a. parse the e-mail that was saved to a well-known location
> b. use the details thus learned to construct muttrc commands that do what
>    you want.
> 
> 
> Appraoch B is an inverse, in a way.  Your macro should:
> 
> 1. Pipe the message to a program.
> 2. Source a muttrc from a well-known location.
> 
> The program that you pipe to would:
> a. parse the e-mail that appears in stdin
> b. use the details thus learned to construct muttrc commands, which it
>    saves to a well-known location.

-- 
Alexis

Attachment: signature.asc
Description: Digital signature

Reply via email to