unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: hello: display jump key next to saved search when available
@ 2015-12-13 18:24 Jani Nikula
  2015-12-13 19:09 ` Andrew Burgess
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jani Nikula @ 2015-12-13 18:24 UTC (permalink / raw)
  To: notmuch

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)))
 		(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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-09 20:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-13 18:24 [PATCH] emacs: hello: display jump key next to saved search when available Jani Nikula
2015-12-13 19:09 ` Andrew Burgess
2015-12-20  9:26 ` [PATCH] emacs: jump: show key shortcut Mark Walters
2015-12-20 12:50   ` Jani Nikula
2016-02-07  9:20 ` [PATCH] emacs: hello: display jump key next to saved search when available David Edmondson
2016-02-07 10:58   ` Jani Nikula
2016-02-09 20:42     ` David Edmondson

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).