From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 50965431FD0 for ; Mon, 9 Jan 2012 03:31:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SwJdhzxot2+o for ; Mon, 9 Jan 2012 03:31:34 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A00D7431FB6 for ; Mon, 9 Jan 2012 03:31:34 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1RkDRi-0002Ag-6K; Mon, 09 Jan 2012 11:31:31 +0000 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1RkDRh-0005rz-S8; Mon, 09 Jan 2012 11:31:22 +0000 From: Mark Walters To: Austin Clements , Aaron Ecay Subject: Re: [PATCH] emacs: call "notmuch tag" only once when archiving a thread In-Reply-To: <20120109011259.GD20796@mit.edu> References: <1325615346-8302-1-git-send-email-jani@nikula.org> <87fwftao1b.fsf@nikula.org> <20120109011259.GD20796@mit.edu> User-Agent: Notmuch/0.10.2+172~g60f099b (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) Date: Mon, 09 Jan 2012 11:31:21 +0000 Message-ID: <87wr91f6ye.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 94.192.233.223 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 380c5fc64b1cdd4bf720bece40193094 (of first 20000 bytes) X-SpamAssassin-Score: -1.7 X-SpamAssassin-SpamBar: - X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -1.7 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay * domain * 0.6 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 11:31:35 -0000 > There's been quite a bit of discussion on fixing this properly. See, > for example > id:"CAH-f9WsPj=1Eu=g3sOePJgCTBFs6HrLdLq18xMEnJ8aZ00yCEg@mail.gmail.com". > The gist is that we need to include message IDs (or document IDs) in > the search output and use these in tagging operations, rather than the > unstable thread:XXX queries. Unfortunately, actually fixing this got > stalled since adding this information the text format is a fool's > errand (having been the fool, I can say this!), so we need to switch > Emacs over to using the JSON search format first. However, once > that's done, it's a relatively simple change. I will just mention a different possible solution to this problem. I think it is probably more hassle than its worth but just in case someone sees how to do it nicely. The idea is to try and put the race-free solution into the command-line notmuch rather than the emacs part. I will just consider one race to start with: the race in notmuch search/notmuch tag. notmuch search gives us just the thread-ids and what is in that thread can change. So we could ask for a "cookie" (some short unique identifier) and notmuch itself would store the state of its output (i.e., the thread-ids together with the message-ids and the matched message-ids). Then notmuch tag could be called with this cookie to say "apply this tag to the threads as they were at cookie. example use notmuch search --cookie prints a cookie followed by the output of the search notmuch tag --cookie=cookievalue +sometag matched-thread:id .. \ all-thread:id .. and notmuch would replace the matched-thread:id by the (matching) message-ids in thread it stored at time cookievalue and all-thread by all the messages at time cookievalue. The nice feature is that this makes it easy for all clients to be race free (not just emacs). The backend has the information to hand: there is no encoding and decoding (via text or JSON) so storing message-ids etc is simpler. It also means that if notmuch wants to use document-ids internally it can: it does not become a public interface. The downside is trying to do the argument parsing in c and we have do some reference counting or something to delete the cookies state at some point. Anyway it's just a thought. Best wishes Mark