--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 68BCE431FAF\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Apr 2012 12:10:13 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 TAvH5VIIoMtq for <notmuch@notmuchmail.org>;\r
+ Thu, 12 Apr 2012 12:10:13 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
+ by olra.theworths.org (Postfix) with ESMTP id BB7F1431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Apr 2012 12:10:12 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 077A968055; Thu, 12 Apr 2012 22:10:10 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs-show: open excluded matches if no other matches\r
+In-Reply-To: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.12+104~gf9ad237 (http://notmuchmail.org) Emacs/23.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Thu, 12 Apr 2012 22:10:10 +0300\r
+Message-ID: <m2wr5kdawd.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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, 12 Apr 2012 19:10:13 -0000\r
+\r
+On Thu, Mar 15 2012, Mark Walters wrote:\r
+\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
+\r
+I don't (yet) fully understand this exclude stuff, but the \r
+implementation looks ok.\r
+\r
++1\r
+\r
+Tomi\r
+\r
+> emacs/notmuch-show.el | 14 ++++++++++++--\r
+> 1 files changed, 12 insertions(+), 2 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 4a60631..bd4ba0f 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1608,6 +1608,11 @@ to show, nil otherwise."\r
+> (notmuch-show-message-adjust))\r
+> (goto-char (point-max)))))\r
+> \r
+> +(defun notmuch-show-open-if-matched ()\r
+> + "Open a message if it is matched (whether or not excluded)."\r
+> + (let ((props (notmuch-show-get-message-properties)))\r
+> + (notmuch-show-message-visible props (plist-get props :match))))\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
+> @@ -1615,9 +1620,14 @@ to show, nil otherwise."\r
+> (notmuch-show-mark-read)\r
+> (notmuch-show-next-open-message))\r
+> (when (eobp)\r
+> + ;; There are no matched non-excluded messages so open all matched\r
+> + ;; (necessarily excluded) messages and go to the first.\r
+> + (notmuch-show-mapc 'notmuch-show-open-if-matched)\r
+> + (force-window-update)\r
+> (goto-char (point-min))\r
+> - (unless (notmuch-show-get-prop :match)\r
+> - (notmuch-show-next-matching-message))))\r
+> + (if (notmuch-show-message-visible-p)\r
+> + (notmuch-show-mark-read)\r
+> + (notmuch-show-next-open-message))))\r
+> \r
+> (defun notmuch-show-previous-open-message ()\r
+> "Show the previous open message."\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r