Subject: Re: bug#14397: 24.3; <C-kp-1> and <M-kp-1> undefined

From: Nicolas Richard <[email-masked]>
Date: Wed, 04 Dec 2013 11:59:45 +0100

Nicolas Richard <[email-masked]> writes:
>>>From emacs -Q, if I press control and the key 1 on the keypad, I see
> "<C-kp-1> is undefined" in the echo area. I expected that to start an
> digit-argument, just as hitting C-1 does.
>
> Same thing is true with Meta instead of Control.
>
> Why I use the keypad : on my belgian/french azerty keyboards, I need to
> hold shift in order to produce numbers from the second line of the
> keyboard ; I usually prefer to move my hand to the keypad.

Here's a cleaner snippet to achieve the same behaviour, now using
function-key-map :

(dotimes (i 10)
  (dolist (prefix (list "M" "C"))
    (define-key function-key-map
      (kbd (format "<%s-kp-%s>" prefix i))
      (kbd (format "%s-%d" prefix i)))))

Below is a patch to achieve this from simple.el.

diff --git a/lisp/simple.el b/lisp/simple.el
index 260c170..4cded6e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7130,6 +7130,10 @@ PREFIX is the string that represents this modifier in an event type symbol."
      (define-key function-key-map (vector keypad) (vector normal))))
  '((kp-0 ?0) (kp-1 ?1) (kp-2 ?2) (kp-3 ?3) (kp-4 ?4)
    (kp-5 ?5) (kp-6 ?6) (kp-7 ?7) (kp-8 ?8) (kp-9 ?9)
+   (M-kp-0 ?\M-0) (M-kp-1 ?\M-1) (M-kp-2 ?\M-2) (M-kp-3 ?\M-3) (M-kp-4 ?\M-4)
+   (M-kp-5 ?\M-5) (M-kp-6 ?\M-6) (M-kp-7 ?\M-7) (M-kp-8 ?\M-8) (M-kp-9 ?\M-9)
+   (C-kp-0 ?\C-0) (C-kp-1 ?\C-1) (C-kp-2 ?\C-2) (C-kp-3 ?\C-3) (C-kp-4 ?\C-4)
+   (C-kp-5 ?\C-5) (C-kp-6 ?\C-6) (C-kp-7 ?\C-7) (C-kp-8 ?\C-8) (C-kp-9 ?\C-9)
    (kp-space ?\s)
    (kp-tab ?\t)
    (kp-enter ?\r)

-- 
Nico.