Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What’s a good way to deal with a german keyboard when using Emacs on Mac OS X?

Maybe it’s a bit weird to ask this question in English because my problem is a rather non-English one. I’m an Mac OS X user and I’m on my way to learning Emacs. I decided to use the Emacs 23.1 Cocoa build that by default uses the Mac keyboard’s alt/option key as the meta key. But because I am German and I’m using a German keyboard, of course, it get’s quite tricky to enter parantheses that are needed for programming extensively: { } [ ]

To get these characters on the German keyboard layout you have to press the following keys:

alt-5 for '['
alt-8 for '{'

which translate according to the situation described above to

M-5
M-8

both running the command digit-argument in Emacs.

I’m not really sure how to get around this issue. I know that you can change the actual key that should be used as the meta key (e.g. I could change the meta key to be the command key). But I think that every choice will come at a cost and have some obvious disadvantages as it “overrides” some predefined OS behaviour that may be needed while editing with a foreign language keyboard.

For now, the best option to me seems to be to use the CAPS LOCK key as the meta key as this choice doesn’t interfere with pre-existing key combinations.

What are your experiences concerning this issue? Do you (non-English) use an English keyboard (layout) while coding? Don’t you get mixed up with such context dependent keyboard layouts? Or do there exists some best practices which key to use as meta key on a German or similar keyboard? Or even some configuration options?

like image 369
tow8ie Avatar asked Feb 01 '10 21:02

tow8ie


People also ask

How do I use German keyboard on Mac English?

On your Mac, choose Apple menu > System Preferences, click Keyboard , then click Input Sources. Click the Add button , then search for a language (such as Chinese, Simplified). Select one or more input sources for each language you want to use. Click Add.

How do I type German Eszett on a Mac?

Make the Eszett letter (ß) on Mac / MacBook : The technique: Keep the Option ⌥ key pressed, then type on the letter S , which will bring up the "Eszett" : ß at the desired location.

What is the Meta key on Mac for Emacs?

On the Mac, Emacs can use either the option key or the command key as the META key. If the value of the variable mac-command-key-is-meta is non- nil (its default value), Emacs uses the command key as the META key. Otherwise it uses the option key as the META key.


1 Answers

I ended up using the suggestion here. It recommends using this in your emacs config

(setq ns-right-alternate-modifier nil)

to reset emacs' default behavior for the right alt/option key. This keeps emacs from reacting to this key, allowing the OS to deal with it the way it normally would.

I found this to be a good solution because it's consistent with the solution that people at my job implemented in iTerm to allow them to have both access to []{}|\ and also take advantage of the bash command line navigation bindings like alt/meta-f, -b, -d, and so on.

In short, by using this configuration, the only pain I had to suffer was getting used to using right-alt for []{}|\ and so on, and left-alt for emacs commands.

Lastly, the above link was specific to Aquamacs, but I can confirm that the vanilla emacs install for for Homebrew also supports the option.

like image 102
flooose Avatar answered Oct 02 '22 07:10

flooose