Emacs Modifier Keys in X-Windows

Most Irreal readers know that Emacs offers the Hyper and Super modifier keys for use in keybindings. Less well known is that there is also an Alt key. It’s not the Alt key that appears on most modern keyboards that Emacs usually maps to Meta but a separate modifier. Sadly, we no longer have the Space-cadet keyboard so special effort is required to map them to existing keys. Usually, this means giving special meanings to the right modifier keys and perhaps the Window key if you have one.

This isn’t too hard on macOS but can be tricky under X. Over at Emacs Notes there’s a very nice post that shows you how to use the xkb file to set up all these keys. It’s very fussy but only needs to be done once. After that, you can enjoy the full set of Emacs modifier keys.

In the Emacs Next Step branch there are variables to set up the modifiers so you can simply add them to your init.el, possibly conditionally evaluated, to make your configuration portable to other OS environments.

The utility of doing all this may not be clear but I use Hyper as a modifier for many operations—either existing or homegrown—that aren’t already mapped. Once you have these keys, you’ll find all sorts of uses for them.

This entry was posted in General and tagged . Bookmark the permalink.