From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KNphCrzOBWG5FwAAgWs5BA (envelope-from ) for ; Sun, 01 Aug 2021 00:29:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id YBPrBbzOBWFqVgAAB5/wlQ (envelope-from ) for ; Sat, 31 Jul 2021 22:29:16 +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 4D767B042 for ; Sun, 1 Aug 2021 00:29:15 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 0AD9E2B119; Sat, 31 Jul 2021 18:29:11 -0400 (EDT) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 4F32E2B100 for ; Sat, 31 Jul 2021 18:29:08 -0400 (EDT) Received: from fencepost.gnu.org ([2001:470:142:3::e]:60166) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9xTe-0004O1-Nu; Sat, 31 Jul 2021 18:29:06 -0400 Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:50280 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 1m9xTe-0008MK-EK; Sat, 31 Jul 2021 18:29:06 -0400 From: jao To: notmuch@notmuchmail.org Subject: [PATCH] emacs: new command notmuch-tree-filter Date: Sat, 31 Jul 2021 23:28:23 +0100 Message-Id: <20210731222823.184937-1-jao@gnu.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Message-ID-Hash: SGN3VXM5ROKQNFZ34QO2IBZ3FTYDZCI3 X-Message-ID-Hash: SGN3VXM5ROKQNFZ34QO2IBZ3FTYDZCI3 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=1627770555; 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=J/yYwsn4QamlbzVan2purbLLiBfVvJETbygfeCaAzO8=; b=ufdU0Z5Bgt0dz+qRA8yQhvU1+usgBwoVjcyJMQyNUPIRfXkEk8/QK45crE2/xOZTXLwYD7 RzFI6LZrdA9bSGbumq+SI3f4N+JajClWYsyznJlVCLfk3+ApHXSmjtJR0zwdUOXoP2vWDP c6hZBiDtfZhpqInbXVkaZOoRp+FuHrL5pXUBAXSOfH+1jXWzXcuWbYJMf0lCxgxW1hBkSU A/o8UHgkPiBbU9mEM1vJcbSVH+s/vGZFVmVYlzqlLov0IS+J3ZAZwQ0B1PC5LxJkXPf80b Zu/ZIhLN8rOPXQdTsrYOFb0VwWOzCe1W5JE0wQQwI8Ea5W/5Y5gYoGjv29h4uA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627770555; a=rsa-sha256; cv=none; b=W8/o3JDIhK1ufSjkL/BcyoWBKCcdb9kTREZNmo9obnbA4wNGGUM/F33KZjYSIVHJQiVEih dUtvl1trIJqmF6Ci7SGuGKxKgwKgJo/dPie7bOAaIn4ilXK+eRVaz+wTuBq3bNvM84wRDv Tdkwp95Pc3sCqfNUtWbz7QCBdxcL320H/CHS7fQCLAZEa0UV1waYhHD2XgeOnwGs6doShx Wn5s7AWjwP1ZperSslIOh398L3/nsCodE43q127S2SDSLrzzZG+fve5112rGGBByU6bcTN PrNU7jC/ANJmN1vbQUvnfsEXHz1GZ5880FAezJ3t0U5ZRtE0zCOUPa1hqwSKKQ== 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.88 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: 4D767B042 X-Spam-Score: -0.88 X-Migadu-Scanner: scn1.migadu.com X-TUID: NXiyytqj8mmK This command is analogous to notmuch-filter, but is defined on tree mode buffers. --- doc/notmuch-emacs.rst | 3 +++ emacs/notmuch-tree.el | 19 +++++++++++++++++++ 2 files changed, 22 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..a18b47ff 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,24 @@ The arguments are: (interactive) (notmuch-tree query query-context target buffer-name open-target t)) +(eval-when-compile + (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 ((grouped-query (notmuch-group-disjunctive-query-string query)) + (grouped-original-query (notmuch-group-disjunctive-query-string + (notmuch-tree-get-query)))) + (notmuch-tree (if (string= grouped-original-query "*") + grouped-query + (concat grouped-original-query " and " grouped-query)))))) + +(notmuch-tree--define-close-message-window-and + notmuch-tree-filter + notmuch-tree--filter) + ;;; _ (provide 'notmuch-tree) -- 2.32.0