My mutt-notmuch hack seems to be a quite popular way to integrate Mutt with notmuch. As a nice consequence, my (indexed!) inbox attracts patches from mutt-notmuch users eager to improve it. Collecting some of them, I've just tagged mutt-notmuch 0.2 with the following changes:
- readline support and query history
- support for spaces in mailboxes (use case: gmail+offlineimap)
- a new "tag" action
- normalization of
=namesto support mutt macros that pass folder names - do not treat
+optas a valid cmdline option (to ease tagging)
Many thanks to Scott Barker, Christine Spang, David Newgas, and Ryan Kavanagh for the above patches.
While I was at it, I've also moved mutt-notmuch repository to Gitorious. Git self-hosting is nice, but either you move to something like gitolite (which I didn't have time to setup and tune ATM) or you're stuck without merge requests which are quite nice. (Why not Github? Because.)
If you're using mutt-notmuch you might also be interested in the discussion of libnotmuch support in mutt. I'd love to see that landing in mutt and be able to throw away mutt-notmuch entirely, but that seems a bit premature as of yet.

Seems like recent git pulls have a new format for notmail search (and notmail show) - looks like the --output=files is gone?
Anybody else seen this, or have I loused up totally?
See http://log.or.cz/?p=228 for details. Thanks for mutt-notmuch anyway, it provided the necessary impetus for me to actually try notmuch with mutt at all.
Oh, this is pretty interesting, thank you for the idea!
However, am I wrong in assuming that your hack only work if you have all the mail you're searching for in the same Maildir? (sorry for not having tried directly)
If the above is the case, it doesn't work for me, as I'm really using notmuch within mutt because I want the benefits of both worlds: maildir splitting and global indexing.
So far, I'm in the process of migrating to notmuch so I use it only for my main folder (the rest is still mailbox ;), but actually, I don't think there is a direct limitation.
It depends on what behavior will actually want. AIUI, notmuch will return matches in all folders; mutt will show these matched in the currently opened folder. So if you want to see only results in your current folder, this should do what you want. If you want to see results in all folders, my hack won't do. I think that would be a very rare use-case for me so I will be content with using your script / notmuch directly in these cases.
In practice, there is a problem; my hack will process only the first n results of notmuch (n=600 semi-arbitrarily). If there are matches in many folders, only few matches in current folder might get shown. Patching mutt would be required to fix that, I think.
Thanks for clarifying, Petr.
Unfortunately, that's exactly my use case. In fact, that's even the reason why I wonted notmuch (and its integration with Mutt): I end up having conversations scattered through different maildirs and I want to be able to search through them no matter where their bits and pieces are. (Besides, that's also why I use the F9 macro described in my original post.)
Still, I'm happy that mutt-notmuch motivated to write something that helps work-flows other than mine
Cheers.
If you get the message
Can't locate object method "unbind_key" via package "Term::ReadLine::Stub" at /usr/local/bin/mutt-notmuch line 47, line 998.
then you need to install the package libterm-readline-gnu-perl
Yep, that's a dependency of the current version.
Patches to make the dependency optional, and gracefully degrade to no readline support if not available, are welcome!