[PATCH] emacs: jump: show key shortcut
authorMark Walters <markwalters1009@gmail.com>
Sun, 20 Dec 2015 09:26:27 +0000 (09:26 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:50:13 +0000 (14:50 -0700)
c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 [new file with mode: 0644]

diff --git a/c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 b/c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99
new file mode 100644 (file)
index 0000000..7a07a4a
--- /dev/null
@@ -0,0 +1,120 @@
+Return-Path: <markwalters1009@gmail.com>\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 BFA7E6DE1413\r
+ for <notmuch@notmuchmail.org>; Sun, 20 Dec 2015 01:26:55 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.188\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.188 tagged_above=-999 required=5 tests=[AWL=0.382,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
+ 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 YNujHmIzAKSQ for <notmuch@notmuchmail.org>;\r
+ Sun, 20 Dec 2015 01:26:54 -0800 (PST)\r
+Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com\r
+ [74.125.82.51]) by arlo.cworth.org (Postfix) with ESMTPS id 96CA96DE025F for\r
+ <notmuch@notmuchmail.org>; Sun, 20 Dec 2015 01:26:53 -0800 (PST)\r
+Received: by mail-wm0-f51.google.com with SMTP id l126so35463480wml.1\r
+ for <notmuch@notmuchmail.org>; Sun, 20 Dec 2015 01:26:53 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=rbTeY1hp3TUdMy/DVooE6uptRgaiYKYNmU0+jZPcKsY=;\r
+ b=VIOn4tSfwXjV4bgL1TVP3/vxpCHGJ628mCf4FP3zuFPCpd5wy96qTTgksSb3D8JhkK\r
+ le3QDkulrPkoD+j3tKXWBIrbZSwuwwXHqnygIC9lpqmY8CbdtY16vv6VvwYm/u6yeoph\r
+ vf8BV8+4aAFHor+rOPASmfsYh4djmP8qecnJXxNZLq3CIb3VyZ1AefIOyXWNlO5wGb3P\r
+ QoL3rXA0jtALV5vfRlxFV5LNvYBgzRYK54Cz0PjwrFAJny2Spi7uG7fGxYyWtEHkXQLs\r
+ Xqs67Nt73Nz1XcUnyiIEG4BM+eTbRUX85ppqvmtXITH/hJlWb/viMjk8Hyq2ql/1euK+\r
+ BK6g==\r
+X-Received: by 10.194.110.5 with SMTP id hw5mr16318748wjb.154.1450603612114;\r
+ Sun, 20 Dec 2015 01:26:52 -0800 (PST)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by smtp.gmail.com with ESMTPSA id u134sm14523773wmd.0.2015.12.20.01.26.50\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sun, 20 Dec 2015 01:26:50 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: jump: show key shortcut\r
+Date: Sun, 20 Dec 2015 09:26:27 +0000\r
+Message-Id: <1450603587-2950-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1450031043-24038-1-git-send-email-jani@nikula.org>\r
+References: <1450031043-24038-1-git-send-email-jani@nikula.org>\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, 20 Dec 2015 09:26:55 -0000\r
+\r
+This shows the jump key shortcut in the hello screen -- it underlines\r
+the letter, if it is present, in the search name.\r
+---\r
+\r
+In id:1450031043-24038-1-git-send-email-jani@nikula.org Jani suggested\r
+showing jump key shortcuts in the hello screen. I like the idea but\r
+found the method a little cluttered.\r
+\r
+This is an alternative approach which underlines the relevant key in\r
+the search name (if it occurs).  This is relatively unintrusive\r
+(possibly even too hard to see) and is in line with how many other\r
+applications show shortcuts.\r
+\r
+I am guessing that most people choose a shortcut key with some\r
+relevance to the search name (eg i for inbox) so in most cases I think\r
+the shortcut will be shown. Of course multi-key shortcuts will not be shown.\r
+\r
+If people think the underlining is too discreet then we could change the 'underline\r
+below to '(:foreground "red") or similar.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+emacs/notmuch-hello.el | 8 ++++++++\r
+ 1 file changed, 8 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 8bde808..de77730 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -572,7 +572,9 @@ with `notmuch-hello-query-counts'."\r
+             (if (> column-indent 0)\r
+                 (widget-insert (make-string column-indent ? )))\r
+             (let* ((name (plist-get elem :name))\r
++                   (key (plist-get elem :key))\r
+                    (query (plist-get elem :query))\r
++\r
+                    (oldest-first (case (plist-get elem :sort-order)\r
+                                    (newest-first nil)\r
+                                    (oldest-first t)\r
+@@ -581,6 +583,12 @@ with `notmuch-hello-query-counts'."\r
+                    (msg-count (plist-get elem :count)))\r
+               (widget-insert (format "%8s "\r
+                                      (notmuch-hello-nice-number msg-count)))\r
++              (save-match-data\r
++                (let ((case-fold-search nil))\r
++                  (when (and key (string-match key name))\r
++                    (add-face-text-property (match-beginning 0) (match-end 0)\r
++                                            'underline\r
++                                            nil name))))\r
+               (widget-create 'push-button\r
+                              :notify #'notmuch-hello-widget-search\r
+                              :notmuch-search-terms query\r
+-- \r
+2.1.4\r
+\r