# Using Emacs with Swedish keyboard

I am running GNU Emacs on Ubuntu, using a Swedish PC-keyboard. When I use swedish-keyboard as my input method, shift-key combinations work fine (e.g. S-7 gives the '/' character). But I have found a few things that doesn't work properly:

• Alt Gr-combinations: Alt Gr is interpreted as Meta-key, so when I press e.g. (Alt Gr + 7) I get M-7 instead of '{'. So I can't type '@','£','\$','{','[',']','}','\' or '|' using swedish-keyboard. Is there a way to separate Alt and Alt Gr-key such that Alt is Meta-key and Alt Gr can be used for extended character input?
• Misplaced characters: Pressing e.g. '<' on the keyboard produces a ';' character (shift+'<' gives ':'). Similarly, '§' gives '~', shift+'§' gives '^', '´' gives '§', shift+'´' gives '½', '¨' gives 'é', shift+'¨' gives 'É'. So there is no way to type '<','>','´','' or accented characters other than 'é' and 'É'.

Is there a way to solve these issues? The way I solve it now is simply to toggle between swedish and american input whenever I need to type any of the unaccessible characters in the swedish input mode.

P.S. I am a bit of a noob on Emacs, so carefully explained solutions are appreciated.

• One way to avoid those problems is to use the swedish-postfix input method instead of swedish-keyboard. That converts the sequences aa, ae, oe and e' to å, ä, ö and é, respectively, without affecting the keyboard layout. – legoscia Jun 24 '15 at 15:56
• Well, my main issue is not that I want to easily write the Swedish letters 'å', 'ä' and 'ö'. Rather, I wish to access special characters, e.g. '(', '{' and '<', using the shift and Alt Gr combinations that I am used to, namely those on a Swedish keyboard layout. On an American keyboard, '(' is written as S-9, whereas on a Swedish keyboard, it is written as S-8. – emmm Jun 24 '15 at 21:07
• Do you have these issues in other programs too, or is it just in emacs? – Jenny D Jun 25 '15 at 9:56
• Nope, only in Emacs as far as I have discovered. The terminal cooperates with my swedish keyboard, so if I use -nw option, it works fine as well. – emmm Jun 25 '15 at 10:47
• What makes this an issue? I've always used Emacs with Swedish keyboards, and have never had to bother with this. On different unix/linux flavours. (Not saying that it isn't a problem, just surprised.) – Meaningful Username Jun 26 '15 at 18:28

I have a Portuguese keyboard but I use only use the English layout for editing in Emacs. My solution to write special characters is using digraphs. I myself use evil, so I do C-k ' e to insert é, for example. If you do not use evil, you could do something like:
(define-prefix-command 'digraph-map)
`