# HG changeset patch # User Martin Rudalics # Date 1220345341 0 # Node ID e763543ca81738c9fedb39579516205fc2fcc20d # Parent 9d28724e2c5293f58b4c3b9795ccfcbb851b8381 (calc-dispatch-map): Fix handling of upcased and control-prefixed keys. (Bug #835) diff -r 9d28724e2c52 -r e763543ca817 lisp/calc/calc.el --- a/lisp/calc/calc.el Tue Sep 02 08:13:20 2008 +0000 +++ b/lisp/calc/calc.el Tue Sep 02 08:49:01 2008 +0000 @@ -1026,7 +1026,7 @@ (define-key map "\C-j" 'calc-over) (define-key map "\C-y" 'calc-yank) (define-key map [mouse-2] 'calc-yank) - + (mapc (lambda (x) (define-key map (char-to-string x) 'undefined)) "lOW") (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key)) @@ -1096,11 +1096,17 @@ (defvar calc-dispatch-map (let ((map (make-keymap))) (mapc (lambda (x) - (define-key map (char-to-string (car x)) (cdr x)) - (when (string-match "abcdefhijklnopqrstuwxyz" - (char-to-string (car x))) - (define-key map (char-to-string (- (car x) ?a -1)) (cdr x))) - (define-key map (format "\e%c" (car x)) (cdr x))) + (let* ((x-chr (car x)) + (x-str (char-to-string x-chr)) + (x-def (cdr x))) + (define-key map x-str x-def) + (when (string-match "[a-z]" x-str) + ;; Map upper case char to same definition. + (define-key map (upcase x-str) x-def) + (unless (string-match "[gmv]" x-str) + ;; Map control prefixed char to same definition. + (define-key map (vector (list 'control x-chr)) x-def))) + (define-key map (format "\e%c" x-chr) x-def))) '( ( ?a . calc-embedded-activate ) ( ?b . calc-big-or-small ) ( ?c . calc )