unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Vladimir Panteleev <notmuch@thecybershadow.net>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Cc: Vladimir Panteleev <git@thecybershadow.net>
Subject: Re: [PATCH v2] emacs: Add notmuch-update-search-tags
Date: Sat, 26 Aug 2017 17:15:52 +0000	[thread overview]
Message-ID: <be94da13-7dd7-be62-2005-80ae9a12297c@gmail.com> (raw)
In-Reply-To: <87a82mzkyg.fsf@qmul.ac.uk>

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

  reply	other threads:[~2017-08-26 17:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14  5:54 [PATCH 0/2] Update search results when tags change Vladimir Panteleev
2017-08-14  5:54 ` [PATCH 1/2] notmuch-tag.el: Fix minor grammar error Vladimir Panteleev
2017-08-23 11:11   ` David Bremner
2017-08-14  5:54 ` [PATCH 2/2] emacs: Add notmuch-update-search-tags Vladimir Panteleev
2017-08-25 11:12   ` David Bremner
2017-08-26  1:50     ` Vladimir Panteleev
2017-08-26  1:55       ` [PATCH v2] " Vladimir Panteleev
2017-08-26 10:23         ` Mark Walters
2017-08-26 17:15           ` Vladimir Panteleev [this message]
2017-08-27  7:46             ` Mark Walters
2017-08-29  1:18         ` David Bremner
2017-09-04 22:05           ` Vladimir Panteleev
2017-09-06 13:11             ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be94da13-7dd7-be62-2005-80ae9a12297c@gmail.com \
    --to=notmuch@thecybershadow.net \
    --cc=git@thecybershadow.net \
    --cc=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).