4

I've bound a command to A-m, however some package that I load seems to modify input translation maps (input-decode-map, local-function-key-map, function-key-map, key-translation-map) that interfere with my intended behavior for the key, which is to run the command I've bound it to. Instead when I press A-m I get:

µ (translated from A-m) runs the command self-insert-command

My questions here are:

  1. How can I override this behavior if a package interferes like this?
  2. How can I quickly zero-in on which package has interfered in this way without the slow and painful comment-packages/restart emacs cycle?
  3. Prevent packages from overriding my custom settings-- or at least warn me when modifying the input maps so I can easily figure out which package without hunting?
2
  • 1
    I guess it is the builtin iso-transl package, that has defined the translation Oct 19, 2015 at 17:12
  • 1
    As for disabling it could you try (I tried to infer this from the source of the package so not sure it will work, especially since I do not know how to press 'A-m') (let ((vec (vconcat "m"))) (aset vec 0 (logior (aref vec 0) ?\A-\^@)) (define-key key-translation-map vec nil)) Oct 19, 2015 at 17:22

1 Answer 1

4

This behavior seems to introduced by the packages iso-transl. From the library's commentary (M-xfind-libraryRETiso-translRET)

Loading this package defines three ways of entering the non-ASCII printable characters with codes above 127: the prefix C-x 8, or the Alt key, or a dead accent key. For example, you can enter uppercase A-umlaut as C-x 8 " A' orAlt-" A' (if you have an Alt key) or `umlaut A' (if you have an umlaut/diaeresis key).

To disable the keybinding for A-m introduced by this package add something like this to your init file

(with-eval-after-load 'iso-transl
  (let ((vec (vconcat "m")))
    (aset vec 0 (logior (aref vec 0) ?\A-\^@))
    (define-key key-translation-map vec nil)))

Alternatively if you want to disable all key translation set iso-transl-char-map to nil before iso-transl has loaded. Other way would be map over iso-transl-char-map and unset keys like above, something like this

(dolist (transl-char iso-transl-char-map)
  (let ((vec (vconcat (car transl-char))))
    (aset vec 0 (logior (aref vec 0) ?\A-\^@))
    (define-key key-translation-map vec nil)))

After which your binding for the key will start working. This works, I tested by instructing emacs to use meta key as alt modifier and alt key as meta modifier by doing

(setq x-meta-keysym 'alt)
(setq x-alt-keysym 'meta)

Now M-m will act as A-m, to disable it do the reverse of the above.

I feel you should report this as a bug to emacs-devel, there should be a way to easily disable to the key translations introduced by iso-transl (perhaps there is a way, but I don't see it).

1
  • See my question emacs.stackexchange.com/q/61415/9874 Basically the function describe-bindings is the one that calls iso-transl in. As a fix Aquamacs patched iso-transl to allow it to be unloaded.
    – mmmmmm
    Dec 11, 2020 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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