Re: using "super" or "hyper" keys as "ctrl+meta"

Glynn Clements <[email protected]> Sat, 29 May 2004 17:23:01 +0100
Newsgroups gmane.emacs.xemacs.general
Message-ID <[email protected]>
Carleos Artime wrote:

> While remapping my keyboard to get an optimized layout for work with
> XEmacs [1], I am wondering whether it is possible to use a single key
> for the combination control+meta.
> 
> I think in X windows it is impossible to get a key producing both
> Ctrl and Meta (Mod4 in my config) modifiers.

It's technically possible to make a key produce both Ctrl and Mod4,
but then nothing will be able to figure out what those modifier bits
mean, so there isn't much point in doing it.

The only way in which an application can determine the meaning of the
"generic" modifier bits (Mod1 to Mod5) is from the keysyms to which
they are bound. E.g. if a modifier is bound to Meta_L and/or Meta_R,
then it's the Meta modifier.

You can't legitimately associate the Control modifier bit with any
keysyms except Control_L and Control_R. And you can't legitimately
associate any modifier bits except Control with those keys.

> So the only way would be mapping a key as Super (or Hyper) and let
> Emacs translate Super to Ctrl+Meta, that is, \s-a would be translated
> to \C-M-a.

AFAICT, you could do this via key-translation-map, although:

1. There isn't any way to use a "wildcard"; to translate Super-X to
Control-Meta-X for all values of X, you would need to iterate through
all possible values of X.

2. You would also have to map Shift-Super-X -> Shift-Control-Meta-X
separately; similarly for Alt and Hyper if you used those (none of the
standard bindings use them, AFAIK).

-- 
Glynn Clements <[email protected]>