4

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
4

Okay, so I found the real problem, and it was not Emacs. The thing is that I connect to a remote Ubuntu computer from my Windows computer using PuTTy and Xming. I found that it not only in Emacs that I had the keyboard layout issue, but in all programs that open in another window. The default setting in Xming was American keyboard layout. I changed the settings to Swedish layout, and the problem was solved! Sorry to bother you all with this non-Emacs problem...

  • That's what I was hoping in my comment... I'm kind of glad I didn't find the time to dig into it :-) – Jenny D Jun 30 '15 at 9:42
  • 1
    Not a problem -- thanks for posting the steps you used to solve the problem. There's a built-in delay on accepting one's own answers -- please do so after 48 hours so that we can mark the question as answered. – Dan Jun 30 '15 at 10:23
0

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)
(global-set-key (kbd "C-c d") digraph-map)

(define-key digraph-map "'e" '(lambda () (interactive) (insert "é")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.