Re: emacs, X, and Alt key
Mark Phillips <email@example.com> writes:
> I, like Thomas Vaughan, have been having problems getting emacs to
> recognise the Alt key under X. (The system is a Toshiba laptop.)
> Daniel Martin wrote:
> > What is the result of the following commands:
> > xmodmap
> > xmodmap -pke | grep -E '64|11'
> Here are the results:
> $ xmodmap
> xmodmap: up to 2 keys per modifier, (keycodes in parentheses):
> shift Shift_L (0x32), Shift_R (0x3e)
> lock Caps_Lock (0x42)
> control Control_L (0x25), Control_R (0x6d)
> mod1 Alt_L (0x40), Alt_R (0x71)
> mod2 Num_Lock (0x4d)
> mod4 Meta_L (0x73), Meta_R (0x74)
> mod5 Scroll_Lock (0x4e)
> $ xmodmap -pke | grep -E '64|11'
> keycode 64 = Alt_L
> keycode 113 = Alt_R
> keycode 115 = Meta_L
> keycode 116 = Meta_R
> I can't see anything particularly wrong here - but then, I'm no expert.
> Is something not right?
The `problem' is that the Alt keys aren't acting as the Meta keys -
instead, your X is configured to have the Windows-Logo keys act as
Meta. XFree86 does this if you tell it that you have a 104-key
keyboard (the keyboards without these amusing keys are 101-key
keyboards). Based on earlier correspondence with the original person
who posted this problem, I think that XFree86 may now default to
104-key keyboard behavior unless you tell it otherwise.
Anyway, there are two ways to fix this:
1) Tell XFree86 that you have a 101-key keyboard.
I wouldn't do this unless you actually do have a 101-key keyboard, as
I'm uncertain whether or not XFree86 will then freak out when you
accidentally hit one of the Win95 keys. It's probably still safe, but
you might want do just go with solution (2) anyway.
You can do this by editing /etc/X11/XF86Config - if you have something
a group of lines that begins with 'section "Keyboard"', change that
group of lines to read:
Actually, if you already have such a section I'd leave it in place and
just change the "XkbModel" line. If you don't have a us keyboard
layout, then either re-run XF86Setup and choose your keyboard
explicitly there, or use solution 2.
You'll need to restart X for the changes to take effect.
2) Just force the Alt keys to act as Meta
Add the following lines to the end of your /etc/X11/Xmodmap:
keycode 64 = Alt_L Meta_L
keycode 113 = Alt_R Meta_R
Then either restart X or issue the command:
Depending on how Emacs handles certain X events, you may need to exit
Emacs and restart it. (I use Xemacs, which handles these events
properly, and so don't know what Emacs does)
(and before someone jumps in to say that the above lines will mean
that you have to press Shift-Alt to use Meta, let me just point you to
the xmodmap man page, q.v.)
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to firstname.lastname@example.org .