From: Eshel Yaron <me@eshelyaron.com>
To: JD Smith <jdtsmith@gmail.com>
Cc: Juri Linkov <juri@linkov.net>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: master 0023891e842: Support hints in the :repeat keyword of defvar-keymap for repeat-mode
Date: Tue, 07 May 2024 19:13:10 +0200 [thread overview]
Message-ID: <m1jzk5o89l.fsf@dazzs-mbp.kpn> (raw)
In-Reply-To: <AAF4CF79-238D-499A-ADB4-5760AAA5229F@gmail.com> (JD Smith's message of "Tue, 7 May 2024 07:56:15 -0400")
JD Smith <jdtsmith@gmail.com> writes:
>>> Lastly, it could be nice to make the appearance of the prompt more in
>>> line with the read-multiple-choice prompt, which is conceptually very
>>> similar. Crucially, if the key is a character that occurs in the label,
>>> it's better, IMO, to highlight the first occurrence of that character in
>>> the label (as r-m-c does) than to prefix the label with that character.
>>> We can reuse rmc--add-key-description for that purpose, as follows:
>>
>> Nice idea. A small problem is that when hints are not used,
>> it inserts an extra space between the character and comma.
Well spotted. How about something like the diff below?
> That will save some space. Remember though that many times the key
> will not appear in the hint. In that case it would be nice to have a
> connector character of some kind, e.g. `|':expreg.
IIUC, the "connector character" in this example is the colon, right? If
so, in read-multiple-choice we use a space as the connector character,
do you think a colon is preferable?
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 412afc35ba7..efca965a533 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -558,14 +558,13 @@ repeat-echo-message-string
(format-message
"Repeat with %s%s"
(mapconcat (lambda (key-cmd)
- (let* ((key (car key-cmd))
- (cmd (cdr key-cmd))
- (hint (when (symbolp cmd)
- (get cmd 'repeat-hint))))
- (substitute-command-keys
- (format "\\`%s'%s"
- (key-description (vector key))
- (if hint (format ":%s" hint) "")))))
+ (let ((key (car key-cmd))
+ (cmd (cdr key-cmd)))
+ (if-let ((hint (and (symbolp cmd)
+ (get cmd 'repeat-hint))))
+ (cdr (rmc--add-key-description (list key hint)))
+ (propertize (key-description (vector key))
+ 'face 'read-multiple-choice-face))))
keys ", ")
(if repeat-exit-key
(substitute-command-keys
next prev parent reply other threads:[~2024-05-07 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <171463246897.31562.10434330482523385662@vcs2.savannah.gnu.org>
[not found] ` <20240502064749.54E89C1F9D4@vcs2.savannah.gnu.org>
2024-05-06 21:27 ` master 0023891e842: Support hints in the :repeat keyword of defvar-keymap for repeat-mode Eshel Yaron
2024-05-07 6:27 ` Juri Linkov
2024-05-07 11:56 ` JD Smith
2024-05-07 17:13 ` Eshel Yaron [this message]
2024-05-07 17:20 ` Juri Linkov
2024-05-08 16:40 ` Eshel Yaron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1jzk5o89l.fsf@dazzs-mbp.kpn \
--to=me@eshelyaron.com \
--cc=emacs-devel@gnu.org \
--cc=jdtsmith@gmail.com \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).