emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggested experimental test


From: Dmitry Gutov
Subject: Re: Suggested experimental test
Date: Sat, 27 Mar 2021 01:13:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 26.03.2021 12:34, Stefan Kangas wrote:
Dmitry Gutov <dgutov@yandex.ru> writes:

On 25.03.2021 23:11, Stefan Monnier wrote:
E.g. if it's bound to `C-c` it's fairly convenient to have bindings
within it of the form `C-<letter>`, but if it's bound to `c` instead
(assuming a a modal key-binding scheme like vi) then using `C-<letter>`
within it is much less convenient.

Interesting example. I wanted to say nobody will bind it to 'c', but
some people might decide to bind it to M-c instead.

Here's a thought: let's invent an extension of the kbd syntax which will
allow us to specify a modifier indirectly based on an entry in
key-translation-map. Like:

    (kbd "<mode-specific> <mode-specific-modifier>-c")

Even more backward-incompatible, but okay. But what to do if
<mode-specific> has no modifiers, like <menu> in Yuri's example?
Translate '<mode-specific-modifier>-c' to just 'c'? What happens to any
other simple 'c' entry in that keymap? Do we "flip" it to, say, 'C-c'?

How about something like:

     (mode-kbd "k")         ; C-c k
     (mode-kbd "mod k")     ; C-c C-k
     (mode-kbd "mod2 k")    ; C-c M-k
     (mode-kbd "mod3 k")    ; C-c S-k

Then mod, mod2 and mod3 could be set to use whatever modifier you want.
And mode-kbd would use the correct prefix.

This looks nice and flexible, but probably doesn't address the essence of Stefan's complaint. Example:

If mode-specific-modifier is 'C-c', 'C-c C-k' seems like an easy-to-hit sequence, suitable for a frequently-used command.

If mode-specific-modifier is <menu> or <f2>, '<menu> C-k' is less easy to hit than '<menu> k', for example, and the latter binding might be preferable.

But the package author already has to make a choice between (mode-kbd "k") and (mode-kbd "mod k") for a given command without knowing mode-specific-modifier in advance.

(BTW, it would be even nicer if we could evaluate such a form on
key lookup.)

Yuri mentioned key-translation-map already. Perhaps it or a similar new mechanism could be employed.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]