From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sIKIO4efIWGOlQAAgWs5BA (envelope-from ) for ; Sun, 22 Aug 2021 02:51:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id aE6uNoefIWE2MwAAB5/wlQ (envelope-from ) for ; Sun, 22 Aug 2021 00:51:19 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 87ACCBE73 for ; Sun, 22 Aug 2021 02:51:19 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 1714C20368; Sat, 21 Aug 2021 20:51:16 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 5AF7620352 for ; Sat, 21 Aug 2021 20:51:11 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:34844) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHbhe-0007b1-2b; Sat, 21 Aug 2021 20:51:10 -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 1mHbhd-0003cr-Pq; Sat, 21 Aug 2021 20:51:10 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH v4 2/2] emacs: new command notmuch-tree-filter-by-tag Date: Sun, 22 Aug 2021 01:50:49 +0100 Message-Id: <20210822005049.643219-2-jao@gnu.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210822005049.643219-1-jao@gnu.org> References: <20210822005049.643219-1-jao@gnu.org> MIME-Version: 1.0 Message-ID-Hash: Y3RC2NDKJPH3PEKFIASROVRJDPOWXN57 X-Message-ID-Hash: Y3RC2NDKJPH3PEKFIASROVRJDPOWXN57 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=1629593479; 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=8+UA8jTjJK7pVoy2x7IU3OQ5pez4lC9EVjlYLKIkVE8=; b=smoAFsZ1+N1D7zhX3W8YVd7rsVWAeWcSZsQlkBa1lVP0ZSCRE++EPXZN/7q+gM30ENSvh4 WSqYEBIK+gJoQOyMiZYu0Kr0znhcAtPmtGAPTBosr3upNExaSVh+wr7tjakJBUpesPr3aO CHHPp8lsyquKH4ixlZuvgoAntixKGLqCPIHuDF4DISGINWhUAKTbw96A8TS2fnpctzV0YC 8kEy23nujJjts/RnPZhuawnA7dnLgLZvGvFTghH7H1ISx3W5/U5UbuAa5vo+rl8zW4cfbL Y4uWjfYdpr4+GWsGnniFGcIHeF27JaEiLFvl3fBmSSOChwdbToM+nQBP+nI/9g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629593479; a=rsa-sha256; cv=none; b=YYEqwcCcyFL1G/EHATlT3jce68O3mzdMbBF/l+uidTuQ4PrpLzTEVUZC7fqinkDvzabFs4 2g4uY7ix1nRiWI8a5Yho/Hli5Gbkk3WgZ/bz+BaWqdQyoVZzbnIN8kbJPiixguiKBkw8GT aXJKlusWquynIT267yK72YlE4Tu7eBDotQu8x7bfyRHTLlsm9k8BwsmTZ/vl/GU9K8npDk JEHOVWN4KIVp963tNZQ7UWsGqD2lsBW/sACyZdBGtmYWdm3CJRpaT+62vCVqf05ALVf/8h rNZdPbDijkAH5oSWAe6UG295Fm9tyXxem+DMkKkyHWNjWSP9IZj3l6MYbzo7LQ== 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 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.83 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 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 87ACCBE73 X-Spam-Score: -0.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: bzeZgSkuVObN This new command for notmuch-tree-mode is analogous to notmuch-search-filter-by-tag, bound to "t" in notmuch-search-mode; it gets therefore the same "t" keybinding in notmuch-tree-mode (replacing the current assignment to notmuch-search-by-tag). --- devel/emacs-keybindings.org | 2 +- doc/notmuch-emacs.rst | 4 ++++ emacs/notmuch-tree.el | 28 ++++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org index 0ff4fdf5..2f73a198 100644 --- a/devel/emacs-keybindings.org +++ b/devel/emacs-keybindings.org @@ -20,7 +20,7 @@ | q | notmuch-bury-or-kill-this-buffer | notmuch-bury-or-kill-this-buffer | notmuch-bury-or-kill-this-buffer | | r | notmuch-search-reply-to-thread-sender | notmuch-show-reply-sender | notmuch-show-reply-sender | | s | notmuch-search | notmuch-search | notmuch-search | -| t | notmuch-search-filter-by-tag | toggle-truncate-lines | notmuch-search-by-tag | +| t | notmuch-search-filter-by-tag | toggle-truncate-lines | notmuch-tree-filter-by-tag | | u | | | | | v | | | notmuch-show-view-all-mime-parts | | w | | notmuch-show-save-attachments | notmuch-show-save-attachments | 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.33.0