I'm running Aquamacs on Mac OS Lion. Input mode is set to native.

When I switch input language to Russian all hotkeys stop working. As all keys are interpreted as Russian keys. Is there a simple way to make ^C work no matter which input language I have?

Switching to emacs input mode and changing emacs input language to Russian solves the problem, but then I can't use OS native language switching. And with three system languages it's a big problem for me.


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."
   (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))

(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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.