Ah, this is subtler than I thought. You're right that, for the '*' command, you 
want only the matched ID's. Tagging a region, however, operates on entire 
threads. I think it's important to retain this behavior because threads are 
what the user sees and selects in the search buffer (*, on the other hand, 
doesn't have a strong visual analogue).

(This also means * is not, in fact, equivalent to expanding the region the the 
entire buffer and then tagging the region.)

I should probably emit two lists per thread: one of matched IDs and one of 
unmatched IDs. Tagging a region can then operate on the concatenation of these, 
while * can operate only on the matched lists. This should be easy to do. I'll 
send an updated patch when I'm back at a computer.
-- 
Sent from my Android. Please excuse my brevity.

Pieter Praet <[email protected]> wrote:

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:[email protected]
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=un7mce...@mail.gmail.com"
or id:"[email protected]" or id:"[email protected]"
#+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

_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to