How can I write braces, { and }, in Emacs on Mac OS X with a scandinavian keyboard layout?

11

1

I can not write { and } in Emacs on my Macbook Air with a Swedish keyboard layout. In all other programs I do this by pressing alt + shift + ( for { and the corresponding keys with ) for }.

How can I type { and } in emacs?

Jonas

Posted 2011-02-02T21:36:34.687

Reputation: 21 007

Answers

10

I found the answer on StackOverflow.com:

Unable to type braces and square braces in emacs

(setq mac-option-modifier nil
      mac-command-modifier 'meta
      x-select-enable-clipboard t)

Jonas

Posted 2011-02-02T21:36:34.687

Reputation: 21 007

1

or this one so answer only affect the right tab

– AdrieanKhisbe – 2015-11-26T06:33:57.883

This works well for Emacs app – mico – 2013-10-11T08:01:45.247

1

You likely have this problem in all command-line applications and even your shell.

Disable Use Option as Meta key in Terminal » Preferences » Settings » Keyboard.


This might be a problem for you, so other options are key remapping solutions, utility applications like Butler where you can define key sequences and map them on self-defined hotkeys, or changing your keyboard using Ukelele.

Daniel Beck

Posted 2011-02-02T21:36:34.687

Reputation: 98 421

this works for emacs launched by the command line, but you lose the use of alt as meta and have to type e.g. esc-x instea of M-X – mico – 2013-10-11T08:03:07.160

@mico That's why this might be a problem for you. You need to choose an option here. Workarounds are Esc for Meta, or changing the keyboard layout. (Or, well, Emacs.app :-) ) – Daniel Beck – 2013-10-11T08:19:03.400

1

I tried fondling with my keypad and found out that ctrl + alt + 8 or 9 works for curly brackets { or }

Raman Paneru

Posted 2011-02-02T21:36:34.687

Reputation: 11

1fondling sounds creepy. – Carl B – 2014-08-15T16:15:34.153