我在 Mac OS Lion 上运行 Aquamacs。输入模式设置为本机。
当我将输入语言切换为俄语时,所有热键都停止工作。因为所有键都被解释为俄语键。有没有一种简单的方法可以让 ^C 不管我使用哪种输入语言都能正常工作?
切换到 emacs 输入模式并将 emacs 输入语言更改为俄语可以解决问题,但我无法使用操作系统原生语言切换。而且对于三种系统语言来说,这对我来说是个大问题。
答案1
我正在使用以下函数,改编自ru_emacs 发布:
(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)
警告:英文布局中一些之前未绑定的组合也将以这种方式重新映射,例如M-"
。M-@
由于它不会扩展到任何已绑定的组合,所以在我看来这不是什么大问题。