Hi xing!

On Di, 25 Dez 2012, xing wrote:

> I'd like to set up a macro which will set the <limit> to all mail sent
> by the selected message sender.
> 
> I've looked in the docs and searched the web and can't find any
> information on how to expand something like ~f in a macro. Is this
> possible at all?

There is no easy way to extract the email address from a selected entry. 
What I have done, is pipe the entry through a script that uses formail 
to extract the senders email address and returns a command that can be 
used by mutt to limit the index to messages by that sender. It sounds 
cumbersome, but works well enough:


macro index A "<enter-command>unset wait_key<enter><pipe-message>\
~/bin/mutt_address.sh ~/temp/mutt_source.txt<enter><enter-command>\
set wait_key<enter><enter-command>source ~/temp/mutt_source.txt<enter>" "limit 
message view by selected author"


,----[ mutt_address.sh ]-
| #!/bin/sh
| 
| FORM=`which formail`
| ARGS="`cat`"
| 
| # The sed statement will cut out only the relevant part from
| # the e-mail address between (e.g. for "Foo" <foo....@foobar.xyz> it 
| # will only print foo\.bar@foobar\.xyz) and will also translate
| # allowed characters like "." or "+" by escaping them
| OUTPUT=`echo "${ARGS}"|"${FORM}" -tzx "From:" | sed 
's/.*<//;s/>//;s/\./\\\\\\\\&/g;s/+/\\\\\\\\\\\\\\\\&/g'`  
| if [ -n "$1" ]; then
|     TEMP="$1"
|     exec >"${TEMP}" || { echo "Could not output to $1, exiting..." &&  exit 
1; }
| 
|     cat <<EOF
| push "<limit>~f \"${OUTPUT}\"<enter>"
| EOF
| else
|     echo "You must supply a filename in which to store the result!" && exit 2
| fi
`----


regards,
Christian
-- 

Reply via email to