Ubuntu – How to enable ALT Gr key as ALT R for Emacs on Ubuntu 16.04

emacskeyboardkeyboard-layoutshortcut-keysunity

Emacs is famous for causing tendinitis, but one must remember that Ctrl and Alt come in pairs, at left and right of the keyboard 🙂

However, in Ubuntu 16.04, Alt R behavior is Alt Gr, messing with Emacs shortcuts. Thus usually I type Esc+X instead of Alt+X for the sake of my fist.

Thus, how could we:

  1. Configure ~/.emacs.d/init.el to understand Alt Gr as Alt R (or)
  2. Change the Alt Gr behavior for all applications

It is not about creating a shortcut, its about change the key mapping.

Best Answer

You can simply add English US (or any other layout without ALTGr) to your Text Entry settings.

Then, use the standard Super + Space to use Emacs with US keybindings. Unfortunately, you won't be able to use any local characters specific to your country.

enter image description here

Unfortunately, you can't just reconfigure ALTGr to ALT through emacs init. Altering your xkb map would be a solution but you didn't want that. This solution is more GUI-oriented. Enjoy.

Related Question