From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CAZgAKTLlF7iKgAA0tVLHw (envelope-from ) for ; Mon, 13 Apr 2020 20:29:24 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yGvrNabLlF6saQAAbx9fmQ (envelope-from ) for ; Mon, 13 Apr 2020 20:29:26 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx2.migadu.com (Postfix) with ESMTPS id BF4E5681E06 for ; Mon, 13 Apr 2020 20:29:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 34C6E6DE0F76; Mon, 13 Apr 2020 13:29:19 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id laHMtcQ1bgwK; Mon, 13 Apr 2020 13:29:18 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 1C5B26DE0EB5; Mon, 13 Apr 2020 13:29:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D89906DE0EB5 for ; Mon, 13 Apr 2020 13:29:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bchSb_7PiKXj for ; Mon, 13 Apr 2020 13:29:15 -0700 (PDT) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by arlo.cworth.org (Postfix) with ESMTPS id 1D70B6DE0EB0 for ; Mon, 13 Apr 2020 13:29:15 -0700 (PDT) Received: by mail-lj1-f195.google.com with SMTP id n17so10108160lji.8 for ; Mon, 13 Apr 2020 13:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=1gKs2hPNgJTAH44i7mcqPKbNVwG0JTdSOPjtBEpwirA=; b=SCYxW8qzaR+xE+y9r7nPdcwt2MdWygcQZHSRNV+UhmYf9UrOZpc6O/tna1D+3FXDGQ oo1Jj8OPImNg7VkAQl9HWpPKocRNn1ht9YzZyq+m4OsEvbEZNgshhblOXVQ8x9kdhFn6 SxNd59zN66hAm8bql4G6lOeVVQ5NIXdd6hiXji22Y12o0WGGD7AIbn8XT7AkjMaMoM2x 0dBAgFyIqc9iIS+YS3Y1/GHF790vwL3y8LaSE7ZRJMiYW+LW7CTIgd7J3o0dzrGb0csQ U8HliQ0L9XKu6WoZWbTd3ECeYEvOg7vAy6roYq3zdymH/O/pbk9rOUsi+3NbOUI9P2Hx uBlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=1gKs2hPNgJTAH44i7mcqPKbNVwG0JTdSOPjtBEpwirA=; b=M+regT3S5FE0MnQCFe0vPk1/E1OuzlJLFTtY0q6QqrBfRei12OOpcQpECoLD7lOb+9 Hi71DUSUM3O/UQcc/0LNsPmX7h+CtURpQUQTFQ2yf2efHQiE04lmp2Xbm7wIZlwBBKLc gMCvkKJHM7soGU0XS6lMQKCK9ztGtaSXSC/yYRB2CRu5yTU1Fo7U8Vdb0Bsd1Bw9V3Ue OjaxhUQRIfn2zpInrwC4UQe6Mg2j0rWFxwhDs3rfrM5BWtwgc9noAltbvbjwj1JMiNI5 0Y7IHTlL/ZIfO4VYj0+d2dBbzU7KwAvcbflC7BejD4fJxS7H3X2ourC9cytVrKLbTfgt 6dsQ== X-Gm-Message-State: AGi0PuZVCMehVi2YgvyoIU7U78s5ZjMGDy35tG6E8H3c1r0WBz0bT56x JU/F9VJhxM/at/FleDXJ8GMTmsnTzu//qQ== X-Google-Smtp-Source: APiQypKJhumoVTZ2cJbscj91n4yLZzPEIVoLgl0116KI91CRXAuhOxpjTmOwq/6+Los0FuJqNjsWig== X-Received: by 2002:a2e:8999:: with SMTP id c25mr2414232lji.73.1586809752863; Mon, 13 Apr 2020 13:29:12 -0700 (PDT) Received: from real.local (102-65-13-236.ftth.web.africa. [102.65.13.236]) by smtp.gmail.com with ESMTPSA id z9sm11216416lfd.9.2020.04.13.13.29.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 13:29:12 -0700 (PDT) From: Keegan Carruthers-Smith To: notmuch@notmuchmail.org Subject: [PATCH] emacs: introduce notmuch-search-by-tag Date: Mon, 13 Apr 2020 22:10:50 +0200 Message-ID: MIME-Version: 1.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx2.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=SCYxW8qz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx2.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [0.09 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.45168631650144]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.18), country: US(-0.01), ip: 50.126.95.6(-0.45)]; R_SPF_ALLOW(-0.20)[+a]; DKIM_TRACE(0.00)[gmail.com:-]; MX_GOOD(-0.50)[cached: notmuchmail.org]; MAILLIST(-0.20)[mailman]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[keegancsmith@gmail.com,notmuch-bounces@notmuchmail.org]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; SPF_REPUTATION_HAM(0.00)[-0.45017068578779]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: qjUV6UPSMN9F This is like notmuch-search-filter-by-tag, but creates a new search rather than filtering the current search. We add this to notmuch-common-keymap since this can be used by many contexts. We bind to the key "t", which is the same key used by notmuch-search-filter-by-tag in notmuch-search-mode-map. This is done intentionally since the keybinding for notmuch-search-mode-map can be seen as a specialization of creating a new search. This change was motivated for use in "notmuch-hello". It is a more convenient way to search a tag than expanding the list of all tags. I also noticed many saved searches people use are simply tags. --- devel/emacs-keybindings.org | 2 +- emacs/notmuch-lib.el | 1 + emacs/notmuch.el | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org index 464b9467..65dfe0eb 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 | | +| t | notmuch-search-filter-by-tag | toggle-truncate-lines | notmuch-search-by-tag | | u | | | | | v | | | notmuch-show-view-all-mime-parts | | w | | notmuch-show-save-attachments | notmuch-show-save-attachments | diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 73b165e4..e085a06b 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -153,6 +153,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an (define-key map "?" 'notmuch-help) (define-key map "q" 'notmuch-bury-or-kill-this-buffer) (define-key map "s" 'notmuch-search) + (define-key map "t" 'notmuch-search-by-tag) (define-key map "z" 'notmuch-tree) (define-key map "u" 'notmuch-unthreaded) (define-key map "m" 'notmuch-mua-new-mail) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index f4789b4f..f5f03244 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -1077,6 +1077,12 @@ current search results AND that are tagged with the given tag." (list (notmuch-select-tag-with-completion "Filter by tag: " notmuch-search-query-string))) (notmuch-search (concat notmuch-search-query-string " and tag:" tag) notmuch-search-oldest-first)) +(defun notmuch-search-by-tag (tag) + "Display threads matching TAG in a notmuch-search buffer." + (interactive + (list (notmuch-select-tag-with-completion "Notmuch search tag: "))) + (notmuch-search (concat "tag:" tag))) + ;;;###autoload (defun notmuch () "Run notmuch and display saved searches, known tags, etc." -- 2.26.0