Ubuntu – Disabling caps lock by setxkbmap makes it Shift key in Emacs

emacskeyboardUbuntuxfcexorg

I'm using GNU Emacs 23.2.1. within Xfce 4.8.0 (both coming from the Ubuntu Natty repository). I disable the CapsLock by running /usr/bin/setxkbmap -option "ctrl:nocaps" at the beginning of the Xfce session.

When I hit the CapsLock key with some other keys, Emacs treats it as if the Ctrl key and the Shift key is pressed (CtrlS-whatever). This has some unpleasant effects such as moving cursors always setting marks, and translating Ctrlh to Ctrl? not working.

Pressing the real Ctrl key on the keyboard works fine, and pressing both the real Ctrl and Shift key works the same way as pressing the real CapsLock key only.

I'd like the CapsLock to be precisely same as the Ctrl key. What should I do? I tweaked the X server setting in vain, so I think I might want to make Emacs treat CtrlS-whatever as Ctrl-whatever.

Best Answer

I use xmodmap and it work fine. Install xmodmap and have xmodmap .xmod autostart. Content of .xmod.

remove Lock = Caps_Lock
keycode 66 = Control_L NoSymbol Control_L
add Control = Control_L

Maybe your keycode is different.

Related Question