Talespin_Kit
Talespin_Kit

Reputation: 21877

Right ALT key not working as meta key in emacs

I have launched emacs (emacs -Q) in the console(Ctrl+Alt+F1). The "left Alt key" is working whereas the "right Alt key" is not working. How to fix the problem. I am running emacs on archlinux

Upvotes: 3

Views: 4940

Answers (3)

Machiestay
Machiestay

Reputation: 1

There is a workaround. Hit Esc key to activate the alt key as meta in emacs. So a command like M-v becomes Esc M-v

Upvotes: 0

Maksim Zholudev
Maksim Zholudev

Reputation: 671

The solution is described here:
http://www.joshstaiger.org/archives/2005/04/fixing_the_righ.html

It needs some modifications though (see item 3.2 below). Otherwise one would not be able to type anything in current console after the first press of [Right Alt]. If this happened to you, switch to other console (e.g. [Ctrl+Alt+F2]) and restore old keymap.

Here is the brief description of the modified solution:

  1. Save current keymap to file:
    dumpkeys >> mykmap
    and make a backup of it:
    cp mykmap oldkmap
  2. Capture [Right Alt] keycode using showkey command. Let's assume it is 100.
  3. Edit mykmap:
    1. Find the corresponding line:
      keycode 100 = AltGr
      and change it to:
      keycode 100 = Alt
    2. If the next line (or one of the next lines) is:
      alt keycode 100 = Compose
      remove it.
  4. Load new keymap:
    loadkeys mykmap
  5. Make the changes permanent (e.g. add the last command to ~/.bashrc).

Upvotes: 1

Nicolas Dudebout
Nicolas Dudebout

Reputation: 9262

This behavior is controlled by the keyboard layout you are using. In the layout that you are using, the left alt is Meta, whereas the right alt is Alt-graphic which allows you to enter accentuated character. Change your keyboard layout to one not using the right alt as Alt-graphic

Upvotes: 3

Related Questions