--- /dev/null
+Return-Path: <pieter@praet.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id B7977431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:45:04 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 43W9dHGgZyK9 for <notmuch@notmuchmail.org>;\r
+ Sun, 19 Feb 2012 12:45:03 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+ [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 88B86431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:45:03 -0800 (PST)\r
+Received: by wibhi8 with SMTP id hi8so3108478wib.26\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:45:02 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
+ 10.180.99.100 as permitted sender) client-ip=10.180.99.100; \r
+Authentication-Results: mr.google.com;\r
+ spf=pass (google.com: domain of pieter@praet.org\r
+ designates 10.180.99.100 as permitted sender)\r
+ smtp.mail=pieter@praet.org\r
+Received: from mr.google.com ([10.180.99.100])\r
+ by 10.180.99.100 with SMTP id ep4mr11936518wib.7.1329684302310\r
+ (num_hops = 1); Sun, 19 Feb 2012 12:45:02 -0800 (PST)\r
+Received: by 10.180.99.100 with SMTP id ep4mr9994796wib.7.1329684302229;\r
+ Sun, 19 Feb 2012 12:45:02 -0800 (PST)\r
+Received: from localhost (104.218-242-81.adsl-dyn.isp.belgacom.be.\r
+ [81.242.218.104])\r
+ by mx.google.com with ESMTPS id s2sm29263562wix.3.2012.02.19.12.45.01\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 19 Feb 2012 12:45:01 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+Subject: Re: [PATCH v4] test: emacs: add test for `notmuch-search-operate-all'\r
+In-Reply-To: <8762fqm8zv.fsf@gmail.com>\r
+References: <1327599289-16865-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+ <1327909550-6788-1-git-send-email-pieter@praet.org>\r
+ <87y5spober.fsf@gmail.com> <877h067jn3.fsf@praet.org>\r
+ <87hazamywi.fsf@gmail.com> <87liomb8gv.fsf@praet.org>\r
+ <8762fqm8zv.fsf@gmail.com>\r
+User-Agent: Notmuch/0.11.1+210~g6afc43e (http://notmuchmail.org) Emacs/23.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+Date: Sun, 19 Feb 2012 21:42:46 +0100\r
+Message-ID: <87obsusgft.fsf@praet.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQlivaqhpLNpc1N8xCNycxccdh5Dwn3AyrCcOpT97h8nmHNrd5QCxylSVkNi8OFmNBZtZSuq\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 19 Feb 2012 20:45:05 -0000\r
+\r
+On Thu, 02 Feb 2012 03:25:40 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
+> > > [...]\r
+> > \r
+> > OK, how about this?:\r
+> > \r
+> \r
+> Looks good. Minor comments below.\r
+> \r
+> > #+begin_src sh\r
+> > test_begin_subtest "Add/remove tags to/from all matching messages."\r
+> \r
+> We should add notmuch-search here, because similar functionality would\r
+> be available in notmuch-show soon. Also, I suggest replacing\r
+> "add/remove tags to/from" with "change tags". Consider:\r
+> \r
+> Change tags for all matching threads in notmuch-search.\r
+>\r
+\r
+Agreed, though I think you meant "matching messages".\r
+\r
+\r
+Although, Austin has suggested [1] having `notmuch-search-operate-all'\r
+(s/operate/tag) work on threads (or all messages therein, at least),\r
+as opposed to only on *matched* messages, with which I agree(d) [2].\r
+\r
+This would also get rid of the regexp issue @ [3], allowing us to\r
+fix the race condition without having to put `notmuch-search' on a\r
+JSON diet first.\r
+\r
+And OTOH, David has asked [4] for `notmuch-show-tag-all' to work only on\r
+visible (uncollapsed) messages, so wrt keeping `notmuch-search-tag-all'\r
+and `notmuch-show-tag-all' symmetrical, it seems we're at an impasse :)\r
+\r
+\r
+> > old="inbox" ; new="xobni" ; filter="AND from:cworth"\r
+> \r
+> I would prefer this to be on separate lines.\r
+> \r
+> > o1=$(notmuch count tag:"${old}" "${filter}") ; n1=$(notmuch count tag:"${new}" "${filter}")\r
+> \r
+> I would definately prefer this to be on separate lines.\r
+> \r
+> Also, please consider s/o1/old_count_1, s/n1/new_count_1/ and so on.\r
+> \r
+> > test "${o1}" == "0" && o1="Need more matches!" # prevent false positives\r
+> > test_emacs "(notmuch-search \"tag:${old} ${filter}\")\r
+> > (notmuch-test-wait)\r
+> > (notmuch-search-operate-all \"+${new}\" \"-${old}\")"\r
+> > o2=$(notmuch count tag:"${old}" "${filter}") ; n2=$(notmuch count tag:"${new}" "${filter}")\r
+> \r
+> Same comment about separate lines.\r
+>\r
+> > notmuch tag -"${new}" +"${old}" -- tag:"${new}" "${filter}" AND NOT tag:"${old}"} # restore db state!\r
+> \r
+> Why "AND NOT tag:$old" is needed here?\r
+>\r
+\r
+To be extra sure we're only touching the messages which were altered in\r
+the previous segment, but it's probably rather useless. Removed.\r
+\r
+\r
+> Since the line is too long, please move the comment to a separate line\r
+> above.\r
+> \r
+> Since we are testing Emacs UI, should we restore db though Emacs as\r
+> well?\r
+>\r
+\r
+Hmm, comes with a performance hit (which is why I avoided it initially),\r
+but a fairly minor one at that. Done.\r
+\r
+\r
+> > o3=$(notmuch count tag:"${old}" "${filter}") ; n3=$(notmuch count tag:"${new}" "${filter}")\r
+> \r
+> Same comment about separate lines.\r
+> \r
+> > output="\r
+> > before: ${old}=$o1 ${new}=$n1\r
+> > after: ${old}=$o2 ${new}=$n2\r
+> > restored: ${old}=$o3 ${new}=$n3"\r
+> > expected="\r
+> > before: ${old}=$o1 ${new}=0\r
+> > after: ${old}=0 ${new}=$o1\r
+> > restored: ${old}=$o1 ${new}=0"\r
+> \r
+> I would change "=" to ":".\r
+>\r
+\r
+Done, as well as everything related to separating lines and\r
+renaming variables.\r
+\r
+Fresh patch submitted in its original thread [5].\r
+\r
+\r
+> Regards,\r
+> Dmitry\r
+> \r
+> > [...]\r
+\r
+\r
+Peace\r
+\r
+-- \r
+Pieter\r
+\r
+[1] id:"20111112163502.GE2658@mit.edu"\r
+[2] id:"871ut8f9ya.fsf@praet.org"\r
+[3] id:"1310416993-31031-1-git-send-email-pieter@praet.org"\r
+[4] id:"87wr7xqpuf.fsf@rocinante.cs.unb.ca"\r
+[5] id:"1329683908-5435-1-git-send-email-pieter@praet.org"\r