I am migrating from GNU/Linux to Mac. I am using an MS Windows numeric keyboard (Logitech K200), and I cannot seem to map the keypad keys (kp-N) into anything (I had been doing that using global-set-key in my .emacs).

When I run describe-key and press a key I see it gets translated to the related number key, e.g. describe-key then press kp-5 yields: 5 (translated from <kp-5>) runs the command Custom-no-edit....

Similarly for Ctrl-/Meta-/Shift-. Adding e.g. (global-set-key <C-kp-5> 'goto-line) to my .emacs does not change anything that I can see, so I assume the translation is happening before the key mapping.

How can I disable the translation of all the kp-Ns so I can redfine them using global-set-key?

  • FWIW I did 4 different searches on emacs StackExhange and read through about 20 Q's & A's but got stuck trying to figure out where these keypad keys were being translated, let alone how to stop it (or change it). This was so trivial to do on linux, what am I missing?
    – JimKleck
    Commented Mar 20, 2020 at 21:27

1 Answer 1


Ok, I was led astray by the C-h k output (e.g. ...(translated from <kp-5>)...) which I took to mean that the syntax <kp-5> was OK for KEY in global-set-key. When I did (global-set-key [kp-5] 'goto-line) instead it works as I expect. Both forms had worked on the system I came from. I found this by going though my .emacs and testing the various global-set-key forms I had there. I still have the issue that Num Lock is not working, but since I use the keypad for mostly navigation I can live with that.

  • 1
    You can use (kbd "<kp-5>") or [kp-5] since the first expression returns the second one.
    – PRouleau
    Commented Jan 20, 2022 at 15:35
  • If you have not yet fixed your Num Lock issue, you may want to take a look at what I use in PEL to handle that. Look at the pel-numkpad.el code and at the Number Keypad PDF.
    – PRouleau
    Commented Jan 20, 2022 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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