[neomutt-users] computed/evaluated search

Nicolas Paris nicolas.paris at riseup.net
Sun Nov 4 10:02:00 CET 2018

On Sat, Nov 03, 2018 at 09:39:51PM -0700, Ian Zimmerman wrote:
> On 2018-11-04 03:44, Nicolas Paris wrote:
> > > Ok, I think I understand it now.  You construct a regexp with multiple |
> > > branches on the fly with each branch corresponding to one message-id
> > > returned from the indexer.
> > 
> > Not really. The idea is to write the query in a file that is then passed
> > to the tool (notmuch, mu, anyelse), which looks into its index and then
> > return all the ID of the messages matching. 
> This is really apropos to my main concern, but why the bleep do you need
> the file?  It just complicates the whole thing for no good reason I can
> see.  Why not just interpolate the query to the indexer's command line
> directly? 

Because I am not aware how to do that directly.

> > I only get the 600 first messages, in order to speed up the fetching
> > and finally ask mutt to display them in mutt.
> Yes, and how do you ask mutt?  You construct a giant regexp.  That's
> what the perl loop does, in both versions (Pasky's and yours).

It's constructing a giant string limiting to ID's, with a regexp. The
regexp only parse 600 ID's, and the string only contains 600 ID's in the
worst case. 

> > There may be other better way, but I say this one is already fast
> > enough.
> The way I'm thinking of (I hope a better one) is to add a new pattern
> type, say ~I, to neomutt.  It would take a command line as its
> argument.  Running the command line should produce a bunch of
> message-ids on stdout, separated by white space; the meaning of the
> pattern would be to match mails whose message-id is one of the bunch.

Sounds good. Is it something like:

Type "l" to limit, then:
~f ian ~I giant

would result in:
limit the email's from Ian containing 'giant'. Use an external
program to filter such notmuch configured in the muttrc:
external-if-filter "notmutch query: %s"


More information about the neomutt-users mailing list