0

I have a UK keyboard and this is setup and functioning on Ubuntu 21.04 with all of my apps. When I open emacs inside a terminal using emacs -nw it also correctly used the gb keyboard layout. However when opening emacs (27.2, built from repo) in a new frame from a call to emacs or clicking on the shortcut, it switches to a us keyboard layout. I am unable to get it to use a qwerty-gb layout.

I have tried setting in my config/calling interactively:

(setq quail-keyboard-layout 'pc105-uk)

However whatever I choose doesn't appear to have any impact.

I have also tried interactively calling set-input-method british. This has had some help in the shift+3 is now '£' instead of '#'. However other keys such as my '#' come out as '\'.

Please could I have some help?

13
  • Are you really using quail? It is not the default, and if you’re only typing English text it is never necessary.
    – db48x
    Commented Jun 21, 2021 at 9:42
  • I don't think I am using it. I was trying to set that variable because I got the impression from other threads I had seen that it might do what I wanted.
    – Muff2n
    Commented Jun 21, 2021 at 9:45
  • What does C-h I RET tell you?
    – db48x
    Commented Jun 21, 2021 at 9:51
  • And for that matter, what about C-h L RET?
    – db48x
    Commented Jun 21, 2021 at 9:58
  • Two answers because I normally use spacemacs, but I am trying to fix this problem on a default (no config) setup in the hopes if it being clearer. C-h I RET: When I start emacs with an empty .emacs.d, it says 'No input method is activated now.' C-h L RET: Default: 'English language environment [...]' Spacemacs, despite saying '(default current choice)' tells me about Burmese. I think this is a nonsensical answer. Edit: gah my newlines have disappeared, sorry that is ugly to read.
    – Muff2n
    Commented Jun 21, 2021 at 10:06

1 Answer 1

1

I managed to resolve this issue by explicitly calling setxkbmap -model pc105 -layout gb in the terminal before opening emacs. I have added this to my .bashrc

The following thread was my inspiration for trying this: Unable to change keyboard layout in EXWM/Emacs27.1

2
  • It would be extremely useful to know what OS you’re using, and how your other applications had the correct keyboard layout if X Windows didn’t. On Linux, all applications ultimately ask X Windows to translate keycodes into characters; this includes Emacs.
    – db48x
    Commented Jun 21, 2021 at 17:37
  • Ubuntu 21.04. Unfortunately I can't answer the second question, as I don't know about these things. It is a relatively new Ubuntu installation and I had just put all the language settings to english - gb and everything except emacs worked out of the box.
    – Muff2n
    Commented Jun 22, 2021 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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