Re: [PATCH v2] emacs: Add notmuch-update-search-tags

Subject: Re: [PATCH v2] emacs: Add notmuch-update-search-tags

Date: Sat, 26 Aug 2017 11:23:35 +0100

To: Vladimir Panteleev,

Cc: Vladimir Panteleev

From: Mark Walters


On Sat, 26 Aug 2017, Vladimir Panteleev <> wrote:
> From: Vladimir Panteleev <>
> Implement an option which, when enabled, causes any tag changes done
> from within notmuch-emacs to instantly update matching threads in open
> search buffers.

I like the idea, and provided it only marks the tags as changed in the
normal way, I think we could even default to on.

However, I am concerned that this version does other things as
well. Note these comments are from reading the patch not from testing,
so please point out if I am wrong.

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"

3) At least in theory I think the thread may no longer exist -- it could
have merged with another thread and taken the other threads id.

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

Rather than refreshing the result it might make sense to fetch the tags
for the actual messages in that thread (as it was when the search buffer
was loaded) by using notmuch-search-find-stable-query.

So something like the following,

- in each notmuch-search buffer

- see if thread-id thread is in that buffer (or perhaps even if there is a thread
  which contains message id in that buffer?)

- If yes, fetch a new list of tags for the messages that buffer thinks are
  in that thread (using notmuch-search-find-stable-query).

- Update tags appropriately.

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?

Best wishes


notmuch mailing list