From: Zhiwei Chen <chenzhiwei03@kuaishou.com>
To: Juri Linkov <juri@linkov.net>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Repeat lambda (was: Some minor suggestions to Tab Bar)
Date: Fri, 26 Mar 2021 06:00:23 +0000 [thread overview]
Message-ID: <8FE23CF4-90D9-4633-9CCF-B1FDD24DABCE@kuaishou.com> (raw)
In-Reply-To: <87blb969vc.fsf_-_@mail.linkov.net>
> On Mar 24, 2021, at 2:30 AM, Juri Linkov <juri@linkov.net> wrote:
>
>>> (defvar tab-bar-move-repeat-map
>>> (let ((map (make-sparse-keymap)))
>>> (define-key map "m" 'tab-move)
>>> (define-key map "M" (lambda ()
>>> (interactive)
>>> (tab-move -1)))
>>> map)
>>> "Keymap to repeat tab move key sequences `C-x t m m'.
>>> Used in `repeat-mode'.")
>>> (put 'tab-move 'repeat-map 'tab-bar-move-repeat-map)
>>
>> One nitpicking is that `C-x t m M m’ is not allowed
>> since `(tab-move -1)` hasn’t a `repeat-map’ property.
>> Maybe name it tab-move-prev and set the property?
>
> This can't be a general solution since there are other keymaps
> where repeating lambda is required.
>
> For example, other-window-repeat-map currently has no keybinding
> that could switch to navigating windows in the opposite direction.
> There were proposals to bind it to "O", but since there is no such
> command as "previous-window" to cycle windows backwards,
> using a lambda is required, but currently this doesn't work:
>
> (define-key other-window-repeat-map "O"
> (lambda ()
> (interactive)
> (other-window -1)))
>
> Stefan already asked about this, but I had no idea
> how it could be improved. Now I tried to set
> the KEEP-PRED arg of set-transient-map to t, and
> it seems both lambdas above can be used with this change:
>
> diff --git a/lisp/repeat.el b/lisp/repeat.el
> index 84a613da0c..4be4f766ef 100644
> --- a/lisp/repeat.el
> +++ b/lisp/repeat.el
> @@ -398,7 +398,7 @@ repeat-post-hook
> (when repeat-exit-key
> (define-key map repeat-exit-key 'ignore))
> - (set-transient-map map)))))))
> + (set-transient-map map t)))))))
So there is no help message “[Repeat with o, O, ...]” displayed when use 'C-x o O’.
Maybe we can wrap all commands in `repeat-map’ and show the help message first, then invoke the bound function?
--
Zhiwei Chen
next prev parent reply other threads:[~2021-03-26 6:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-14 22:51 Some minor suggestions to Tab Bar Gabriel
2021-03-15 9:24 ` Juri Linkov
2021-03-15 17:25 ` Juri Linkov
2021-03-17 17:46 ` Juri Linkov
2021-03-17 22:31 ` Ergus
2021-03-18 9:20 ` Juri Linkov
2021-03-19 0:28 ` Gabriel
2021-03-22 11:07 ` Zhiwei Chen
2021-03-22 18:47 ` Juri Linkov
2021-03-23 12:17 ` Zhiwei Chen
2021-03-23 18:30 ` Repeat lambda (was: Some minor suggestions to Tab Bar) Juri Linkov
2021-03-26 6:00 ` Zhiwei Chen [this message]
2021-03-29 19:28 ` Repeat lambda Juri Linkov
2021-04-05 21:03 ` Juri Linkov
2021-04-11 23:40 ` Ergus
2021-04-12 2:25 ` Zhiwei Chen
2021-04-12 16:32 ` Juri Linkov
2021-04-13 19:35 ` Juri Linkov
2021-04-13 23:45 ` T.V Raman
2021-04-14 17:51 ` Juri Linkov
2021-04-14 5:37 ` Richard Stallman
2021-04-14 7:18 ` peat lambda Kévin Le Gouguec
2021-04-14 7:59 ` Repeat lambda Kévin Le Gouguec
2021-04-16 5:10 ` peat lambda Richard Stallman
2021-04-14 17:56 ` Repeat lambda Juri Linkov
2021-04-15 5:24 ` Richard Stallman
2021-04-05 21:19 ` Some minor suggestions to Tab Bar Juri Linkov
2021-04-06 3:16 ` Zhiwei Chen
2021-03-24 20:19 ` Juri Linkov
2021-03-25 0:47 ` Gabriel
2021-03-25 9:31 ` Juri Linkov
2021-03-26 5:52 ` Gabriel
2021-03-29 19:20 ` 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=8FE23CF4-90D9-4633-9CCF-B1FDD24DABCE@kuaishou.com \
--to=chenzhiwei03@kuaishou.com \
--cc=emacs-devel@gnu.org \
--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 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.