[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Precise behavior of function-key-map and friends

**From**: |
Stefan Monnier |

**Subject**: |
Precise behavior of function-key-map and friends |

**Date**: |
Wed, 05 Jun 2002 21:44:42 -0400 |

1 - The documentation says that function-key-map bindings only apply
if there is no corresponding binding in the global map.
What about the case where I have a function-key-map binding that
turns C-x into C-c. Clearly C-x C-c will stays as it is, but
what about C-x w (which has no binding) ?
Currently C-x w is left as is. Should function-key-map remap it
to C-c w ?
2 - key-translation-map says that the translation is always done, whether
or not it has a binding in the normal maps.
Among other things, this means that when you hit C-x 8 it will
keep reading input because there's a chance that it will end up
in a sequence of keys that can be translated by key-translation-map.
So you can hit C-c C-x 8 ' e to enter the (unbound) C-c é key sequence.
But note that C-x C-x 8 ' e does not work, because C-x C-x is bound
and read-key-sequence will not keep reading input in this case.
3 - function-key-map applies only if the current key-sequence has
no binding in the normal maps. But since key-translation-map
is applied unconditionally afterwards, the "has a binding" condition
is not easy to decide (and is done incorrectly). E.g. say I have
a function-key-mapping from X to Z and a key-translation-mapping from
X to Z and from Z to X.
If there's a global key binding for Z but not for X, a keyboard
entry of X will be function-key-mapped to Z and then
key-translation-mapped to X and the result will be "ding".
OTOH if there's a binding for X but not for Z, the X entry
will not be function-key-mapped, so it will be key-translation-mapped to Z
and there again, the result will be "ding".
Stefan

**Precise behavior of function-key-map and friends**,
*Stefan Monnier* **<=**