Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode

From: Chong Yidong <[email-masked]>
Date: Mon, 01 Sep 2008 14:53:30 -0400

martin rudalics <[email-masked]> wrote:

> Any objections against the attached patch?

*** calc/calc.el.~1.115.~       2008-08-23 09:41:44.515625000 +0200
--- calc/calc.el                2008-09-01 19:43:05.515625000 +0200
***************
*** 1097,1105 ****
    (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)))
            '( ( ?a . calc-embedded-activate )
               ( ?b . calc-big-or-small )
--- 1097,1105 ----
    (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 (upcase (char-to-string (car x))) (cdr
x)))
              (define-key map (format "\e%c" (car x)) (cdr x)))
            '( ( ?a . calc-embedded-activate )
               ( ?b . calc-big-or-small )

Indeed, the argument to string-match in the original code looks like a
typo (fixed by the first line of the patch).

The second part of the patch is not clear to me.  What the original code
does is the following: for a character such as "n", it adds "C-n" to the
keymap as well (it's a hack that relies on the specific properties of
the ASCII table, and needs at least a comment).  That's not what the
patched code does: it adds "N" to the keymap.  Martin, what's the reason
for this change?