[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Modified keypad keys
From: |
Juri Linkov |
Subject: |
Re: Modified keypad keys |
Date: |
Fri, 28 Sep 2012 18:29:27 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) |
>> I wonder what the rationale for that is?
>
> No good reason, AFAIK.
>
>> Would there be drawbacks in letting <M-kp-8> behave as M-8 as long as
>> there is no explicit binding for <M-kp-8>?
>
> No, other than the fact that doing it for all combinations of modifiers
> leads to adding lots and lots of entries to function-key-map.
Had the same problem and here is what I got so far.
Don't know if it's good to install something like this?
=== modified file 'lisp/bindings.el'
--- lisp/bindings.el 2012-09-23 10:21:34 +0000
+++ lisp/bindings.el 2012-09-28 15:27:42 +0000
@@ -1039,36 +1039,31 @@
;; 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])
+
+(defun powerset (list)
+ (if (null list)
+ '(nil)
+ (let ((ps (powerset (cdr list))))
+ (append ps (mapcar (lambda (e) (cons (car list) e)) ps)))))
+
+(let ((modifiers (powerset '(control meta super hyper)))
+ (keys '((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-insert . insert) (kp-delete . delete) (kp-enter . enter)
+ (kp-add . +) (kp-subtract . -) (kp-multiply . *) (kp-divide . /)
+ (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-0 . ?0)
+ (kp-decimal . .))))
+ (dolist (pair keys)
+ (dolist (mod modifiers)
+ (define-key function-key-map
+ (vector (append mod (list (car pair))))
+ (vector (append mod (list (cdr 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.
- Modified keypad keys, Per Starbäck, 2012/09/28
- Re: Modified keypad keys, Stefan Monnier, 2012/09/28
- Re: Modified keypad keys,
Juri Linkov <=
- Re: Modified keypad keys, Stefan Monnier, 2012/09/28
- Re: Modified keypad keys, Stefan Monnier, 2012/09/28
- Re: Modified keypad keys, Juri Linkov, 2012/09/29
- Re: Modified keypad keys, Stefan Monnier, 2012/09/29
- Re: Modified keypad keys, Juri Linkov, 2012/09/30
- Re: Modified keypad keys, Stefan Monnier, 2012/09/30