Created
May 12, 2021 11:29
-
-
Save dbushenko/00732e9b84a721d3fe26abc366ca8c74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))) | |
(reverse-input-method 'russian-computer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment