;;; bindings.el --- define standard key bindings and some variables
-;; Copyright (C) 1985-1987, 1992-1996, 1999-2013 Free Software
+;; Copyright (C) 1985-1987, 1992-1996, 1999-2014 Free Software
;; Foundation, Inc.
;; Maintainer: FSF
:type '(choice (const :tag "Logical-order cursor movement" nil)
(const :tag "Visual-order cursor movement" t))
:group 'display
- :version "24.5")
+ :version "24.4")
(defun right-char (&optional n)
"Move point N characters to the right (to the left if N is negative).
(define-key ctl-x-map "\C-x" 'exchange-point-and-mark)
(define-key ctl-x-map "\C-@" 'pop-global-mark)
+(define-key ctl-x-map " " 'rectangle-mark-mode)
(define-key ctl-x-map [?\C- ] 'pop-global-mark)
(define-key global-map "\C-n" 'next-line)
;; 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.
;(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