2

According to the documentation, the key C-x 8 can be used to insert non-ASCII characters. For example, C-x 8 ' a will insert "á". Is it possible to change the prefix key to another (shorter) value, like for example, M-'? I find M-' to be easier to type than C-x 8, so this change would make inserting "á", "é", etc. much faster.

2 Answers 2

2

I'm no expert on this, and this might not be the right way to do it, but I think this will do it for you:

(define-key global-map (kbd "M-'") iso-transl-ctl-x-8-map)))

iso-transl-ctl-x-8-map is a variable whose value is the keymap I think you're looking for, to bind to M-'. iso-transl-ctl-x-8-map is the value returned by this:

(lookup-key key-translation-map (kbd "C-x 8")))
4
  • Thanks! That worked. I have an additional question though, it there any reason this isn't documented (changing the prefix)? Either I'm the only person that found C-x 8 to be a bit cumbersome to use, or I'm missing something. I also wasn't able to find my original question anywhere else.
    – Federico
    Commented Nov 15, 2018 at 12:05
  • You can accept the answer, if you think it answers the question. That can help others who have the same question. If you later get a better answer you can change the accepted answer (anytime, any number of times).
    – Drew
    Commented Nov 15, 2018 at 14:29
  • Probably everything about this is documented in the Elisp manual, but it might not be obvious where some of the info is located. Node Prefix Keys is one place to start, perhaps. And it helped me to know that I could use lookup-key to find what is bound to the key. And somehow I knew or guessed about key-translation-map. Node [Translation Keymaps](key-translation-map) talks about that. But you might want to suggest that the manual help more about this: M-x report-emacs-bug.
    – Drew
    Commented Nov 15, 2018 at 14:33
  • A more modern way to accomplish the same is (keymap-global-set "M-`" iso-transl-ctl-x-8-map). Since I'm at it, I discovered this while looking for the cause of error "<Multi_key> is undefined" when using Emacs under Xpra. Should you see that same error, the cure is (keymap-global-set "<Multi_key>" iso-transl-ctl-x-8-map) Commented Nov 24, 2023 at 11:05
3

Personally I use the Multi_key (sometimes called the "compose" key) under X11, which I have mapped to the right Alt key. That works everywhere rather than only in Emacs.

2
  • This seems more like a (useful) comment then an answer to the question. But in a sense it does answer it, telling how to get a compose key for more than just Emacs.
    – Drew
    Commented Nov 15, 2018 at 5:24
  • This worked as well, thanks. I was able to change the behaviour of the right Alt key by going into the GNOME Settings panel -> Keyboards -> Shortcuts -> Typing. I think I'll mark the other answer as accepted because it is more specific to my question, but both options serve the same purpose.
    – Federico
    Commented Nov 15, 2018 at 12:18

Your Answer

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

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