Aquamacs, MacOS и специальные клавиши для разных языков

329
Slava Nadvorny

Я использую Aquamacs на Mac OS Lion. Режим ввода установлен на родной.

Когда я переключаю язык ввода на русский, все горячие клавиши перестают работать. Поскольку все ключи интерпретируются как русские ключи. Есть ли простой способ заставить ^ C работать независимо от того, какой у меня язык ввода?

Переключение в режим ввода emacs и изменение языка ввода emacs на русский решает проблему, но тогда я не могу использовать переключение родного языка ОС. А с тремя системными языками это большая проблема для меня.

2

1 ответ на вопрос

0
dgutov

I'm using the following function, adapted from a ru_emacs posting:

(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) (setq normal-local-function-key-map (copy-keymap local-function-key-map)) (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* ignore-reverse-input-method around (read-passwd quoted-insert) (let ((local-function-key-map normal-local-function-key-map)) ad-do-it)) (reverse-input-method 'russian-computer) 

Caveat: some previously unbound combinations in the English layout will also be remapped this way, e.g. M-" to M-@. As it does not extend to any already bound combinations, not much of a problem IMO.