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

Jani Nikula jani at nikula.org
Sun Dec 13 10:24:03 PST 2015


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



More information about the notmuch mailing list