Thanks Austin! Unfortunately, your patch causes *all* Message-Id's in the thread to be appended, as opposed to only the ones matching the query: #+BEGIN_EXAMPLE $ notmuch search tag:inbox AND from:amdragon@mit.edu thread:0000000000002777 Yest. 19:17 [1/3] Austin Clements| Pieter Praet; [PATCH 2/2] [RFC] possible solution for "Race condition for '*' command" (inbox replied sent to-me x/notmuch) id:"CAH-f9WticM4EN8F1_ik_-mcBcBtrXwSpO+Drbtp7=UN7McECrg@mail.gmail.com" or id:"87zkkwydag.fsf@praet.org" or id:"20110703171743.GL15901@mit.edu" #+END_EXAMPLE As you can see, according to matched/total ("[1/3]") only a single message matches the query, yet all 3 MsgId's are returned. If this were to be corrected (probably a trivial change, but I'm pretty much oblivious as to the what and where of it), the following patch series should work as intended. The "--stdin" option works as expected (and ARG_MAX is indeed a very valid concern with this particular use case), but I haven't yet gotten around to making use of it from the Emacs UI as this would require some screwing around with `notmuch-tag' and `notmuch-call-notmuch-process', and it's still pretty early I-). Peace -- Pieter