Apr 27, '04 10:51:00AM • Contributed by: dphaffner
First, put your remapping commands into an .Xmodmap file in your home directory ($HOME/.Xmodmap). With the help of the X11 program xev, I wrote a file that did what I wanted it to.
clear Mod1 keycode 66 = Meta_L add Mod1 = Meta_L
It tested perfectly in emacs after running
You can see what your mod (modifier) keys are mapped to using
Second, open up the X11 preferences from the menu on the top bar. On the "Input" tab, uncheck "Follow system keyboard layout" to allow your keymap changes to overlay on the default X keymap. Then restart X, fire up emacs, and your alt / option key, or others you remapped, should work. Here's a bit more background on what I've discovered:
Reading the man page for Xquartz, I learned that it copies the default aqua keyboard layout into an X11 keymap before startup. Xquartz appears to start up in a non-standard way compared to the standard X, and it won't let you override the keymap unless you allow it as I described above. Other postings elsewhere said you should copy the /etc -> X11 -> xinit -> xinitrc file to ~/.xinitrc and add xmodmap ~/.Xmodmap to the end But this is redundant -- the stock xinitrc script in /etc already checks for an xmodmap file in your home directory. I think those who posted this info were using a pre-Panther version of X11.
Some useful general info on Apple's X11 startup is in the Apple X11 FAQ under "Does X11.app process my ~/.xinitrc?"