[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggested experimental test
From: |
Stefan Monnier |
Subject: |
Re: Suggested experimental test |
Date: |
Fri, 26 Mar 2021 20:02:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Perhaps we could instead do something with key-translation-map (or one of
> its friends) that works on existing keymaps?
>
> The use of 'menu-item' allows us to filter based on whether the key is first
> in the sequence:
>
> (define-key key-translation-map (kbd "<menu>") (kbd "C-c"))
> (define-key key-translation-map (kbd "C-c")
> `(menu-item "" ,(kbd "<C-c-translated>")
> :filter my--head-of-sequence-p))
> (global-set-key (kbd "<C-c-translated>") 'kill-ring-save)
While we can use such tricks, I think what we really want is to
abstract the keymap API such that we can provide keymaps whose elements
are computed dynamically.
There'd need to be at least 2 methods: `lookup-key`, and `map-keymap`,
and adding `where-is` would probably allow better behaviors (but could
introduce other problems given the way where-is currently works).
One application is to create a keymap (on function-key-map) that remaps
all the events of the form "modifiers + mouse-4" to "same-modifiers +
scroll-up".
Another would be a keymap that binds the same keys as some other keymap
except it requires some additional modifier or it removes a modifier, or
it capitalizes all the letters, or it transcribes all the cyrillic
letters to their "equivalent" ASCII, ...
We can already perform similar remappings via `key-translation-map` or
`function-key-map`, but these apply everywhere whereas if we could do them
inside a normal "key binding" keymap then it could be made to apply only
to bindings with a particular prefix.
Stefan
- Re: Suggested experimental test, (continued)
- Re: Suggested experimental test, Yuri Khan, 2021/03/25
- Re: Suggested experimental test, Stefan Monnier, 2021/03/25
- Re: Suggested experimental test, Dmitry Gutov, 2021/03/25
- Re: Suggested experimental test, Stefan Kangas, 2021/03/26
- Re: Suggested experimental test, Dmitry Gutov, 2021/03/26
- Re: Suggested experimental test, Dmitry Gutov, 2021/03/26
- Re: Suggested experimental test,
Stefan Monnier <=
- Re: Suggested experimental test, Dmitry Gutov, 2021/03/28
- Re: Suggested experimental test, Gregory Heytings, 2021/03/22
- Re: Suggested experimental test, Lars Ingebrigtsen, 2021/03/22
- Re: Suggested experimental test, Alfred M. Szmidt, 2021/03/22
- Re: Suggested experimental test, Thierry Volpiatto, 2021/03/22
- RE: [EXTERNAL] Re: Suggested experimental test, Stephan Mueller, 2021/03/22
- Re: Suggested experimental test, Lars Ingebrigtsen, 2021/03/22
- Re: Suggested experimental test, Eli Zaretskii, 2021/03/22
- Re: Suggested experimental test, Lars Ingebrigtsen, 2021/03/22
- Re: Suggested experimental test, Eli Zaretskii, 2021/03/22