Mapping Caps Lock to Control from within Emacs on Windows

前端 未结 4 1313
無奈伤痛
無奈伤痛 2021-01-02 07:10

When reading either of these questions or the EmacsWiki article about mapping Caps Lock to Control in emacs in Windows, the best answers seem to involve the registry. My que

4条回答
  •  囚心锁ツ
    2021-01-02 07:23

    I believe it doesn't work because Windows (or X) doesn't pass an actual event for [capslock] or [control] - it's a modifier key, like [shift]. Pressing a modifier key doesn't cause the application to get a keystroke, but if you press a modifier and a second (non-modifier) key, then you get the keystroke.

    For example [a] and [A] are two different keys, one is the regular "a" and the other is essentially "shift-a". I'm sure you could set Windows up to have the "shift-a" actually send a "z" or something.

    Because [capslock], [control], [shift], [meta] are all modifier keys, they don't generate key events in and of themselves for the applications.

    In short, Emacs doesn't get a [control] key event that it can remap, it gets a C-a event. This is generally done by the obvious combination of [control] and [a] keys. But, the event could be generated by a different keystroke, say [F10] or even [y] (confusing, yes).

    This is how I understand it. Clarifications are welcome of course.

提交回复
热议问题