[PATCH] emacs: call "notmuch tag" only once when archiving a thread

Jani Nikula jani at nikula.org
Mon Jan 9 00:41:15 PST 2012


On Sun, 8 Jan 2012 20:12:59 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> Quoth Aaron Ecay on Jan 08 at  7:56 pm:
> > On Thu, 05 Jan 2012 22:32:16 +0200, Jani Nikula <jani at nikula.org> wrote:
> > 
> > [...]
> > 
> > > In the show view it only modifies the messages that are currently
> > > visible. This is to make sure you don't accidentally archive things that
> > > have arrived after refreshing the buffer. I think this is safest.
> > 
> > Hmm.  Perhaps it would make sense to add a check in the search view that
> > the thread being archived[1] has the same number of messages as it did
> > when the buffer was constructed.  (The information on how many messages
> > the thread has is in the buffer; we would then compare this to the result
> > of “notmuch count thread:000foo” when the user requests to archive.)  If
> > the counts don’t match, the interface should show a message in the echo
> > area and (probably) refuse to do the tagging.
> 
> That sounds like a clever workaround.

The downside is that there's still a race condition: you could get new
messages between checking the number of messages in the thread and
tagging. The window for error would be much smaller than now, but it's
still there. (You could check afterwards if this happened, and notify
the user, "oooops, I just tagged N messages more than you intended"...)

J.


More information about the notmuch mailing list