* [PATCH] emacs: introduce notmuch-search-by-tag
@ 2020-04-13 20:10 Keegan Carruthers-Smith
2020-04-14 12:13 ` David Edmondson
2020-04-16 11:12 ` David Bremner
0 siblings, 2 replies; 3+ messages in thread
From: Keegan Carruthers-Smith @ 2020-04-13 20:10 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] emacs: introduce notmuch-search-by-tag
2020-04-13 20:10 [PATCH] emacs: introduce notmuch-search-by-tag Keegan Carruthers-Smith
@ 2020-04-14 12:13 ` David Edmondson
2020-04-16 11:12 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Edmondson @ 2020-04-14 12:13 UTC (permalink / raw)
To: Keegan Carruthers-Smith, notmuch
On Monday, 2020-04-13 at 22:10:50 +02, Keegan Carruthers-Smith wrote:
> 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.
Reviewed-by: David Edmondson <dme@dme.org>
> ---
> 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
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
dme.
--
Why stay in college? Why go to night school?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] emacs: introduce notmuch-search-by-tag
2020-04-13 20:10 [PATCH] emacs: introduce notmuch-search-by-tag Keegan Carruthers-Smith
2020-04-14 12:13 ` David Edmondson
@ 2020-04-16 11:12 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2020-04-16 11:12 UTC (permalink / raw)
To: Keegan Carruthers-Smith, notmuch
Keegan Carruthers-Smith <keegan.csmith@gmail.com> writes:
> 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.
pushed
d
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-16 11:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13 20:10 [PATCH] emacs: introduce notmuch-search-by-tag Keegan Carruthers-Smith
2020-04-14 12:13 ` David Edmondson
2020-04-16 11:12 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).