Manolete
Manolete

Reputation: 3517

Emacs in Mac does not understand M-w, but I get ∑ instead

I would like to use M-w for copying the region I want to, however Emacs introduces symbol instead, even if I have manually set to .emacs file.

(global-set-key "\C-w" 'clipboard-kill-region)
(global-set-key "\M-w" 'clipboard-kill-ring-save)
(global-set-key "\C-y" 'clipboard-yank)

Any ideas of how to get rid of this function and use M-w for copying and M-y for pasting? I am using: GNU Emacs 24.3.1 Copyright (C) 2013 Free Software Foundation, Inc.

Upvotes: 0

Views: 1905

Answers (2)

Nicholas Riley
Nicholas Riley

Reputation: 44331

Note that the behavior you're seeing (Option used as a keyboard overlay for special characters) is the Mac standard. You're assuming that Option = Emacs Meta, but that's not always the case, nor do you necessarily want it to be the case.

If you don't need to use the Option key to insert characters, then you can certainly map it to Meta. How to do so depends on how you're running Emacs.

If you're using Emacs in the Mac Terminal, then in Preferences > Settings > Keyboard, check "Use option as meta key".

There are several GUI ports of Emacs for the Mac. In these, you have an additional choice, which is to use Command as Meta (since there's no conflict in most cases) and retain Option for typing special characters.

In the Emacs Mac port (my favorite, easiest to download from here), Command = Meta is the default. Use M-x customize-group mac to change Mac Option Modifier to meta (or any other Emacs modifier you want).

In the Emacs NS port (part of standard GNU Emacs, easiest to download from here), Option = Meta and Command = Super is the default, so my guess is you're probably not using this verison! You can change the modifier behavior in M-x customize-group ns with Ns Alternate (Option) Modifier and Ns Command Modifier.

If you're using a keyboard, such as Apple's, which expose the fn key to software, you can gain another Emacs modifier that way, by setting Mac (or Ns) Function Modifier to super or hyper.

Upvotes: 1

Albert Armea
Albert Armea

Reputation: 123

It looks like you're trying to disable the Mac option key special characters - you may have also noticed that if you do M-e followed by any vowel you get an accented vowel (like á, é, í, ó, ú), or if you do M-n followed by another n you get a Spanish style ñ.

This answer seems to have what you're looking for. Not sure if it will work on newer versions of OS X, but it should be worth a try.

Upvotes: 1

Related Questions