On Sat, Oct 22, 2011 at 04:12:31PM +0800, stardiviner wrote:
> Is there a way to combine bellowing two macros into one macro ?
> Because I find it is not convenient that press F8 to search with type
> and then press F9 to view result.  I hope press one key, after type
> search string. then directly jump to result.
> 
> macro index <F8> "<shell-escape>mu find --clearlinks --format=links 
> --linksdir=~/.mutt/mails/Search " "mu find"
> macro index <F9> "<change-folder-readonly>=Search" "mu find results"
> 
> This example can do this. I have not complete combining even I tried
> many times.  macro index,pager,browser ,f
> "<toggle-write><shell-escape>~/.mutt/scripts/mymairix<enter><change-folder>=Search<enter><sort>t<delete-pattern>~=<enter>"

I have the following macro configured for mu searches:

macro index,pager \CS "<shell-escape>[[ -d ~/.mu/results ]] && rm -r 
~/.mu/results; mkdir -p ~/.mu/results/cur ~/.mu/results/new 
~/.mu/results/tmp\n<change-folder-readonly>~/.mu/results\n<shell-escape>mu find 
--format=links --linksdir ~/.mu/results --clearlinks  " "mu-find"

Invoking that brings up a shell command line, where typing the mu
search terms at the end and hitting <enter> takes you directly to the
search results.

Note that the initial deleting-then-recreating the ~/.mu/results maildir
part of that macro is purely cosmetic. When typing the new search terms,
I prefer to see an empty folder instead of the results of whatever the
last search I ran was. The (redundant in the above macro) --clearlinks
option to mu clears out the old results as soon as the search is run, so
the following would work fine too if you don't care about this cosmetic
issue:

macro index,pager \CS "<change-folder-readonly>~/.mu/results\n<shell-escape>mu 
find --format=links --linksdir ~/.mu/results --clearlinks  " "mu-find"

HTH,

Toby
-- 
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain

email: ts...@cantab.net
web:   www.dr-qubit.org

Reply via email to