On Sat, Apr 30, 2011 at 02:12:51AM +0100, Christian Ebert wrote:

Hi Christian,

this is exactly what I wanted.
Thanks very much!

ST


> > I have a question regarding macros in mutt. Currently I use these two
> > macros for searching:
> > 
> > macro generic ,f "<shell-escape>mairix " "search via mairix"
> > macro generic ,,f "<change-folder><kill-line>=search<enter>" "load the 
> > search results mailbox"
> > 
> > Can I optimize it in the way that after finishing the search with ,f -
> > the result mailbox is automatically loaded?
> > 
> > Is searching / indexing with mairix state of the art or is there a
> > better solution available? I am quite happy with that, just wanted to
> > ask ;-).
> 
> I use the following shell script for interactive mairix search
> from within mutt; it also makes a rudimentary attempt to search
> using a fallback charset for non-ascii strings.
> 
> 
> #!/bin/sh
> 
> threads=
> augment=
> charset="`printf '%s' "$LANG" | cut -d . -f 2`"
> fallback="windows-1252"
> 
> yorn() {
>     local ans
>     printf '%s %s ' "$1" "(yes/[no])"
>     read -e ans
>     case "$ans" in
>         y*|Y*) return 0;;
>         *) return 1;;
>     esac
> }
> 
> printf '%s\n' "Enter mairix query:"
> read -e query
> test -z "$query" && exit 0
> 
> yorn "Retrieve thread(s)?" && threads="--threads"
> yorn "Append message(s) to mfolder?" && augment="--augment"
> 
> query=`echo "$query" | iconv -f "$charset" -t UTF-8`
> mairix $threads $augment $query
> 
> queryx=`echo "$query" | iconv -f "$charset" -t "$fallback"`
> if [ "$queryx" != "$query" ]; then
>     echo "trying $fallback"
>     mairix $threads --augment $queryx
> fi
> 
> 
> muttrc:
> 
> set my_mairixfolder=`awk -F '=' '/^mfolder/ { print $2 }' ~/.mairixrc`
> 
> macro index,pager ,m "\
> <enter-command> set my_wait_key=\$wait_key wait_key=no<enter>\
> <shell-escape> mairixquery.sh<enter>\
> <enter-command> set wait_key=\$my_wait_key &my_wait_key<enter>\
> <change-folder>+$my_mairixfolder" "mairix query"
> 
> macro browser ,m "\
> <enter-command> set my_wait_key=\$wait_key wait_key=no<enter>\
> <shell-escape> mairixquery.sh<enter>\
> <enter-command> set wait_key=\$my_wait_key &my_wait_key<enter>\
> <exit><change-folder>+$my_mairixfolder" "mairix query"
> 
> 
> For reverse detection of the original mails I recommend muttjump:
> 
> https://github.com/weisslj/muttjump
> 
> c

-- 
Sebastian Tramp
WebID: http://sebastian.tramp.name

Reply via email to