[PATCH v2] emacs: Add notmuch-update-search-tags
Vladimir Panteleev
notmuch at thecybershadow.net
Sat Aug 26 10:15:52 PDT 2017
On 2017-08-26 10:23, Mark Walters wrote:
> 1) Suppose a new message arrives in the thread. Then triggering a tag
> change in the show buffer, (eg notmuch automatically removing an unread
> tag) pulls that message into original search buffer.
>
> 2) If that new message has some tags that aren't in the thread they will
> get marked as "added tags"
Yes, AFAICT this is correct.
> I think 3 is probably rare enough not to be real concern (though we
> should make sure we don't actually give an error). But 1 and 2 seem
> undesirable.
If the thread is gone, then it won't be in the results of the tag query,
therefore it simply won't be updated.
> If we do that then I think the only change in these buffers is the tag
> updates, and exactly as if you changed those tags in the search buffer
> itself, the threads shown etc don't change.
>
> What do you think?
I think it's doable in theory, just not efficiently.
In order to fetch correct results for the messages currently displayed
in the search buffer, we need to pass those exact message IDs to
notmuch. If a tagging operation affects many messages from a large
search buffer, doing one notmuch search invocation per thread can add up
to a lot of notmuch invocations.
It may be possible to optimize this down to one batch search query per
notmuch-search buffer - however, this results in a large search query.
Not only would one take a while to execute, but the resulting query can
become too large to be passed as a command-line parameter, and "notmuch
search" does not seem to have a --batch switch to read queries from
standard input.
Even if the above were to work sufficiently well, it is still necessary
to do one notmuch invocation per search buffer, as individual search
buffers may capture results from different points in time. In the patch
above just one additional invocation in total is necessary.
So, I don't see a way to do this in a sufficiently efficient way.
Performance does matter here, as notmuch will perform tag updates in
situations where a user shouldn't expect significant delays - e.g.
holding down the "down arrow" key in a notmuch-show buffer with some
unread messages will cause notmuch to remove the "unread" tag as point
travels over each unread message.
What do you think?
--
Best regards,
Vladimir
More information about the notmuch
mailing list