From 8dbf6dae3190ec9d60d1b143987f1fdfb31c9de5 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 20 Dec 2015 09:26:27 +0000 Subject: [PATCH] [PATCH] emacs: jump: show key shortcut --- c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 | 120 ++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 diff --git a/c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 b/c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 new file mode 100644 index 000000000..7a07a4afa --- /dev/null +++ b/c6/d1cc0762a8c3894ba03f68bd6fa5d70af36f99 @@ -0,0 +1,120 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id BFA7E6DE1413 + for ; Sun, 20 Dec 2015 01:26:55 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.188 +X-Spam-Level: +X-Spam-Status: No, score=-0.188 tagged_above=-999 required=5 tests=[AWL=0.382, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, + RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id YNujHmIzAKSQ for ; + Sun, 20 Dec 2015 01:26:54 -0800 (PST) +Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com + [74.125.82.51]) by arlo.cworth.org (Postfix) with ESMTPS id 96CA96DE025F for + ; Sun, 20 Dec 2015 01:26:53 -0800 (PST) +Received: by mail-wm0-f51.google.com with SMTP id l126so35463480wml.1 + for ; Sun, 20 Dec 2015 01:26:53 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=rbTeY1hp3TUdMy/DVooE6uptRgaiYKYNmU0+jZPcKsY=; + b=VIOn4tSfwXjV4bgL1TVP3/vxpCHGJ628mCf4FP3zuFPCpd5wy96qTTgksSb3D8JhkK + le3QDkulrPkoD+j3tKXWBIrbZSwuwwXHqnygIC9lpqmY8CbdtY16vv6VvwYm/u6yeoph + vf8BV8+4aAFHor+rOPASmfsYh4djmP8qecnJXxNZLq3CIb3VyZ1AefIOyXWNlO5wGb3P + QoL3rXA0jtALV5vfRlxFV5LNvYBgzRYK54Cz0PjwrFAJny2Spi7uG7fGxYyWtEHkXQLs + Xqs67Nt73Nz1XcUnyiIEG4BM+eTbRUX85ppqvmtXITH/hJlWb/viMjk8Hyq2ql/1euK+ + BK6g== +X-Received: by 10.194.110.5 with SMTP id hw5mr16318748wjb.154.1450603612114; + Sun, 20 Dec 2015 01:26:52 -0800 (PST) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by smtp.gmail.com with ESMTPSA id u134sm14523773wmd.0.2015.12.20.01.26.50 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 20 Dec 2015 01:26:50 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: jump: show key shortcut +Date: Sun, 20 Dec 2015 09:26:27 +0000 +Message-Id: <1450603587-2950-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1450031043-24038-1-git-send-email-jani@nikula.org> +References: <1450031043-24038-1-git-send-email-jani@nikula.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 20 Dec 2015 09:26:55 -0000 + +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. + +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. + +If people think the underlining is too discreet then we could change the 'underline +below to '(:foreground "red") or similar. + +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 + -- 2.26.2