From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sJaJJQveCWEzdgEAgWs5BA (envelope-from ) for ; Wed, 04 Aug 2021 02:23:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SOFLIQveCWFjYwAA1q6Kng (envelope-from ) for ; Wed, 04 Aug 2021 00:23:39 +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 3093B6739 for ; Wed, 4 Aug 2021 02:23:39 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 105ED2C0C5; Tue, 3 Aug 2021 20:23:30 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id A3CF82C096 for ; Tue, 3 Aug 2021 20:23:24 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:42518) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mB4gt-0000p7-9E; Tue, 03 Aug 2021 20:23:23 -0400 Received: from [217.138.196.18] (port=3095 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 1mB4gt-0007gx-04; Tue, 03 Aug 2021 20:23:23 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH v3 1/2] emacs: new command notmuch-tree-filter Date: Wed, 4 Aug 2021 01:23:08 +0100 Message-Id: <20210804002309.1059883-2-jao@gnu.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210804002309.1059883-1-jao@gnu.org> References: <20210804002309.1059883-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: 3BBFUWX37I3UGU3TW7WIGANV7TPBGUZQ X-Message-ID-Hash: 3BBFUWX37I3UGU3TW7WIGANV7TPBGUZQ 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=1628036619; 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=QZLw/UfBI4j3pAb1H6iemS7OWN1mUDdc3WNHg1SKare5QJ3wKAHyZh4PW0OKMQnPRUOZh3 DA9OY3lTYHTQ+Te+u3fDMoMYbde5hCy3FWU0Ew6zQLSOJTC+IeIT1u1If+yvmchtektgSD e9YSqrs9JqwkWf0mk6e3YgbBWM7vtNJGAJxTGfOWjkEaEvifbaK8u7O2GTtEGtcrXZQue4 Kmj2WgG5fXorzs2t+59auJ9uLaw+kD6T4Wor1dzwm5PRLfKIdrwtZaZxtsIJRt6oybfucN /t93q9WMRDnlReDL/9fvYPCTRBMNsEyJBUA2v389gSLkcCrM2Y+wFPK1pzqGow== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628036619; a=rsa-sha256; cv=none; b=bRyHfoigl1LXymHzw0Zkx3A3CUKYLGCfJ4pw1ILP3mbtTOCfDdSkKXaSzh+kIKJ3Y6eqO8 gVVLdyLfly0aGO/tJn0L9pUSq6N5hyGeHlgI90JRWvcvkRi7Bc39GbIUx+XZPyXRlSh9+I VY6f3hrY6s94bOma5w8+SZY67eDiaEPAJiFld6ay6DGlALfzdkdT8ulL0d8J0kXvKZ5Nfo Of2iEbGeSRFoTa377fs8BT7uDVElE7H+defDyaMzHIYmcz/sc/zyRK0RdXmWGF72rbJEiG s6FXMyVv9rXjKlEThLPvT+YFE/Di6NyOF1J3cxcbJLfWCaz53j0/SBCttEBN1A== 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.91 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: 3093B6739 X-Spam-Score: -0.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: z/8IfzB5V4xi 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