Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the meta key in Emacs?

Tags:

emacs

I've just started to put in the time to get to learn emacs. By default my meta key is bound to Esc, and I'm finding that really inconvenient. I read somewhere however that it's not a good idea to change the binding to Alt. Is that true? If not, how could I go about doing that?

like image 611
iman453 Avatar asked Nov 04 '10 03:11

iman453


2 Answers

For me, on my mac, it was bound to Alt by default, but I found it anoying because Alt is used for some special characters on Mac. I added these lines on my .emacs

(setq mac-function-modifier 'meta)
(setq mac-option-modifier nil)

Thus in your case, you would have to add this in your .emacs (I tried this solution, and it worked for me)

(setq mac-option-modifier 'meta) ; set alt-key to meta
(setq mac-escape-modifier nil) ; set esc-key to nil
like image 186
Laurent Hayez Avatar answered Oct 24 '22 18:10

Laurent Hayez


I'm guessing that you're on Mac, because I had the same problem. This is how I fixed it:

  1. Open Terminal
  2. Open up the preferences
  3. Open up the "Profiles" tab and choose the "Keyboard" tab with your current profile selected
  4. Below the long scroll box are a couple check boxes. Check "Use Option as Meta key."

I'm using OS X 10.11.5, so I don't know about older versions of Terminal. I imagine that it would be similar.

like image 26
kgrimes2 Avatar answered Oct 24 '22 18:10

kgrimes2