--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 4E3E7431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 13 Apr 2012 02:29:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 BY87sy-FVfvp for <notmuch@notmuchmail.org>;\r
+ Fri, 13 Apr 2012 02:29:08 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 9F103431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 13 Apr 2012 02:29:08 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1SIcoP-0005IA-MN; Fri, 13 Apr 2012 10:29:02 +0100\r
+Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
+ helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1SIcoP-0007ik-70; Fri, 13 Apr 2012 10:29:01 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jani Nikula <jani@nikula.org>, Tomi Ollila <tomi.ollila@iki.fi>,\r
+ Jameson Graef Rollins <jrollins@finestructure.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs-show: open excluded matches if no other matches\r
+In-Reply-To: <87k41kj9g6.fsf@nikula.org>\r
+References: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com>\r
+ <8762d44vkv.fsf@servo.finestructure.net>\r
+ <m2ty0odaej.fsf@guru.guru-group.fi> <87k41kj9g6.fsf@nikula.org>\r
+User-Agent: Notmuch/0.12+110~gbc97b4a (http://notmuchmail.org) Emacs/23.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 13 Apr 2012 10:29:19 +0100\r
+Message-ID: <87fwc80ykw.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 94.192.233.223\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 07cb8ff1279e44b1bf2690591dd4169e (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.8\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -1.8 points.\r
+ Summary of the scoring: \r
+ * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+ * medium trust\r
+ * [138.37.6.40 listed in list.dnswl.org]\r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * 0.5 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Fri, 13 Apr 2012 09:29:10 -0000\r
+\r
+On Fri, 13 Apr 2012, Jani Nikula <jani@nikula.org> wrote:\r
+> On Thu, 12 Apr 2012 22:20:52 +0300, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+>> On Thu, Apr 12 2012, Jameson Graef Rollins wrote:\r
+>> \r
+>> > On Thu, Mar 15 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
+>> >> Currently emacs show does not open matching but excluded\r
+>> >> messages. This is normally the desired behaviour but is probably not\r
+>> >> ideal if only excluded messages match. This patch opens all the\r
+>> >> matching (necessarily excluded) messages in this case and goes to the\r
+>> >> first one.\r
+>> >\r
+>> > Hi, Mark. I have tested this patch and it LGTM. I think this is the\r
+>> > behavior we want, since it's no fun to open up a show buffer and have\r
+>> > all messages in the thread closed. That doesn't make much sense.\r
+>> \r
+>> I disagree: If I open up a show buffer I'd like to have all messages\r
+>> in the thread closed if search terms do not match. But that is my\r
+>> opinion and inconsistent with current behaviour.\r
+>> \r
+>> (Therefore I already +1:d this patch)\r
+>> \r
+>> An example: I have thread of 100 messages and 1 of those is unread.\r
+>> Search terms is tag:unread. I enter the thread: 99 messages closed\r
+>> and this one open. Now unread is automatically removed. If I go back\r
+>> to search view (by pressing q) and re-choose the same thread,\r
+>> current behaviour is to open all 100 messages. I'd like to see all\r
+>> 100 messages closed.\r
+>\r
+> IIUC this would still show all messages closed. Messages that don't\r
+> match will be closed. The change is that if there are messages that\r
+> match, but all of them are excluded, then open the messages anyway.\r
+\r
+This patch does not affect the behaviour in this case, but the code\r
+existing code does expand all messages in a thread if none match (the\r
+use of basic-args and args in notmuch-show-build-buffer).\r
+\r
+> In your example, only if you have *another* message that is both\r
+> tag:unread and tag:deleted (or some other excluded tag) it would show up\r
+> the second time you enter show view.\r
+>\r
+> I actually think I'd still want the above to show all messages closed,\r
+> unless the excluded tag was explicitly specified in the search. The idea\r
+> of exclusions is to reduce "noise" in the view, why open them? If you\r
+> have those 100 messages in a thread, and you want to see the interesting\r
+> (i.e. non-excluded) messages, I'd rather see 0 open if 0 are\r
+> interesting, instead of 100 non-interesting if they are all excluded.\r
+\r
+I think that is entirely plausible as a way to go (though I would also\r
+be happy with the behaviour after this patch). But I think that should\r
+be a subsequent patch because to be consistent it would have to change\r
+the existing behaviour for no matches (and no excludes) to be all closed.\r
+\r
+> Perhaps a function to toggle the open/close of excluded messages would\r
+> be a better idea. \r
+\r
+That might be useful regardless. I could add a function to do this,\r
+which could be called by the above patch if we want the behaviour it\r
+introduces. Do you think that is worth doing?\r
+\r
+> But then I don't use exclusions ATM, so maybe I just\r
+> don't understand, and won't be affected either way. *shrug*.\r
+\r
+That is one problem: there are lots of potential use cases and its not\r
+clear which of them people will use and which we should encourage. I use\r
+a `bizarre' one: I exclude all of my mailing list mail (including\r
+notmuch) so that it doesn't show up in my personal mail searches. So I\r
+guess I am using the excludes to return to the bad old days of\r
+`folders'. (I am not recommending this to anyone, I partly did it as a\r
+good stress test for the exclude stuff, but it does seem to mostly\r
+work.)\r
+\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+ \r
+\r
+\r