[PATCH] emacs: hello: display jump key next to saved search when available
authorJani Nikula <jani@nikula.org>
Sun, 13 Dec 2015 18:24:03 +0000 (20:24 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:50:12 +0000 (14:50 -0700)
8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 [new file with mode: 0644]

diff --git a/8d/41e83a2fa7cc54b817808a916699cdd6d4cee7 b/8d/41e83a2fa7cc54b817808a916699cdd6d4cee7
new file mode 100644 (file)
index 0000000..ae31c5c
--- /dev/null
@@ -0,0 +1,119 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 4DB266DE02CE\r
+ for <notmuch@notmuchmail.org>; Sun, 13 Dec 2015 10:24:53 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.541\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.541 tagged_above=-999 required=5 tests=[AWL=0.179,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id p16AULXVrfdI for <notmuch@notmuchmail.org>;\r
+ Sun, 13 Dec 2015 10:24:51 -0800 (PST)\r
+Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com\r
+ [74.125.82.41]) by arlo.cworth.org (Postfix) with ESMTPS id 58FCE6DE0231 for\r
+ <notmuch@notmuchmail.org>; Sun, 13 Dec 2015 10:24:51 -0800 (PST)\r
+Received: by mail-wm0-f41.google.com with SMTP id p66so17128577wmp.0\r
+ for <notmuch@notmuchmail.org>; Sun, 13 Dec 2015 10:24:51 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=nikula-org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id;\r
+ bh=cjrBHFkHaXV9uT60Dj0Zkr0yLctbkWT16ZM6XZdqChI=;\r
+ b=ETGAHlDrHJaXWU+X/8i6NQtGWFslVvFA7rI+oJKQFm+aeBdkTXATYOVkb6BjzYvLrl\r
+ QlfR/hN9IMfxSZPDqLwS5MQTtB+1njqVn6AZX2sbfdnGaqJP+oYJJnX42wVxDJye4GAm\r
+ NuMWtj5W9MDEp75hC9JxGXhktLKOA9OBfd/FnHLbcOL7hmM8VFbkNCotFCBBa8TARwXW\r
+ zzkrp3NgmSmIeop3tVA9w8o74xe0FyAjS7QRVC8zfax+DdCR5GOZB9PzP3Rfe7/22Wux\r
+ J7sIyot7TV+dHwiP8UPeiXM914hYc8HdqNQIgfdGjNE6eu9u99klfC6Y5hymr3QwEWhx\r
+ 1Q1Q==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
+ bh=cjrBHFkHaXV9uT60Dj0Zkr0yLctbkWT16ZM6XZdqChI=;\r
+ b=klngbPUvI2ozRSqEG3rgzF0e8fY1uaM9dYcrRudSFzXoxRauT2dh6qW+R/Ln2aWWFr\r
+ nBwXqVBVzDB5NGq37JGEqzpaHCj+Ly590E+8afYkIqY4aR1auN6egeeKLl86Wch3gaO3\r
+ jNIq+rptdf1WsXM319nOiQCnZLCNH+hOfIHSo3UDCM9eyXx/0WE7xxfV8ApjAEVgD8b0\r
+ ziXR2nlYwAB0J7YO6/XqKjKjjHgkLwGJGd0WiqqvT9r+c11u4c7quDED0ltPxKkZiKpy\r
+ iR6jlniPbdMwUXtJN7LnC6YeCaSp0yYabobcymf6hlxAVtcY8EHQx6qW5sb04PJY0nBO\r
+ eVHA==\r
+X-Gm-Message-State: ALoCoQmU58cet9STzH5KWDAaW9bWu1pR7xEYz1shh4OXIQjwsftvrotiHWzXX/JR4Sqm5HIbqFPjLKXdVrsQHhWKSaYm17B3Mw==\r
+X-Received: by 10.194.71.104 with SMTP id t8mr32008017wju.177.1450031089668;\r
+ Sun, 13 Dec 2015 10:24:49 -0800 (PST)\r
+Received: from localhost (mobile-access-bcee05-14.dhcp.inet.fi.\r
+ [188.238.5.14]) by smtp.gmail.com with ESMTPSA id\r
+ 67sm12752524wmm.6.2015.12.13.10.24.48 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 13 Dec 2015 10:24:49 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: hello: display jump key next to saved search when\r
+ available\r
+Date: Sun, 13 Dec 2015 20:24:03 +0200\r
+Message-Id: <1450031043-24038-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 13 Dec 2015 18:24:53 -0000\r
+\r
+Display the shortcut jump key next to the saved search name in notmuch\r
+hello, if one is defined for the saved search.\r
+\r
+---\r
+\r
+This is probably something with infinite bikeshedding\r
+potential. Therefore I just quickly hacked something together as a\r
+proof of concept. This displays the jump keys like this:\r
+\r
+       154 Inbox [j i]\r
+\r
+Maybe the space between "j" and the key is unnecessary? Maybe the "j"\r
+itself is unnecessary? Maybe the brackets are unnecessary? Maybe it\r
+could use some color? Does displaying these need to be customizable?\r
+Etc?\r
+---\r
+ emacs/notmuch-hello.el | 8 ++++++--\r
+ 1 file changed, 6 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 738baad23b20..3c5440331669 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -578,7 +578,9 @@ with `notmuch-hello-query-counts'."\r
+                                    (oldest-first t)\r
+                                    (otherwise notmuch-search-oldest-first)))\r
+                    (search-type (eq (plist-get elem :search-type) 'tree))\r
+-                   (msg-count (plist-get elem :count)))\r
++                   (msg-count (plist-get elem :count))\r
++                   (key (plist-get elem :key))\r
++                   (shortcut (if key (format " [j %s]" key) nil)))\r
+               (widget-insert (format "%8s "\r
+                                      (notmuch-hello-nice-number msg-count)))\r
+               (widget-create 'push-button\r
+@@ -587,8 +589,10 @@ with `notmuch-hello-query-counts'."\r
+                              :notmuch-search-oldest-first oldest-first\r
+                              :notmuch-search-type search-type\r
+                              name)\r
++              (when shortcut\r
++                (widget-insert shortcut))\r
+               (setq column-indent\r
+-                    (1+ (max 0 (- column-width (length name)))))))\r
++                    (1+ (max 0 (- column-width (length name) (length shortcut)))))))\r
+           (setq count (1+ count))\r
+           (when (eq (% count tags-per-line) 0)\r
+             (setq column-indent 0)\r
+-- \r
+2.1.4\r
+\r