[PATCH] emacs-show: open excluded matches if no other matches
authorMark Walters <markwalters1009@gmail.com>
Thu, 15 Mar 2012 18:28:10 +0000 (18:28 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:31 +0000 (09:45 -0800)
3f/35600c4d8f743f3e8c959e908078787161061a [new file with mode: 0644]

diff --git a/3f/35600c4d8f743f3e8c959e908078787161061a b/3f/35600c4d8f743f3e8c959e908078787161061a
new file mode 100644 (file)
index 0000000..e2bfbea
--- /dev/null
@@ -0,0 +1,105 @@
+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 DC872431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 11:28:19 -0700 (PDT)\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 LR3fzRkPyQSg for <notmuch@notmuchmail.org>;\r
+       Thu, 15 Mar 2012 11:28:19 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 14EFF431FAF\r
+       for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 11:28:18 -0700 (PDT)\r
+Received: by werm13 with SMTP id m13so3512908wer.26\r
+       for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 11:28:16 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=ZEPP1+niIQ4CJ44ok4YueUD5ZDfMP4iyucZnDm7AhDU=;\r
+       b=AHBnfzTIH89Nkxinx5pzg/NhTXLvirY2FEPOVculQvS0LqIN36msUBx8Hod7YQKVx5\r
+       xrX/Hh5lJNdC+TPDt8BL/BCis0t1qYirGpgP585fvPruz+EB0Mi+Ti+QCK1xCKLiyWwx\r
+       MFqLW2Bjv/8RvMAKKChqbMSQNyVIP8lPlLg2Gd0G6Yh5LdQu48BhjveMosmCIYpjE8zU\r
+       ZZfYYwzw5pbaeGHNb6e2fRpnu4IfGMWZJktoX4FzlPhOLPFJFmCpmtvTjx4uh4EV8+ix\r
+       ri21n2w97LMHGwoylTLuvMWA2pZHBlK0EOzQkTic44Zmim8xORyioiGGE+SruzU1kdtT\r
+       nWZw==\r
+Received: by 10.180.8.164 with SMTP id s4mr18094797wia.6.1331836096383;\r
+       Thu, 15 Mar 2012 11:28:16 -0700 (PDT)\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
+ gg2sm11262494wib.7.2012.03.15.11.28.14        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 15 Mar 2012 11:28:15 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs-show: open excluded matches if no other matches\r
+Date: Thu, 15 Mar 2012 18:28:10 +0000\r
+Message-Id: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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, 15 Mar 2012 18:28:20 -0000\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
+ 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