From: Juri Linkov <juri@linkov.net>
To: Matt Armstrong <matt@rfc20.org>
Cc: 46515@debbugs.gnu.org
Subject: bug#46515: Repeat mode
Date: Mon, 15 Feb 2021 11:17:31 +0200 [thread overview]
Message-ID: <87sg5xy85o.fsf@mail.linkov.net> (raw)
In-Reply-To: <m2tuqe6w0r.fsf@matts-mbp-2016.lan> (Matt Armstrong's message of "Sun, 14 Feb 2021 15:59:32 -0800")
[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]
> First thing: neat idea, and don't listen to me. :-)
Thanks, I really appreciate your help.
> Have you thought about making it more clear to the user that their keys
> are now doing different things? Most successful "modal" interfaces I
> have seen have clear indicators.
I have already thought about using prefix-command-echo-keystrokes-functions,
but failed to do this, so abandoned this attempt. I did not realize
it's possible to do this simply with messages like you pointed out here :-)
> One idea is to look at the other places in Emacs that already use
> `set-transient-map' in this way and try to be "at least as good" as
> those. `kmacro' and `indent-rigidly' are two reasonable examples. They
> print messages when active that describe the newly active key bindings.
I use `indent-rigidly' many times every day, but never noticed that
it prints the message
Indent region with <left>, <right>, S-<left>, or S-<right>.
It goes unnoticed maybe because it's displayed only once at its activation.
> repeat.el doesn't describe the key binding, but it does say a repeat
> mode is active. Kmacro is so smart that it aranges for the repeat key to
> be based on whatever key the command was invoked with.
Unlike `indent-rigidly', `kmacro' message
(Type e to repeat macro)
is displayed on every keypress, so it's a good example.
Now added in the following patch applied over the previous patch.
> As far as this general approach for creating small transient modes, I
> can't help but think it is too low level. An approach that had a bit
> more scafolding to it would let Emacs' help system describe it, and it
> might allow for a consistent way for Emacs to indicade they are active
> --- similar to how the conventions under major and minor work for
> "heavier" modes.
Currently I have no idea how this could be generalized. But simply
describing it in the help system should be quite easy to do,
so e.g. 'C-h k C-x o' could check for the command's repeat keymap
and add a help string about its repeatability.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: repeat-message.patch --]
[-- Type: text/x-diff, Size: 616 bytes --]
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 896a95197a..3c8be63c84 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -360,6 +360,9 @@ repeat-post-hook
(when (boundp repeat-map)
(setq repeat-map (symbol-value repeat-map)))
(let ((map (copy-keymap repeat-map)))
+ (let (keys)
+ (map-keymap (lambda (key _) (push (key-description (vector key)) keys)) map)
+ (message "To repeat type %s" (mapconcat #'identity keys ", ")))
(when repeat-exit-key
(define-key map repeat-exit-key 'ignore))
(set-transient-map map))))))
next prev parent reply other threads:[~2021-02-15 9:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-14 18:27 bug#46515: Repeat mode Juri Linkov
2021-02-14 23:59 ` Matt Armstrong
2021-02-15 9:17 ` Juri Linkov [this message]
2021-02-15 17:04 ` Juri Linkov
2021-02-16 16:49 ` Matt Armstrong
2021-02-17 18:05 ` Juri Linkov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sg5xy85o.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=46515@debbugs.gnu.org \
--cc=matt@rfc20.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.