--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 68E07431FDB\r
+ for <notmuch@notmuchmail.org>; Thu, 2 Feb 2012 09:43:39 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ 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 tNgbFtPKUaOy for <notmuch@notmuchmail.org>;\r
+ Thu, 2 Feb 2012 09:43:38 -0800 (PST)\r
+Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
+ [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ BBB2D431FD4 for <notmuch@notmuchmail.org>; Thu, 2 Feb 2012 09:43:21 -0800\r
+ (PST)\r
+Received: by mail-ww0-f45.google.com with SMTP id dt12so2522817wgb.2\r
+ for <notmuch@notmuchmail.org>; Thu, 02 Feb 2012 09:43:21 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=hs0iy7WMmE9chn11yMhNs+3x120hfjBNsgiFT6yiSLk=;\r
+ b=VWFmLhFhI1sFdtlrLIp1jS/5wb8aiwaz4QtcXIIQcxBvwF+JnE2wNVZN+joS9j1Nys\r
+ T8z/SNCeAH3aFMfydLQ5B6tgLET0C3J5ImwG+qQLR62Uxh4rT3CkSdjdleS56Gi0QGz1\r
+ TDGEdnfvRl2qlRkwJDe5i328q2im6kaJczllM=\r
+Received: by 10.180.94.68 with SMTP id da4mr6108177wib.22.1328204601232;\r
+ Thu, 02 Feb 2012 09:43:21 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223]) by mx.google.com with ESMTPS id\r
+ eq5sm9176135wib.2.2012.02.02.09.43.19 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Thu, 02 Feb 2012 09:43:20 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ amdragon@MIT.EDU\r
+Subject: [PATCH v4 11/11] emacs: show: recognize the exclude flag.\r
+Date: Thu, 2 Feb 2012 17:43:39 +0000\r
+Message-Id: <1328204619-25046-11-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <874nv9rv79.fsf@qmul.ac.uk>\r
+References: <874nv9rv79.fsf@qmul.ac.uk>\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: Thu, 02 Feb 2012 17:43:39 -0000\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 | 18 +++++++++++++++++-\r
+ 1 files changed, 17 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 84ac624..8efadf6 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -905,7 +905,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-insert-tree (tree depth)\r
+ "Insert the message tree TREE at depth DEPTH in the current thread."\r
+@@ -1015,6 +1016,9 @@ buffer."\r
+ ;; Move straight to the first open message\r
+ (unless (notmuch-show-message-visible-p)\r
+ (notmuch-show-next-open-message))\r
++ (when (eq (point) (point-max))\r
++ (goto-char (point-min))\r
++ (notmuch-show-next-matching-message))\r
+ \r
+ ;; Set the header line to the subject of the first open message.\r
+ (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))\r
+@@ -1417,6 +1421,18 @@ any effects from previous calls to\r
+ (notmuch-show-message-adjust))\r
+ (goto-char (point-max)))))\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-previous-open-message ()\r
+ "Show the previous message."\r
+ (interactive)\r
+-- \r
+1.7.2.3\r
+\r