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.

Federico
  • 187
  • 6

2 Answers2

2

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.

Stefan
  • 26,154
  • 3
  • 46
  • 84
  • 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 Nov 15 '18 at 05: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 Nov 15 '18 at 12:18
1

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")))
Drew
  • 75,699
  • 9
  • 109
  • 225
  • 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 Nov 15 '18 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 Nov 15 '18 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](https://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Keys.html) 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 Nov 15 '18 at 14:33