Commit c1916ff5 authored by Juri Linkov's avatar Juri Linkov
Browse files

* lisp/bindings.el: Map kp keys to non-kp keys systematically

with basic modifiers control, meta and shift.

Fixes: debbugs:14397
parent 26ec2ce9
2013-12-11 Juri Linkov <juri@jurta.org>
* bindings.el: Map kp keys to non-kp keys systematically
with basic modifiers control, meta and shift. (Bug#14397)
2013-12-11 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> (tiny change)
* net/eww.el (eww-mode-map): Instead of "Quit" show "Exit" and
......
......@@ -1056,36 +1056,30 @@ if `inhibit-field-text-motion' is non-nil."
;; FIXME: rather than list such mappings for every modifier-combination,
;; we should come up with a way to do it generically, something like
;; (define-key function-key-map [*-kp-home] [*-home])
(define-key function-key-map [kp-home] [home])
(define-key function-key-map [kp-left] [left])
(define-key function-key-map [kp-up] [up])
(define-key function-key-map [kp-right] [right])
(define-key function-key-map [kp-down] [down])
(define-key function-key-map [kp-prior] [prior])
(define-key function-key-map [kp-next] [next])
(define-key function-key-map [M-kp-next] [M-next])
(define-key function-key-map [kp-end] [end])
(define-key function-key-map [kp-begin] [begin])
(define-key function-key-map [kp-insert] [insert])
;; Currently we add keypad key combinations with basic modifiers
;; (to complement plain bindings in "Keypad support" section in simple.el)
;; Until [*-kp-home] is implemented, for more modifiers we could also use:
;; (todo-powerset '(control meta shift hyper super alt)) (Bug#14397)
(let ((modifiers '(nil (control) (meta) (control meta) (shift)
(control shift) (meta shift) (control meta shift)))
(keys '((kp-delete delete) (kp-insert insert)
(kp-end end) (kp-down down) (kp-next next)
(kp-left left) (kp-begin begin) (kp-right right)
(kp-home home) (kp-up up) (kp-prior prior)
(kp-enter enter) (kp-decimal ?.)
(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)
(kp-add +) (kp-subtract -) (kp-multiply *) (kp-divide /))))
(dolist (pair keys)
(dolist (mod modifiers)
(define-key function-key-map
(vector (append mod (list (nth 0 pair))))
(vector (append mod (list (nth 1 pair))))))))
(define-key function-key-map [backspace] [?\C-?])
(define-key function-key-map [delete] [?\C-?])
(define-key function-key-map [kp-delete] [?\C-?])
(define-key function-key-map [S-kp-end] [S-end])
(define-key function-key-map [S-kp-down] [S-down])
(define-key function-key-map [S-kp-next] [S-next])
(define-key function-key-map [S-kp-left] [S-left])
(define-key function-key-map [S-kp-right] [S-right])
(define-key function-key-map [S-kp-home] [S-home])
(define-key function-key-map [S-kp-up] [S-up])
(define-key function-key-map [S-kp-prior] [S-prior])
(define-key function-key-map [C-S-kp-end] [C-S-end])
(define-key function-key-map [C-S-kp-down] [C-S-down])
(define-key function-key-map [C-S-kp-next] [C-S-next])
(define-key function-key-map [C-S-kp-left] [C-S-left])
(define-key function-key-map [C-S-kp-right] [C-S-right])
(define-key function-key-map [C-S-kp-home] [C-S-home])
(define-key function-key-map [C-S-kp-up] [C-S-up])
(define-key function-key-map [C-S-kp-prior] [C-S-prior])
;; Don't bind shifted keypad numeric keys, they reportedly
;; interfere with the feature of some keyboards to produce
;; numbers when NumLock is off.
......@@ -1097,14 +1091,14 @@ if `inhibit-field-text-motion' is non-nil."
;(define-key function-key-map [S-kp-7] [S-home])
;(define-key function-key-map [S-kp-8] [S-up])
;(define-key function-key-map [S-kp-9] [S-prior])
(define-key function-key-map [C-S-kp-1] [C-S-end])
(define-key function-key-map [C-S-kp-2] [C-S-down])
(define-key function-key-map [C-S-kp-3] [C-S-next])
(define-key function-key-map [C-S-kp-4] [C-S-left])
(define-key function-key-map [C-S-kp-6] [C-S-right])
(define-key function-key-map [C-S-kp-7] [C-S-home])
(define-key function-key-map [C-S-kp-8] [C-S-up])
(define-key function-key-map [C-S-kp-9] [C-S-prior])
;(define-key function-key-map [C-S-kp-1] [C-S-end])
;(define-key function-key-map [C-S-kp-2] [C-S-down])
;(define-key function-key-map [C-S-kp-3] [C-S-next])
;(define-key function-key-map [C-S-kp-4] [C-S-left])
;(define-key function-key-map [C-S-kp-6] [C-S-right])
;(define-key function-key-map [C-S-kp-7] [C-S-home])
;(define-key function-key-map [C-S-kp-8] [C-S-up])
;(define-key function-key-map [C-S-kp-9] [C-S-prior])
;; Hitting C-SPC on text terminals, usually sends the ascii code 0 (aka C-@),
;; so we can't distinguish those two keys, but usually we consider C-SPC
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment