Re: [PATCH] emacs: jump: show key shortcut
authorJani Nikula <jani@nikula.org>
Sun, 20 Dec 2015 12:50:11 +0000 (14:50 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:50:14 +0000 (14:50 -0700)
85/f1173eb3b7c800d758ce4e3a75056dff2a3bba [new file with mode: 0644]

diff --git a/85/f1173eb3b7c800d758ce4e3a75056dff2a3bba b/85/f1173eb3b7c800d758ce4e3a75056dff2a3bba
new file mode 100644 (file)
index 0000000..d93718a
--- /dev/null
@@ -0,0 +1,178 @@
+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 896FE6DE1413\r
+ for <notmuch@notmuchmail.org>; Sun, 20 Dec 2015 04:51:05 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.542\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.542 tagged_above=-999 required=5 tests=[AWL=0.178,\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 NNd5K9bz1xOk for <notmuch@notmuchmail.org>;\r
+ Sun, 20 Dec 2015 04:51:02 -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 80D0B6DE025F for\r
+ <notmuch@notmuchmail.org>; Sun, 20 Dec 2015 04:51:02 -0800 (PST)\r
+Received: by mail-wm0-f51.google.com with SMTP id p187so38049623wmp.0\r
+ for <notmuch@notmuchmail.org>; Sun, 20 Dec 2015 04:51:02 -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:subject:in-reply-to:references:user-agent:date:message-id\r
+ :mime-version:content-type;\r
+ bh=PciPELuS4mRCaky6uoONOvWakccilkPEFxYQEiGwlXQ=;\r
+ b=ePZ3ijwKNstT5pnyWvrriJTYWD1/wD/S3X4qCkAG4LmASBad0UqLYTGGFylRiZwiQU\r
+ hMOwJALDwLuRb1bnT1ZcCtCyNS0XuBu8Qdfq9+hTospYGKcl/XiWQmlQXF4o9CUg/nY2\r
+ NfKu0wyUO0UO+HSHWO9DwXukectsiAtRhj+M8BGPyrjuRx5dUGNkVaiEpIkPwlqnh07x\r
+ QC0+YH9dMcmuPtJmeQSSlkBL0BJsAafL0NLgoWZFo3mJ8mUgoUVQHdaY++UiMjRJBoy9\r
+ Y1e8+bCIQXW1ZUZ7ZAU9rIpWlbetECjDO5VhMS2QuEtINsckkBvPfs84A/udaodx+I9o\r
+ jEPA==\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:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=PciPELuS4mRCaky6uoONOvWakccilkPEFxYQEiGwlXQ=;\r
+ b=ZbOSnhC1uAChQVaVki9ZequPCfMWktI1RRFDB+2pSaMQRex9iQJkQkQ5qjhSlSF0jD\r
+ rlAPybSWo2M4vBwglFgHEMIHu66//8rdfaH6N5EQr+X+9cd0TBU4S9aqX+c4bTiCkvSL\r
+ en3p+G2Dhf7BVDurNyiLzWOqaoEDKyAoZFMZ8TaDGL/gqae3b/ACecHmMtOZMdt9DARH\r
+ L5rFzympsG8KeHnlWwcyR2vP6fVYOLClH+ErGjbN+LfMH4gg2v+Q0mtCP+DMg6p0USwo\r
+ N8mIR0rBv44rsyrJmt6/Kcl1f0jHEmeKaY+cTmdUpKqmqU6DSctICEGx7YaMPKqyfo1j\r
+ Csng==\r
+X-Gm-Message-State: ALoCoQnbMZSvHhdclRt0zRSZjoaSdKQhQWhNds1qTWWrg4+gmV9PVS6iLIRCs24Zv2VaJiZqVzxcHkALyOjsx15vvYcbb4Mzeg==\r
+X-Received: by 10.28.46.87 with SMTP id u84mr2301486wmu.102.1450615859897;\r
+ Sun, 20 Dec 2015 04:50:59 -0800 (PST)\r
+Received: from localhost (mobile-access-bceea3-137.dhcp.inet.fi.\r
+ [188.238.163.137])\r
+ by smtp.gmail.com with ESMTPSA id dl8sm23423471wjb.29.2015.12.20.04.50.58\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 20 Dec 2015 04:50:58 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: jump: show key shortcut\r
+In-Reply-To: <1450603587-2950-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1450031043-24038-1-git-send-email-jani@nikula.org>\r
+ <1450603587-2950-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.21+27~g2b12735 (http://notmuchmail.org) Emacs/24.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 20 Dec 2015 14:50:11 +0200\r
+Message-ID: <878u4pxp18.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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 12:51:05 -0000\r
+\r
+On Sun, 20 Dec 2015, Mark Walters <markwalters1009@gmail.com> wrote:\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
+Yes; it was a proof-of-concept.\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
+While I understand your thinking, this falls short for me in several\r
+ways.\r
+\r
+First is that it's case sensitive. "i for Inbox" doesn't work. However\r
+if you made it case insensitive, it might be silly for upper case\r
+shortcuts.\r
+\r
+Second is that automatic selection of the letter to underline is not\r
+necessarily the logical one. "n for Inbox (notmuch)" underlines n in\r
+"Inbox" instead of "notmuch". Hard to do anything about this. But it can\r
+be confusing UI wise.\r
+\r
+Third is that I do use characters not in the search name. For example "*\r
+for flagged". I'm not happy that there is no fallback when the letter is\r
+not present.\r
+\r
+> If people think the underlining is too discreet then we could change\r
+> the 'underline below to '(:foreground "red") or similar.\r
+\r
+I don't think I would find the "fruit salad" visually pleasing. If\r
+different colors were used, I'd prefer the letters were separate from\r
+the name. Like in the jump search menu. I might like that the best.\r
+\r
+Talking of the jump search menu, is it intentional that you underline\r
+the keys there now too?\r
+\r
+Finally, if this is supposed to be helpful to newcomers too, the user\r
+won't know how to access these underlined shortcuts, as you have to hit\r
+"j" first.\r
+\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> https://notmuchmail.org/mailman/listinfo/notmuch\r