]> git.cworth.org Git - notmuch-old/commitdiff
emacs: introduce notmuch-search-by-tag
authorKeegan Carruthers-Smith <keegan.csmith@gmail.com>
Mon, 13 Apr 2020 20:10:50 +0000 (22:10 +0200)
committerDavid Bremner <david@tethera.net>
Tue, 14 Apr 2020 15:29:31 +0000 (12:29 -0300)
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
emacs/notmuch-lib.el
emacs/notmuch.el

index 464b9467555655afe0171d268a4c835c85fe5fe7..65dfe0eb78215ec15f5057db1dd7a748cd8d16d6 100644 (file)
@@ -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           |
index 73b165e4e47f5072424033884907ca2132969cc8..e085a06bab1e58e7c35937c482e986c48d7d3a77 100644 (file)
@@ -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)
index f4789b4f4cdb65b4f485ed0d6b764754336259e7..f5f0324485f63296ad43403eb8ede17bbda952e8 100644 (file)
@@ -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."