From: Martin Rudalics Date: Tue, 2 Sep 2008 08:49:49 +0000 (+0000) Subject: (calc-dispatch-map): Fix handling of upcased and X-Git-Tag: emacs-pretest-23.0.90~3074 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8d676b639a4575d9c6c46b7c6c25b91542594fce;p=emacs.git (calc-dispatch-map): Fix handling of upcased and control-prefixed keys. (Bug #835) --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 86f7aa4f57b..71f13444954 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-09-02 Martin Rudalics + + * calc/calc.el (calc-dispatch-map): Fix handling of upcased and + control-prefixed keys. (Bug #835) + 2008-09-02 Chong Yidong * image-mode.el (image-mode): Fix 2008-07-19 change. diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 5b48938a650..6666142200b 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1026,7 +1026,7 @@ Used by `calc-user-invocation'.") (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 @@ Used by `calc-user-invocation'.") (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 )