Re: [PATCH] emacs: jump: show key shortcut

Subject:Re: [PATCH] emacs: jump: show key shortcut

Date:Sun, 20 Dec 2015 14:50:11 +0200

To:Mark Walters ,notmuch@notmuchmail.org

Cc:

From:Jani Nikula


On Sun, 20 Dec 2015, Mark Walters <markwalters1009@gmail.com> wrote:
> This shows the jump key shortcut in the hello screen -- it underlines
> the letter, if it is present, in the search name.
> ---
>
> In id:1450031043-24038-1-git-send-email-jani@nikula.org Jani suggested
> showing jump key shortcuts in the hello screen. I like the idea but
> found the method a little cluttered.

Yes; it was a proof-of-concept.

> This is an alternative approach which underlines the relevant key in
> the search name (if it occurs).  This is relatively unintrusive
> (possibly even too hard to see) and is in line with how many other
> applications show shortcuts.
>
> I am guessing that most people choose a shortcut key with some
> relevance to the search name (eg i for inbox) so in most cases I think
> the shortcut will be shown. Of course multi-key shortcuts will not be shown.

While I understand your thinking, this falls short for me in several
ways.

First is that it's case sensitive. "i for Inbox" doesn't work. However
if you made it case insensitive, it might be silly for upper case
shortcuts.

Second is that automatic selection of the letter to underline is not
necessarily the logical one. "n for Inbox (notmuch)" underlines n in
"Inbox" instead of "notmuch". Hard to do anything about this. But it can
be confusing UI wise.

Third is that I do use characters not in the search name. For example "*
for flagged". I'm not happy that there is no fallback when the letter is
not present.

> If people think the underlining is too discreet then we could change
> the 'underline below to '(:foreground "red") or similar.

I don't think I would find the "fruit salad" visually pleasing. If
different colors were used, I'd prefer the letters were separate from
the name. Like in the jump search menu. I might like that the best.

Talking of the jump search menu, is it intentional that you underline
the keys there now too?

Finally, if this is supposed to be helpful to newcomers too, the user
won't know how to access these underlined shortcuts, as you have to hit
"j" first.


BR,
Jani.



>
> Best wishes
>
> Mark
>
>
>
> emacs/notmuch-hello.el | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 8bde808..de77730 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -572,7 +572,9 @@ with `notmuch-hello-query-counts'."
>  	      (if (> column-indent 0)
>  		  (widget-insert (make-string column-indent ? )))
>  	      (let* ((name (plist-get elem :name))
> +		     (key (plist-get elem :key))
>  		     (query (plist-get elem :query))
> +
>  		     (oldest-first (case (plist-get elem :sort-order)
>  				     (newest-first nil)
>  				     (oldest-first t)
> @@ -581,6 +583,12 @@ with `notmuch-hello-query-counts'."
>  		     (msg-count (plist-get elem :count)))
>  		(widget-insert (format "%8s "
>  				       (notmuch-hello-nice-number msg-count)))
> +		(save-match-data
> +		  (let ((case-fold-search nil))
> +		    (when (and key (string-match key name))
> +		      (add-face-text-property (match-beginning 0) (match-end 0)
> +					      'underline
> +					      nil name))))
>  		(widget-create 'push-button
>  			       :notify #'notmuch-hello-widget-search
>  			       :notmuch-search-terms query
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

Thread: