> Could you please give an example how you bind such key sequences as
> 'C-.' and 'C-ч й' in Emacs input modes? How they do translation
> to physical keys without using xkb?
I don't and that's the whole point. I want that when _any_ keymap
defines `M-q', this keybinding can be activated by typing M-q or M-й,
because this is the same physical key. Automatically.
`reverse-im' achieves this but _only_ for keys that type letters in
the second layout. E.g. M-/ (which I often use) won't work in Russian
layout because that physical letter types '.' in this layout.
> > What about functions like `read-event'? It returns integers if I press
> > M-[letter] or C-[letter].
> read-event is also implemented in C. But maybe I don't understand
> your question.
I mean, what about the cases where it is called from Elisp? It is
implemented in C, but also is publicly available.
I have come up with two ideas:
1. `read-event' and its internal C implementation grow an optional
parameter that says whether to return character as if being typed (as
now) or for keybinding use (i.e. from physical keys).
2. Alternatively, if this cannot be determined in advance (i.e. before
calling `read-event' etc.), these functions could set variable named sth.
like `last-keybinding-keycode'. Then the caller would use either the
return value (as now) or, if it wants, the value of the variable instead.