emacskeyboardmacos-catalinaremap

Remap F1 to ESC (or meta) on 10.15.7 and emacs 27.1


MacBook Pro running 10.15.7. My beloved old external keyboard which emulates an IBM thinkpad (yes, with the pressure stick between g and h!) is starting to go. I have a backup keyboard but alas: ESC is half the size and I keep hitting F1. I wish to remap F1 to ESC. The other mappings (e.g. CapsLock -> Ctrl) are straightforward and working using the Settings->Keyboard->Modifier Keys capability.

Far and away the biggest use case here is ESC as meta in emacs, so if there is an "easier" means to change F1 to meta only in emacs I am good with that too.


Solution

  • if there is an "easier" means to change F1 to meta only in emacs I am good with that too.

    Try this:

    (define-key key-translation-map (kbd "<f1>") (kbd "ESC"))