Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Alt key as Meta in emacs

Tags:

emacs

Somehow the emacs I'm using doesn't treat Alt as Meta. It only uses ESC for it. If I press Alt+x it will tell me "A-X" undefined. I tried to figure out how to map it to meta but got no luck on the web because in most of results from my search people take Alt as Meta by default. I guess something like this should work:

global-set-key Alt(?) 'meta

but I'm not sure how to represent Alt in lisp.. any help? Thanks!

like image 261
user1861088 Avatar asked Feb 06 '13 22:02

user1861088


Video Answer


1 Answers

Most solutions will tell you to change keymap at the X11 level. The wiki suffers from the problem of too much information. If you just want a solution that works only at the emacs level (quite useful for VNC/remote desktop), then add the below line to your emacs init file

;; Map Alt key to Meta
(setq x-alt-keysym 'meta)
like image 183
Imad Avatar answered Sep 20 '22 23:09

Imad