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

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

Date: Sun, 07 Feb 2016 09:20:25 +0000

To: Jani Nikula, notmuch@notmuchmail.org

Cc:

From: David Edmondson


On Sun, Dec 13 2015, Jani Nikula <jani@nikula.org> wrote:
> Display the shortcut jump key next to the saved search name in notmuch
> hello, if one is defined for the saved search.

I quite like the idea of this (and Mark's followup), but I wonder about
the utility. With notmuch-jump, as soon as I hit `j' a list of the
possible keystrokes and the corresponding search is presented, so I
don't need to refer to the list in the hello buffer to know what to do.

>
> ---
>
> 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)))
>  		(widget-insert (format "%8s "
>  				       (notmuch-hello-nice-number msg-count)))
>  		(widget-create 'push-button
> @@ -587,8 +589,10 @@ with `notmuch-hello-query-counts'."
>  			       :notmuch-search-oldest-first oldest-first
>  			       :notmuch-search-type search-type
>  			       name)
> +		(when shortcut
> +		  (widget-insert shortcut))
>  		(setq column-indent
> -		      (1+ (max 0 (- column-width (length name)))))))
> +		      (1+ (max 0 (- column-width (length name) (length shortcut)))))))
>  	    (setq count (1+ count))
>  	    (when (eq (% count tags-per-line) 0)
>  	      (setq column-indent 0)
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

Thread: