emacs -nw and xmonad key bindings

Just posting this up in case anyone comes looking for it. I use emacs -nw and xmonad together. It took me some trial and error to figure this out. I don't know if it applies to the gui-fied emacs. I have an IBM Model M keyboard (clickey clickey clickey), at 101 keys (no win key, and whatnot). The following incantation will get you a Left_Alt key that is recognised by emacs and a Right_Alt key recognised by xmonad. in Config.hs modMask = mod3Mask to assign the mod3 key as the key to control xmonad. In pc101 and pc105 (others?) XkbModel, XkbLayout "us", both Alt keys are assigned to mod1. You can check this with xmodmap which will show the current mappings. execute the following xmodmap expressions add mod1 = Alt_L (* see below) remove mod1 = Alt_R add mod1 = Alt_R you can either do these as individual `xmodmap -e 'expression'` instances or put them in a file and run `xmodmap file` I do it in my .xinitrc and it gives me control of both xmonad using Alt_R and emacs using Alt_L. Hope this helps someone. A * if you look at the output from xmodmap, there is already an instance of Alt_L attached to mod1. But it you run this 'add', you'll get a second one with a different keycode. I don't know why this is, but it's required to get emacs to recognize the key.

On Fri, Dec 07, 2007 at 07:27:36PM -0800, Andrew Sackville-West wrote:
Just posting this up in case anyone comes looking for it.
well crap. That didn't work. for some reason. now it seems I have to *remove* Alt_L altogether from mod1 with remove mod1 = Alt_L replacing the add mod1 = Alt_L and keeping the rest intact seems to have it. for now. A

On Fri, Dec 07, 2007 at 07:35:09PM -0800, Andrew Sackville-West wrote:
On Fri, Dec 07, 2007 at 07:27:36PM -0800, Andrew Sackville-West wrote:
Just posting this up in case anyone comes looking for it.
well crap. That didn't work.
for some reason.
now it seems I have to *remove* Alt_L altogether from mod1 with
remove mod1 = Alt_L
replacing the
add mod1 = Alt_L
and keeping the rest intact seems to have it.
for now.
In the interest of full disclosure... this doesn't seem to work either. blah. the current, really does work solution: map Caps Lock to mod3 with: clear lock add mod3 = Caps_Lock and leaving the rest default works quite nicely... And eliminates that horrible caps lock key too! sorry for the noise. A
participants (1)
-
Andrew Sackville-West