Answer the question
In order to leave comments, you need to log in
What is the correct way to use keyboard shortcuts in Russian layout in Emacs?
I am using GNU Emacs 24 on ubuntu 14.04.
Input sources in the system: English (USA) and Russian (typewriter).
To use hotkeys in Emacs when switching the system layout to Russian (typewriter), I use the following code:
(defun reverse-input-method (input-method)
"Build the reverse mapping of single letters from INPUT-METHOD."
(interactive
(list (read-input-method-name "Use input method (default current): ")))
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(let ((current current-input-method)
(modifiers '(nil (control) (meta) (control meta))))
(when input-method
(activate-input-method input-method))
(when (and current-input-method quail-keyboard-layout)
(dolist (map (cdr (quail-map)))
(let* ((to (car map))
(from (quail-get-translation
(cadr map) (char-to-string to) 1)))
(when (and (characterp from) (characterp to))
(dolist (mod modifiers)
(define-key local-function-key-map
(vector (append mod (list from)))
(vector (append mod (list to)))))))))
(when input-method
(activate-input-method current))))
(defadvice read-passwd (around my-read-passwd act)
(let ((local-function-key-map nil))
ad-do-it))
(reverse-input-method 'russian-typewriter)
Answer the question
In order to leave comments, you need to log in
In fact, it's more correct to switch the layout in emacs itself via C-\ and not to fence crutches :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question