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 sILTNQfeCWEXdQEAgWs5BA (envelope-from ) for ; Wed, 04 Aug 2021 02:23:35 +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 aPiGMQfeCWGpZwAA1q6Kng (envelope-from ) for ; Wed, 04 Aug 2021 00:23:35 +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 86FFB2E1F for ; Wed, 4 Aug 2021 02:23:35 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2B83A2C0BD; Tue, 3 Aug 2021 20:23:27 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 6E9D12C096 for ; Tue, 3 Aug 2021 20:23:24 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:42520) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mB4gt-0000pC-Un; 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-LA; Tue, 03 Aug 2021 20:23:23 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH v3 2/2] emacs: new command notmuch-tree-filter-by-tag Date: Wed, 4 Aug 2021 01:23:09 +0100 Message-Id: <20210804002309.1059883-3-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: PNIIB3LNVY4B3ILY6VV4DMIS3J5S5DON X-Message-ID-Hash: PNIIB3LNVY4B3ILY6VV4DMIS3J5S5DON 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=1628036615; 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=kTZJjPL+H2B0wsjAva4g7OEXMjmCzNnM++mFA32h9jY=; b=IDgQmkxmO572/9uJyQ3qcQDfuppJRc/ans93SwJaPPMU4yjnVKCryOi0z+HOQhzhroLGT6 xkiyaJ94HlDgfVKFrf1jcMlynpRugnQC2No1Cmj7B4YMy6lhUkOfz/Pa37K+8KYuUAaVF5 Qf26cSBo2taXh3VEqChYmH7DrC5Cremq85wlrTsHL0URl1ZG9P+snTkH+U2XnFTCVNc9t9 ipB6mGtdnZTqIaKd6HIpkBuANbgZHdTTlX++gd3QiF9beo/TP1gojagH+L54BeGdnxnliS rY14iRDTizvdpyukcAnIRIVDqtkfB0nWf911VAkVrj0EBoLRO9vcQrTDswTQkg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628036615; a=rsa-sha256; cv=none; b=sIP8NYj0Rrb8EdgMeWlIApeh0CmxGHvytTKwHalta5bCw+GvGhweVVUzJrXsXf8ShrOSXm 3Wgoz/hLu7cDuXUTydw0HKQUVBVLeEbiTx8ub1OX61WJcJlp4ExONvFSBL+JX8CVp84Im/ w+P80D3wpUH/pGyaTFfYRbNpnIwx7QF4Q4Shfm9hJGVYsywwxmou26RIpDEl8ak0280ycO M0PL2dCNuvyiG3uPtRsrPRtbUujbbpzzIanXYTGyTFs+7cX8ppiK9MNz6rhw5meNCJFqcB S3tbhB9ggUrgrWAFIf5a5RDl3XA38g0l2jEgx4ClQJWFJ7ELpf+nF+NpyY99Vg== 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: 86FFB2E1F X-Spam-Score: -0.91 X-Migadu-Scanner: scn1.migadu.com X-TUID: /xqLylTjV75x --- doc/notmuch-emacs.rst | 4 ++++ emacs/notmuch-tree.el | 28 ++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst index 5accfa60..36dcb116 100644 --- a/doc/notmuch-emacs.rst +++ b/doc/notmuch-emacs.rst @@ -305,6 +305,10 @@ tags. ``l`` ``notmuch-tree-filter`` Filter or LIMIT the current search results based on an additional query string +``t`` ``notmuch-tree-filter-by-tag`` + Filter the current search results based on an additional tag + + ``g`` ``=`` Refresh the buffer diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index f2938330..01a77b71 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -321,10 +321,10 @@ then NAME behaves like CMD." ;; These bindings shadow common bindings with variants ;; that additionally close the message window. (define-key map [remap notmuch-bury-or-kill-this-buffer] 'notmuch-tree-quit) - (define-key map [remap notmuch-search] 'notmuch-tree-to-search) - (define-key map [remap notmuch-help] 'notmuch-tree-help) - (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail) - (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) + (define-key map [remap notmuch-search] 'notmuch-tree-to-search) + (define-key map [remap notmuch-help] 'notmuch-tree-help) + (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail) + (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) (define-key map "o" 'notmuch-tree-toggle-order) (define-key map "S" 'notmuch-search-from-tree-current-query) @@ -350,6 +350,7 @@ then NAME behaves like CMD." (define-key map "R" 'notmuch-tree-reply) (define-key map "V" 'notmuch-tree-view-raw-message) (define-key map "l" 'notmuch-tree-filter) + (define-key map "t" 'notmuch-tree-filter-by-tag) ;; The main tree view bindings (define-key map (kbd "RET") 'notmuch-tree-show-message) @@ -1184,6 +1185,25 @@ current search results AND the additional query string provided." grouped-query (concat grouped-original-query " and " grouped-query))))) +(defun notmuch-tree-filter-by-tag (tag) + "Filter the current search results based on a single TAG. + +Run a new search matching only messages that match the current +search results and that are also tagged with the given TAG." + (interactive + (list (notmuch-select-tag-with-completion "Filter by tag: " + notmuch-tree-basic-query))) + (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto))) + (notmuch-tree-close-message-window) + (notmuch-tree (concat notmuch-tree-basic-query " and tag:" tag) + notmuch-tree-query-context + nil + nil + nil + notmuch-tree-unthreaded + nil + notmuch-search-oldest-first))) + ;;; _ (provide 'notmuch-tree) -- 2.32.0