Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My Emacs uses the Mac alt/option key as the meta key. How do I set it to be the ⌘ key?

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted

This is what I have in my .emacs file:

;;; I prefer cmd key for meta
(setq mac-option-key-is-meta nil
      mac-command-key-is-meta t
      mac-command-modifier 'meta
      mac-option-modifier 'none)

(If you're unfamiliar, just add these lines to the file ~/.emacs (or create it if it doesn't exist), and restart Emacs.)

share|improve this answer
add comment

There is a setting that can be put into your .emacs: mac-command-key-is-meta that you can set to any non-nil value to enable.

Turning this setting on may cause strange characters to be printed, especially if you are running Leopard or higher. In order to correct that, you will need to set set-keyboard-coding-system to nil in your .emacs config.

share|improve this answer
add comment

If you're not averse to remapping the key globally, you could also look at Doublecommand. It permanently remaps keys as you specify across all applications. Being an emacs user on a MacBook Pro that doesn't have a right-hand CTRL key, I found this to be invaluable: I remapped my right-hand option/alt key to be a CTRL key. Works like a charm.

Of course if you want to avoid having it remapped globally, then the previous answer would probably be a better course to take.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.