From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SM6IBo4DBmH4gwAAgWs5BA (envelope-from ) for ; Sun, 01 Aug 2021 04:14:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 4P9jAo4DBmFVHQAA1q6Kng (envelope-from ) for ; Sun, 01 Aug 2021 02:14:38 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6E8CE95AD for ; Sun, 1 Aug 2021 04:14:37 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7C0B92B12B; Sat, 31 Jul 2021 22:14:34 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 2CFB72B11F for ; Sat, 31 Jul 2021 22:14:28 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:37124) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mA0zj-0002Lk-GJ; Sat, 31 Jul 2021 22:14:27 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:48394 helo=osgiliath.local) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mA0zj-0003be-7g; Sat, 31 Jul 2021 22:14:27 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH v2] emacs: new command notmuch-tree-filter Date: Sun, 1 Aug 2021 03:14:10 +0100 Message-Id: <20210801021410.261278-2-jao@gnu.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210801021410.261278-1-jao@gnu.org> References: <20210801021410.261278-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: O6YLEQFMJ5SNKGYCGSAO5Y6IMDYOSP2A X-Message-ID-Hash: O6YLEQFMJ5SNKGYCGSAO5Y6IMDYOSP2A X-MailFrom: jao@gnu.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jao X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1627784077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cgRErHE4Sa7603W3+TZlQqS47VST5arh5AMEOs/YrYk=; b=bVocgXnIaCb0eR4CjN/IgHOtbM9A0gRd5Z0Xd4IXx09zMyvH/cwESagqdEWszpZMU3EzvE fWa4iUpV7oL7Y3itvR4Y92QS0Sr/4VDs7fDt0OYeDxjT9iTfAO054nL60dNa+Gl9OKOD2v hmAwOvW+Wm2V1q3D+OTx0Vsai8PASVvPZXsRdsWBX1Q0OqaB2FNuM6QxoBt7ruW7AMgDh1 iroh2VIQ1OxgNLTMYTUrKJrVfAeqB0Tg2rKoUIB5SqTHIehuYc5dizbA1jQu2dbNXyxuq1 eLNql8nmCv8hXVrBieFlglYRgbkPfV7psrym7ix/7NUJraiio1Qee/OBqz0p1Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627784077; a=rsa-sha256; cv=none; b=IXVSqdRomEPLHHmCo5oxxyB6PgKwUivZ+Er/2D7RHFfQ1eds6lp/Wg80avSnaoCbSRJUtn xoxcanHLIuWy4nJHFRG4QQ8LK62z8xBLXPqYxuZXPz6ZkmZKZg5LUzT98/MM9R6dEbS5Zx M84fMeZL8SJC0vi4xnYOQMVzWuExTIUqZ100ifGUlQaM6qYEa+MgOURwe/m2+6Ek92LVDU a0lCscAVF1N+lRIvZu2pcgQnDfsoW8cLGMjZrEnB2hEX4a74QAfjH+VC8DmJG1q2p+lwoP /oYbjAyW+uScUmC6UUHOCwlEWHokHwZK6RdE/HwNFK/yEsaIMezhTZNqFEsM8w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 6E8CE95AD X-Spam-Score: -0.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3DlpGWa6O1Ny This command is analogous to notmuch-filter, but is defined on tree mode buffers. --- doc/notmuch-emacs.rst | 3 +++ emacs/notmuch-tree.el | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst index 952fe2a5..5accfa60 100644 --- a/doc/notmuch-emacs.rst +++ b/doc/notmuch-emacs.rst @@ -302,6 +302,9 @@ tags. ``o`` ``notmuch-tree-toggle-order`` |docstring::notmuch-tree-toggle-order| +``l`` ``notmuch-tree-filter`` + Filter or LIMIT the current search results based on an additional query string + ``g`` ``=`` Refresh the buffer diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index ef1ca4c5..f2938330 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -349,6 +349,7 @@ then NAME behaves like CMD." (define-key map "r" 'notmuch-tree-reply-sender) (define-key map "R" 'notmuch-tree-reply) (define-key map "V" 'notmuch-tree-view-raw-message) + (define-key map "l" 'notmuch-tree-filter) ;; The main tree view bindings (define-key map (kbd "RET") 'notmuch-tree-show-message) @@ -1168,6 +1169,21 @@ The arguments are: (interactive) (notmuch-tree query query-context target buffer-name open-target t)) +(defun notmuch-tree-filter (query) + "Filter or LIMIT the current search results based on an additional query string. + +Runs a new tree search matching only messages that match both the +current search results AND the additional query string provided." + (interactive (list (notmuch-read-query "Filter search: "))) + (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto)) + (grouped-query (notmuch-group-disjunctive-query-string query)) + (grouped-original-query (notmuch-group-disjunctive-query-string + (notmuch-tree-get-query)))) + (notmuch-tree-close-message-window) + (notmuch-tree (if (string= grouped-original-query "*") + grouped-query + (concat grouped-original-query " and " grouped-query))))) + ;;; _ (provide 'notmuch-tree) -- 2.32.0