2020-10-01
|~2 min read
|247 words
I recently started using Emacs on my mac and one of the things that was bothering me immediately was the Meta key. By default, meta is assigned to the Alt
key — but that’s not on a modern Mac’s keyboard, which meant that I was forced to use the ESC
key as my Meta.1
Fortunately, there are ways to remap the keys within Emacs - I just needed to figure out how.
When I first installed Emacs via Homebrew (the current recommendation appears to be to use the Cask version), I went looking for a .emacs
or one of the other standard files that Emacs uses for an Initialization File.
When I couldn’t find one, I decided, similar to a .zshrc
or .bashrc
, I could create my own. Once I did that, it was just a matter of figuring out how to remap the keys, and for that, there’s pretty good guidance within the Emacs tutorial, but what I found was the following:
(setq mac-option-modifier 'meta) ; set alt-key to meta
(setq mac-escape-modifier nil) ; set esc-key to nil
The second line is not strictly necessary I suppose. It wouldn’t hurt to have two meta keys, but this means that the ESC
key is now free to be remapped.
Just like that, I was able to remap keys within Emacs and specifically the meta key!
ESC
by Emacs by default.Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!