* Alexandre on Monday, January 19, 2009 at 15:45:16 +0100 > i am using mairix and would like to improve a mutt macro: > > # Mairix > macro generic f "<shell-escape>mairix " "search via mairix" > # Load the results mailbox > macro generic ,f "<change-folder><kill-line>=xmairix<enter>" "load the search > results mailbox" > > In fact, i would like to have only one macro which search via mairix and > which load the search results after. > > Do you have any idea how i could do that?
I have the following in muttrc: macro index,pager ,m "\ <enter-command> set my_wait_key=\$wait_key wait_key=no<enter>\ <shell-escape> mutt/mairixquery.sh<enter>\ <enter-command> set wait_key=\$my_wait_key &my_wait_key<enter>\ <change-folder>+Special/_mairix<enter>" "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>+Special/_mairix<enter>" "mairix query" And mairixquery.sh looks like so: #!/bin/sh threads= augment= yorn() { local ans printf "$1 (yes/[no]) " read -e ans case "$ans" in y*|Y*) return 0;; *) return 1;; esac } printf "Enter mairix query:\n" read -e query [ -n "$query" ] || exit 0 yorn "Retrieve thread(s)?" && threads="--threads" yorn "Append message(s) to mfolder?" && augment="--augment" mairix $threads $augment "$query" The biggest shortcoming is that when you cancel, mutt still opens the mairix mailbox. But perhaps some of the gurus here have a solution for that. c -- \black\trash movie _C O W B O Y_ _C A N O E_ _C O M A_ Ein deutscher Western/A German Western -->> http://www.blacktrash.org/underdogma/ccc.html -->> http://www.blacktrash.org/underdogma/ccc-en.html