--- /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 4FE95431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 17:06:42 -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 o6vITV0hQcEV for <notmuch@notmuchmail.org>;\r
+ Sat, 28 Apr 2012 17:06:41 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+ [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 0BCBE431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 17:06:37 -0700 (PDT)\r
+Received: by wibhq7 with SMTP id hq7so1395682wib.2\r
+ for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 17:06:36 -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:in-reply-to:references;\r
+ bh=VDADjiWVwENBIy1ws4BzAer35+1ZsBveYSTkYpyz/TE=;\r
+ b=WaBy1P8bOIeuBghwelqrB+TAt0B0wjLYBi4Evb3n6mv2AzZfWCEB2aM8OuDehJEtkK\r
+ rQrWenShtw+4F5f0bGX78RLqQI4v0otXJkoftnq5jevSK6wTHgg5RI5ROxyOfxWY9kZo\r
+ PoInCH6PHHRgM3/EM71l7x3VXRQO0n2/wpGbsMlJU87O6SWINyWL1UWxf3Ob/u7/SFCx\r
+ ETsYniySrqSnQCgfMPbGOKOrA+JRYMb8nQXDw0WlHyjCrYvH+YFwr5DeJPDPUG6CGg5Y\r
+ KgstXiywt4hDccNvpMSl6lMYhEbSjxpi/AFfvrvit7nJZYyxPWhcGOcYYUwUEGPGPWUF\r
+ s9KQ==\r
+Received: by 10.180.76.240 with SMTP id n16mr10449420wiw.10.1335657996682;\r
+ Sat, 28 Apr 2012 17:06:36 -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
+ u9sm16579515wix.0.2012.04.28.17.06.35 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sat, 28 Apr 2012 17:06:35 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v4 2/3] emacs: add a filter option to show\r
+Date: Sun, 29 Apr 2012 01:06:45 +0100\r
+Message-Id: <1335658006-20161-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1335658006-20161-1-git-send-email-markwalters1009@gmail.com>\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: Sun, 29 Apr 2012 00:06:42 -0000\r
+\r
+Show the current thread with a different filter (i.e., open messages\r
+in the thread matching the new query).\r
+\r
+Bound to 'l' for "limit".\r
+\r
+Note that it is not the same as filter in search mode as it replaces\r
+the existing query rather than ANDing with it (but it does keep the\r
+thread-id part of the query).\r
+---\r
+ emacs/notmuch-show.el | 12 ++++++++++++\r
+ 1 files changed, 12 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 3bd9a64..f52a96d 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -42,6 +42,7 @@\r
+ (declare-function notmuch-search-next-thread "notmuch" nil)\r
+ (declare-function notmuch-search-show-thread "notmuch" nil)\r
+ (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))\r
++(declare-function notmuch-read-query "notmuch" (prompt))\r
+ \r
+ (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
+ "Headers that should be shown in a message, in this order.\r
+@@ -1161,6 +1162,7 @@ reset based on the original query."\r
+ (define-key map "s" 'notmuch-search)\r
+ (define-key map "m" 'notmuch-mua-new-mail)\r
+ (define-key map "f" 'notmuch-show-forward-message)\r
++ (define-key map "l" 'notmuch-show-filter-thread)\r
+ (define-key map "r" 'notmuch-show-reply-sender)\r
+ (define-key map "R" 'notmuch-show-reply)\r
+ (define-key map "|" 'notmuch-show-pipe-message)\r
+@@ -1403,6 +1405,16 @@ current thread."\r
+ "Mark the current message as read."\r
+ (notmuch-show-tag-message "-unread"))\r
+ \r
++(defun notmuch-show-filter-thread (query)\r
++ "Filter or LIMIT the current thread based on a new query string.\r
++\r
++Reshows the current thread with matches defined by the new query-string."\r
++ (interactive (list (notmuch-read-query "Filter thread: ")))\r
++ (let ((msg-id (notmuch-show-get-message-id)))\r
++ (setq notmuch-show-query-context (if (string= query "") nil query))\r
++ (notmuch-show-refresh-view t)\r
++ (notmuch-show-goto-message msg-id)))\r
++\r
+ ;; Functions for getting attributes of several messages in the current\r
+ ;; thread.\r
+ \r
+-- \r
+1.7.9.1\r
+\r