[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using xmodmap to set the Alt and Meta keys (emacs, X, and Alt key)



Mark Phillips wrote:

> I, like Thomas Vaughan, have been having problems getting emacs to
> recognise the Alt key under X.  (The system is a Toshiba laptop.)
> 
> keycode  64 = Alt_L
> keycode 113 = Alt_R
> keycode 115 = Meta_L
> keycode 116 = Meta_R

What does emacs say when you invoke describe-key: 
  `C-h k Alt-x'
  `C-h k Meta-x'

Do you *really* want an Alt key?  Or do you want a Meta key?
When Emacs has separate Alt and Meta keys, I think it doesn't use the 
Alt key as Meta anymore.  You appear to have both available

My keyboard has this bottom row; the keycode are as shown by the `xev' 
command:

        +----+ +---+ +---+ +-----------+ +---+ +---+ +----+ +----+
        |Ctrl| |Win| |Alt| | Space     | |Alt| |Win| |Menu| |Ctrl|
        +----+ +---+ +---+ +-----------+ +---+ +---+ +----+ +----+
keycode:  37    115   64                  113   116   117    109

If XFree is setup correctly, then the `Windows' key (identified above as 
Win), are Meta keys and the Alt keys are really seen in Emacs as Alt keys.
I use the Alt key to insert 8-bit characters, like "é".
The `Menu' key really works and is a synonym for `Meta-x' in Emacs
(and pops up a buffer-specific menu in XEmacs).

When XFree isn't properly set up, or gets confused for some reason, you can
use `xmodmap ~/.Xmodmap' in some X initialisation file.  Here's my
~/.Xmodmap file:

---
clear Mod1
clear Mod2
clear Mod3

keycode  64 = Alt_L
keycode 113 = Alt_R
keycode 115 = Meta_L
keycode 116 = Meta_R
keycode 117 = Menu

add Mod2 = Alt_L
add Mod2 = Alt_R
add Mod1 = Meta_L
add Mod1 = Meta_R

remove Lock = Caps_Lock
keysym Caps_Lock = Hyper_L
add Mod3 = Hyper_L

keycode 22 = BackSpace
---

In addition to setting Alt and Meta keys, I disable the silly Caps_Lock key
and set a `Hyper' key so I can define more user keys in Emacs (Most people
just set an extra Control key here).  Also, I make sure to set the
BackSpace key correctly.

Hope this helps you and others,
-- 
Peter Galbraith, research scientist             <galbraith@mixing.qc.dfo.ca>
Maurice-Lamontagne Institute, Department of Fisheries and Oceans Canada
P.O. Box 1000, Mont-Joli Qc, G5H 3Z4 Canada  418-775-0852 - FAX 418-775-0546


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: