Command Key to Meta in Emacs

How can I change meta key from alt to cmd on Mac in Emacs 24?

Use the following,

 (setq mac-option-modifier 'super)
(setq mac-command-modifier 'meta)

Using emacs on a Mac. Option is not being recognized as the Meta key?

If you are using emacs from your terminal, there is an option (Preferences...) that will allow you tu use Option key as Meta key. Here's a link to a nice article explaining it it depth.

How to set CMD key-binding in Emacs?

You can set it with something like:

(global-set-key (kbd "s-<right>") 'move-end-of-line)

"s" being the reference to your command key.

PS: I'm not on my mac right now so I'm not sure what exactly you need to write to set it to the specific keys you mentioned to move it to the end of line but command is represented by an s in emacs.

EDIT
Just tested this on my mac. This is the exact code you'd write (if you wanted to set it globally) to bind your command key + right arrow key to move your cursor to the end of line.

If the above doesn't work, you could also try

(global-set-key (kbd "\s <right>") 'move-end-of-line)

The difference between the one above and this one is that the above equates to CMD+right and this one equates to CMD and then release CMD and hit the right key. Both work on OS X on my system.

Also check out the following post to set your CMD as the super key in case your Emacs doesn't already register it as such:

http://ergoemacs.org/emacs/emacs_hyper_super_keys.html

Specifically, you can use the following code to set up your CMD key as Super:

(setq mac-command-modifier 'super)

How to change the meta key in Emacs?

It's bound to Alt by default for me, and I have no problems with that. Are you on a Mac perhaps? There it is bound to one of the other keys like option.

If you are on a mac, the way to change the key will probably vary based on which version of Emacs you're using--e.g., I think changing it in the terminal would be different than changing it on one of the windowed varieties.

Another thing to try: http://www.jwz.org/xkeycaps/
Look through the keyboard layout with this and see if any key is assigned to Meta. If not, try assigning it; otherwise try changing it. I haven't actually tried this, but it looks promising.

Emacs Meta-Key in Terminal

Have you tried?

(define-key global-map (kbd "M-8") "{")
(define-key global-map (kbd "M-9") "}")

Emacs in Mac OS Lion terminal - map right command key to meta

There appears to be keyremap4macbook that may save you some time if you must use emacs in terminal. I can take no credit for this, but this guy can



Related Topics



Leave a reply



Submit