--- /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 E8735431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Feb 2012 01:16:15 -0800 (PST)\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 AJvkGtki8cwH for <notmuch@notmuchmail.org>;\r
+ Wed, 29 Feb 2012 01:16:15 -0800 (PST)\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 3755E431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 29 Feb 2012 01:16:15 -0800 (PST)\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 1S2fdq-0005Vp-50; Wed, 29 Feb 2012 09:16:10 +0000\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 1S2fdp-0005pg-QV; Wed, 29 Feb 2012 09:16:10 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org, Austin Clements <amdragon@MIT.EDU>\r
+Subject: Re: [Patch v6 12/13] emacs: show: recognize the exclude flag.\r
+In-Reply-To: <1330157204-26094-13-git-send-email-markwalters1009@gmail.com>\r
+References: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com>\r
+ <1330157204-26094-13-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.11.1+202~g31eaf97 (http://notmuchmail.org) Emacs/23.2.1\r
+ (i486-pc-linux-gnu)\r
+Date: Wed, 29 Feb 2012 09:17:56 +0000\r
+Message-ID: <87linmvvzv.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: d9d1a01330af159c833c1b49d4d94cfb (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: Wed, 29 Feb 2012 09:16:16 -0000\r
+\r
+\r
+The rest of the series still applies to master (bf28c60b9) but this patch\r
+needed rebasing/restructuring to fit with the Austin's keep-state patch.\r
+\r
+I attach the new patch below. Of course, if it is easier I can resend\r
+the whole series.\r
+\r
+Best wishes \r
+\r
+Mark\r
+\r
+>From 8324bc91e43d04e4c2813fa2a714766bcd057256 Mon Sep 17 00:00:00 2001\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+Date: Sun, 29 Jan 2012 16:32:55 +0000\r
+Subject: [PATCH] emacs: show: recognize the exclude flag.\r
+\r
+Show mode will recognize the exclude flag by not opening excluding\r
+messages by default, and will start at the first matching non-excluded\r
+message. If there are no matching non-excluded messages it will go to\r
+the first matching (necessarily excluded) message.\r
+---\r
+ emacs/notmuch-show.el | 36 +++++++++++++++++++++++++++---------\r
+ 1 files changed, 27 insertions(+), 9 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 2cca2e2..72a8a6e 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -981,7 +981,8 @@ current buffer, if possible."\r
+ \r
+ ;; Message visibility depends on whether it matched the search\r
+ ;; criteria.\r
+- (notmuch-show-message-visible msg (plist-get msg :match))))\r
++ (notmuch-show-message-visible msg (and (plist-get msg :match)\r
++ (not (plist-get msg :excluded))))))\r
+ \r
+ (defun notmuch-show-toggle-process-crypto ()\r
+ "Toggle the processing of cryptographic MIME parts."\r
+@@ -1081,11 +1082,7 @@ function is used."\r
+ notmuch-show-parent-buffer parent-buffer\r
+ notmuch-show-query-context query-context)\r
+ (notmuch-show-build-buffer)\r
+-\r
+- ;; Move to the first open message and mark it read\r
+- (if (notmuch-show-message-visible-p)\r
+- (notmuch-show-mark-read)\r
+- (notmuch-show-next-open-message))))\r
++ (notmuch-show-goto-first-wanted-message)))\r
+ \r
+ (defun notmuch-show-build-buffer ()\r
+ (let ((inhibit-read-only t))\r
+@@ -1167,9 +1164,7 @@ reset based on the original query."\r
+ (notmuch-show-apply-state state)\r
+ ;; We're resetting state, so navigate to the first open message\r
+ ;; and mark it read, just like opening a new show buffer.\r
+- (if (notmuch-show-message-visible-p)\r
+- (notmuch-show-mark-read)\r
+- (notmuch-show-next-open-message)))))\r
++ (notmuch-show-goto-first-wanted-message))))\r
+ \r
+ (defvar notmuch-show-stash-map\r
+ (let ((map (make-sparse-keymap)))\r
+@@ -1601,6 +1596,29 @@ to show, nil otherwise."\r
+ (goto-char (point-max))))\r
+ r))\r
+ \r
++(defun notmuch-show-next-matching-message ()\r
++ "Show the next matching message."\r
++ (interactive)\r
++ (let (r)\r
++ (while (and (setq r (notmuch-show-goto-message-next))\r
++ (not (notmuch-show-get-prop :match))))\r
++ (if r\r
++ (progn\r
++ (notmuch-show-mark-read)\r
++ (notmuch-show-message-adjust))\r
++ (goto-char (point-max)))))\r
++\r
++(defun notmuch-show-goto-first-wanted-message ()\r
++ "Move to the first open message and mark it read"\r
++ (goto-char (point-min))\r
++ (if (notmuch-show-message-visible-p)\r
++ (notmuch-show-mark-read)\r
++ (notmuch-show-next-open-message))\r
++ (when (eobp)\r
++ (goto-char (point-min))\r
++ (unless (notmuch-show-get-prop :match)\r
++ (notmuch-show-next-matching-message))))\r
++\r
+ (defun notmuch-show-previous-open-message ()\r
+ "Show the previous open message."\r
+ (interactive)\r
+-- \r
+1.7.2.3\r
+\r