From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GIAqH4KfIWEQlQAAgWs5BA (envelope-from ) for ; Sun, 22 Aug 2021 02:51:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sD3FGoKfIWHUEQAAbx9fmQ (envelope-from ) for ; Sun, 22 Aug 2021 00:51:14 +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 2C776BECD for ; Sun, 22 Aug 2021 02:51:14 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 58BBB1FD79; Sat, 21 Aug 2021 20:51:10 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id F27BE1FD77 for ; Sat, 21 Aug 2021 20:51:07 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:34834) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHbhZ-0007Xm-8V; Sat, 21 Aug 2021 20:51:05 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:45290 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 1mHbhY-0003cr-Va; Sat, 21 Aug 2021 20:51:05 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH v4 1/2] emacs: new command notmuch-tree-filter Date: Sun, 22 Aug 2021 01:50:48 +0100 Message-Id: <20210822005049.643219-1-jao@gnu.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Message-ID-Hash: 55YKNYSPNA3IJBG23PFPSMK2KDQWJLJB X-Message-ID-Hash: 55YKNYSPNA3IJBG23PFPSMK2KDQWJLJB 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=1629593474; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nnx+DuWNmPes96Kb5/0Ysr7PjRGZ+I0/+uzBcSoecVQ=; b=Ya6sqYPlqLsZqTQcsBAaT4aDuCMvwYO+j2+K9YAlWkEflS0tV1kRzH2OLLN6pXPpWhtemF emlkx5m12/ST/CSymbV6k+DPQC/VaTV7c2nyYeOBbKJJmf0bNhDxfYV811c0xI6+yeTquq 71y/snJC4byoyqEYNLh4bVeI3fH7Wy147bKmTeXqyhoTVGyFNUk4c8aU7uoqcGTqoEWY8y cxpLOpiwdeeXzSx2XAattUB4wmRSWcD0uN/WcqZHSqUnAIJY/Cdm3XRI7qVuuBPZm7Wx9J wOk3GClh/TyMdQ12VkPm2lVbAxsFZEWoGBrBZUSts5+xABKmA6w7PY8ACrgesg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629593474; a=rsa-sha256; cv=none; b=m1C05SHs8cZ+1BDeCyCTppxQ4nsnPls0A7pjhGxUe3K43Jf4N9Oor+NTn4YlQqfBT34Xy1 REuh0Vpd6XhvGgnjR4ApWqf7TNeNNx8HMURGRWvnav9tgRXHp1VSILBAPLtKI3Th1wnZ0V +UYf59mfXs+jQh2HdkOsNibH8EyrHrtL0k8GjqyFedbHO3ARDvtwpljo9vZkWnZI3IQFAC Oqp9cs2KyHcbS1ljTlfMYK1OCuGRDuoLiIqSc8lOkHD95P2/c+0+BU2E7FG/5+oGe8Dhl2 n6j/9Hyc11nI/ht0ZDqMEzAfC3qmlag1Xt30nG54r3cMgCY3JxlXNilQkn9hHQ== 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: 2C776BECD X-Spam-Score: -0.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: X7OEZD6o0Ypp This command is analogous to notmuch-filter, but is defined on tree mode buffers. --- devel/emacs-keybindings.org | 2 +- doc/notmuch-emacs.rst | 3 +++ emacs/notmuch-tree.el | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org index f7df3040..0ff4fdf5 100644 --- a/devel/emacs-keybindings.org +++ b/devel/emacs-keybindings.org @@ -12,7 +12,7 @@ | i | | | | | j | notmuch-jump-search | notmuch-jump-search | notmuch-jump-search | | k | notmuch-tag-jump | notmuch-tag-jump | notmuch-tag-jump | -| l | notmuch-search-filter | notmuch-show-filter-thread | | +| l | notmuch-search-filter | notmuch-show-filter-thread | notmuch-tree-filter | | m | notmuch-mua-new-mail | notmuch-mua-new-mail | notmuch-mua-new-mail | | n | notmuch-search-next-thread | notmuch-show-next-open-message | notmuch-tree-next-matching-message | | o | notmuch-search-toggle-order | | notmuch-tree-toggle-order | 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.33.0