I'm using two keyboard layouts - one for my mother-tongue language, and the other is english. Problem is when I switch to my mother-tongue language keyboard layout, and try to perform keybinding commands.
Is there an easy way to tell emacs to treat all commands (C-key,M-key etc) using the default, English-layout bindings?
I've seen this question: Emacs determining keyboard layout in which one answer simulates all keys to their according English-layout keys, but it is mentioned it eats up loading time, and the code is long, unreadable and thus probably error prone to me.
Help would me appreciated.
Many layout managers allow applications (or even windows) to keep their own layout. Use English layout for Emacs, to write in you mother tongue, switch the input method (C-\).
If the two layouts use completely different characters, then you can simply let Emacs try "the other character". E.g. if one key is b
in US layout but и
in the other layout, you can use:
(define-key function-key-map [?и] [?b])
(define-key function-key-map [?\C-и] [?\C-b])
(define-key function-key-map [?\M-и] [?\M-b])
(define-key function-key-map [?\M-\C-и] [?\M-\C-b])
OTOH if the two layout end up swapping some characters, Emacs would really need to know which layout is active in order to know whether or not to remap the key. I don't know enough about keyboard handling to know how to let Emacs tell you which layout is in use currently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With