I'm using Emacs 26.1 on Windows 10.

Sometimes, the capslock key stops working: The key is activated but typing letters does not result in capital letters being inserted into a buffer. It works with the number keys above the regular keys though.


Caps-Lock is activated (observable in other applications and through the keyboard indicator led)
Using German keyboard layout
Typing 'a'  -> 'a' is inserted (wrong)
Typing '1'  -> '!" is inserted (ok)

This happens about twice a day but I was not able to figure out what triggers the condition. The only way to get the key fully working again in emacs is quitting and restarting emacs.

Switching the keyboard layout to English (and back) does not change anything.

Note that I have not remapped the capslock key. I just want the regular capslock functionality.

Any ideas on how to get this "un-stuck" or how to diagnose the problem further are appreciated.

  • this is puzzling. Emacs can't detect if the caps lock key is pressed or not This happens at the OS level - if the caps lock key is pressed, the OS sends a capital letter to Emacs, but Emacs doesn't know if it was made with a shift key or the caps lock. What happens if you try C-h k a when this problem is occurring?
    – Tyler
    Commented Mar 22, 2019 at 11:55
  • Do you have the same problem in non-Emacs applications?
    – Dan
    Commented Mar 22, 2019 at 13:08
  • Yeah, I was puzzled by this as well. Only Emacs is affected, other applications work fine
    – Geier
    Commented Mar 23, 2019 at 12:21
  • With the problem active, C-h k a gives: a runs the command self-insert-command...
    – Geier
    Commented Mar 26, 2019 at 9:23
  • I have the same issue. The issue is present only in emacs application. Repeated activating or deactivating caps lock doesnt make any effect. I have to terminate and run again emacs to restore Caps Lock key function. Commented Aug 6, 2021 at 10:06

1 Answer 1


I have no clue what is causing the problem, but I found a possible migitation here:

(define-minor-mode caps-mode
  "Toggle caps mode.
With no argument, this command toggles the mode.
Non-null prefix argument turns on the mode.
Null prefix argument turns off the mode.

When caps mode is enabled, all letters are inserted in their
capitalized form."
  :init-value nil
  :lighter " Caps"
  :keymap '(
            ("a" . (lambda () (interactive) (insert (string-to-char "A"))))
            ("b" . (lambda () (interactive) (insert (string-to-char "B"))))
            ("c" . (lambda () (interactive) (insert (string-to-char "C"))))
            ("d" . (lambda () (interactive) (insert (string-to-char "D"))))
            ("e" . (lambda () (interactive) (insert (string-to-char "E"))))
            ("f" . (lambda () (interactive) (insert (string-to-char "F"))))
            ("g" . (lambda () (interactive) (insert (string-to-char "G"))))
            ("h" . (lambda () (interactive) (insert (string-to-char "H"))))
            ("i" . (lambda () (interactive) (insert (string-to-char "I"))))
            ("j" . (lambda () (interactive) (insert (string-to-char "J"))))
            ("k" . (lambda () (interactive) (insert (string-to-char "K"))))
            ("l" . (lambda () (interactive) (insert (string-to-char "L"))))
            ("m" . (lambda () (interactive) (insert (string-to-char "M"))))
            ("n" . (lambda () (interactive) (insert (string-to-char "N"))))
            ("o" . (lambda () (interactive) (insert (string-to-char "O"))))
            ("p" . (lambda () (interactive) (insert (string-to-char "P"))))
            ("q" . (lambda () (interactive) (insert (string-to-char "Q"))))
            ("r" . (lambda () (interactive) (insert (string-to-char "R"))))
            ("s" . (lambda () (interactive) (insert (string-to-char "S"))))
            ("t" . (lambda () (interactive) (insert (string-to-char "T"))))
            ("u" . (lambda () (interactive) (insert (string-to-char "U"))))
            ("v" . (lambda () (interactive) (insert (string-to-char "V"))))
            ("w" . (lambda () (interactive) (insert (string-to-char "W"))))
            ("x" . (lambda () (interactive) (insert (string-to-char "X"))))
            ("y" . (lambda () (interactive) (insert (string-to-char "Y"))))
            ("z" . (lambda () (interactive) (insert (string-to-char "Z"))))))

You could also look here, for another migitation.

Btw. you did not say, what happens, when you press the caps lock key again. ;)

  • When I press capslock again, capslock is globally deactivated, also in emacs. But when pressing the key a third time, capslock again doesn't fully work in emacs.
    – Geier
    Commented Mar 23, 2019 at 12:23
  • Then, this woraround will suffice, until you find the real reason for this behaviour.
    – jue
    Commented Mar 25, 2019 at 14:38
  • It's not really usable because I can't bind capslock to this mode, can I?
    – Geier
    Commented Mar 26, 2019 at 7:42
  • You need to switch of and on this mode manually. The better way, of course, would be to to find the error in your emacs configuration. Dissect your config file and try to reproduce the bug.
    – jue
    Commented Mar 28, 2019 at 19:59

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