Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 15665431FB6 for ; Wed, 22 Feb 2012 10:46:15 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cckw8weR4PF2 for ; Wed, 22 Feb 2012 10:46:14 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BAD50431FD5 for ; Wed, 22 Feb 2012 10:46:00 -0800 (PST) Received: by mail-ww0-f45.google.com with SMTP id dt12so311625wgb.2 for ; Wed, 22 Feb 2012 10:46:00 -0800 (PST) Received-SPF: pass (google.com: domain of pieter@praet.org designates 10.180.74.177 as permitted sender) client-ip=10.180.74.177; Authentication-Results: mr.google.com; spf=pass (google.com: domain of pieter@praet.org designates 10.180.74.177 as permitted sender) smtp.mail=pieter@praet.org Received: from mr.google.com ([10.180.74.177]) by 10.180.74.177 with SMTP id u17mr38299331wiv.13.1329936360490 (num_hops = 1); Wed, 22 Feb 2012 10:46:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.74.177 with SMTP id u17mr31665765wiv.13.1329936360395; Wed, 22 Feb 2012 10:46:00 -0800 (PST) Received: from localhost ([109.131.181.26]) by mx.google.com with ESMTPS id y1sm74830307wiw.6.2012.02.22.10.45.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Feb 2012 10:46:00 -0800 (PST) From: Pieter Praet To: Notmuch Mail Subject: [PATCH v2 7/7] emacs: `notmuch-show-toggle-visibility-messages' with prefix arg filters by tag Date: Wed, 22 Feb 2012 19:43:34 +0100 Message-Id: <1329936214-30959-7-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <1327469139-1968-1-git-send-email-pieter@praet.org> References: <1327469139-1968-1-git-send-email-pieter@praet.org> X-Gm-Message-State: ALoCoQkFa7B6XS5SkhftDbvaGgF3Ka4PuK1L4nqzD+nR1rrM3Man/DdsSv8AJfvgfF+x7JMCOTVa X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 18:46:15 -0000 * emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages): When provided with a prefix arg, prompt the user for a tag. Show all messages that have it and hide those that don't. --- emacs/notmuch-show.el | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 82d4265..b5e482b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -38,6 +38,7 @@ (declare-function notmuch-call-notmuch-process "notmuch" (&rest args)) (declare-function notmuch-fontify-headers "notmuch" nil) +(declare-function notmuch-select-tag-with-completion "notmuch" (prompt &rest search-terms)) (declare-function notmuch-read-tag-changes "notmuch" (&optional initial-input &rest search-terms)) (declare-function notmuch-search-next-thread "notmuch" nil) (declare-function notmuch-search-show-thread "notmuch" nil) @@ -1670,13 +1671,19 @@ (defun notmuch-show-toggle-visibility-message () (defun notmuch-show-toggle-visibility-messages () "Toggle the visibility of all messages in the current thread. -If the current message is visible, hide all messages -- and vice versa." +If the current message is visible, hide all messages -- and vice versa. + +With a prefix argument, prompt for a tag and only show messages which have it." (interactive) - (let ((visible-p (notmuch-show-message-visible-p))) + (let ((visible-p (notmuch-show-message-visible-p)) + (filter (if current-prefix-arg + (notmuch-select-tag-with-completion "Filter by tag: ")))) (notmuch-show-mapc (lambda () (notmuch-show-message-visible (notmuch-show-get-message-properties) - (not visible-p))))) + (if current-prefix-arg + (member filter (notmuch-show-get-tags)) + (not visible-p)))))) ;; Put the current message properly into focus, but don't ;; obscure the presence of previous messages in the thread. -- 1.7.8.1