Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 (Ctrl-S-whatever). This has some unpleasant effects such as moving cursors always setting marks, and translating Ctrl-h 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 Ctrl-S-whatever as Ctrl-whatever.

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
The problem with xmodmap was that it caused X server error with some combination of commands. But your example worked. Thanks. Could you tell me why you assign NoSymbol as a second keysym for keycode 66? – Pteromys Dec 16 '11 at 4:23
You can try xmodmap -pke | grep Control – favadi Dec 16 '11 at 4:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.