[PATCH] emacs: hello: display jump key next to saved search when available

Andrew Burgess andrew.burgess at embecosm.com
Sun Dec 13 11:09:46 PST 2015


* Jani Nikula <jani at nikula.org> [2015-12-13 20:24:03 +0200]:

> Display the shortcut jump key next to the saved search name in notmuch
> hello, if one is defined for the saved search.
> 
> ---
> 
> This is probably something with infinite bikeshedding
> potential. Therefore I just quickly hacked something together as a
> proof of concept. This displays the jump keys like this:
> 
> 	154 Inbox [j i]
> 
> Maybe the space between "j" and the key is unnecessary? Maybe the "j"
> itself is unnecessary? Maybe the brackets are unnecessary? Maybe it
> could use some color? Does displaying these need to be customizable?
> Etc?
> ---
>  emacs/notmuch-hello.el | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 738baad23b20..3c5440331669 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -578,7 +578,9 @@ with `notmuch-hello-query-counts'."
>  				     (oldest-first t)
>  				     (otherwise notmuch-search-oldest-first)))
>  		     (search-type (eq (plist-get elem :search-type) 'tree))
> -		     (msg-count (plist-get elem :count)))
> +		     (msg-count (plist-get elem :count))
> +		     (key (plist-get elem :key))
> +		     (shortcut (if key (format " [j %s]" key) nil)))

You should probably make use of `substitute-command-key' instead of
hard-coding the "j", something like (untested):

    (format (substitute-command-key " [\[notmuch-jump-search] %s]") key)

Thanks,
Andrew


More information about the notmuch mailing list