[neomutt-users] computed/evaluated search
itz at very.loosely.org
Sat Nov 3 18:01:28 CET 2018
On 2018-11-01 22:47, Nicolas Paris wrote:
> > Is there a way to use some external program to generate a searching or
> > limiting pattern? Hypothetically, I want something like this:
> > <limit> =i `get_mairix_results $my_query` <enter>
> Not sure that's exactly what you ask for, but I've recently written this
> ticket http://natus.1s.fr/blog/mutt-notmuch/
Hi nicolas, thanks for joining me. I quote your macro invention below,
so that others can see it without reaching for the browser.
macro index L "<enter-command>unset wait_key<enter><shell-escape>\
read -p 'notmuch query: ' x; echo \$x >~/.cache/mutt_terms<enter>\
<limit>~i \"\`notmuch search --output=messages\
\$(cat ~/.cache/mutt_terms) |\
head -n 600 |\
perl -le '@a=<>;chomp at a;s/\^id:// \
for at a;s/\\+/\\\\+/g for at a;s/=/\\\\=/g \
for at a;$,=\"|\";print at a'\`\"<enter>"
"show only messages matching a notmuch pattern"
It is far from obvious to me how this works :-P I guess the main
obstacle to understanding it is that it seems to rely on the following
syntax already working:
Note I have not backslashed anything, because I am not thinking about a
macro now - I mean the behavior of the command parser at runtime. Is
this really supposed to work? If so, that solves my problem - all I
need is a way to specify a "dynamic" pattern, everything else (in
particular your perl logic) can be hidden inside some_command.
> I don't know about mairix, but I finally using "mu" in place of notmuch
I think the particular indexing/searching program is not relevant, I
only mentioned notmuch because of neomutt's new integration with it,
which I was afraid someone would recommend. Assuming, of course, that
the indexer can output message-ids OR be wrapped such that the wrapper
outputs message-ids, and that seems to be true for all of them.
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.
More information about the neomutt-users