GNU bug report logs - #835
23.0.60; Quick calc is quietly disabled in view-mode

Previous Next

Package: emacs;

Reported by: Markus Triska <markus.triska <at> gmx.at>

Date: Sun, 31 Aug 2008 09:15:04 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 835 in the body.
You can then email your comments to 835 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Markus Triska <markus.triska <at> gmx.at>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Sun, 31 Aug 2008 05:08:14 -0400
When I do:

   $ emacs -Q -f view-mode

and then "C-x * Q", nothing happens. ("C-x * *" works as expected.)

In GNU Emacs 23.0.60.7 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-08-30 on v254-034.vps.tuwien.ac.at
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Markus Triska <markus.triska <at> gmx.at>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Sun, 31 Aug 2008 12:48:53 +0200
> When I do:
>
>    $ emacs -Q -f view-mode
>
> and then "C-x * Q", nothing happens. ("C-x * *" works as expected.)

Does it work if you replace

            (when (string-match "abcdefhijklnopqrstuwxyz"
                                (char-to-string (car x)))
              (define-key map (char-to-string (- (car x) ?a -1)) (cdr x)))

by something like

            (when (string-match "[a-z]" (char-to-string (car x)))
              (define-key map (upcase (char-to-string (car x))) (cdr x)))

in the definition of `calc-dispatch-map'?

martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: 835 <at> debbugs.gnu.org
Cc: Markus Triska <markus.triska <at> gmx.at>
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Mon, 01 Sep 2008 19:47:52 +0200
[Message part 1 (text/plain, inline)]
>  > When I do:
>  >
>  >    $ emacs -Q -f view-mode
>  >
>  > and then "C-x * Q", nothing happens. ("C-x * *" works as expected.)

Any objections against the attached patch?

martin
[835.diff (text/plain, inline)]
*** 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 )

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Jay Belanger <jay.p.belanger <at> gmail.com>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Mon, 01 Sep 2008 14:53:30 -0400
martin rudalics <rudalics <at> gmx.at> 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?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Jay Belanger <jay.p.belanger <at> gmail.com>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Mon, 01 Sep 2008 23:08:11 +0200
> !               (define-key map (char-to-string (- (car x) ?a -1)) (cdr
> x)))
[...]
> !               (define-key map (upcase (char-to-string (car x))) (cdr
> x)))

> 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?

That was my intention: AFAICT `view-mode' took `Q' (and, for example,
`E') away from calc and I simply tried to give it back to calc.  But
maybe this part of the code really intended to add a "C-" ...

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #30 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Jay Belanger <jay.p.belanger <at> gmail.com>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Mon, 01 Sep 2008 17:50:58 -0400
martin rudalics <rudalics <at> gmx.at> writes:

>> ! (define-key map (char-to-string (- (car x) ?a -1)) (cdr x)))
> [...]
>> ! (define-key map (upcase (char-to-string (car x))) (cdr x)))
>
>> 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?
>
> That was my intention: AFAICT `view-mode' took `Q' (and, for example,
> `E') away from calc and I simply tried to give it back to calc.  But
> maybe this part of the code really intended to add a "C-" ...

Yeah, it's somewhat opaque code.  The way the ASCII table is set up is
that character 1 is the character ^A, character 2 is the character ^B,
and so forth, until character 65 is the unmodified character A.  Hence
(char-to-string (- ?n ?a -1)) gives 14 == ^N.  (Also, ASCII control
characters are case insensitive: there's no separate ^n character.)

I suppose this means we have to find a separate fix for the original
bug...




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #35 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Jay Belanger <jay.p.belanger <at> gmail.com>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Tue, 02 Sep 2008 00:00:03 +0200
> Yeah, it's somewhat opaque code.  The way the ASCII table is set up is
> that character 1 is the character ^A, character 2 is the character ^B,
> and so forth, until character 65 is the unmodified character A.  Hence
> (char-to-string (- ?n ?a -1)) gives 14 == ^N.  (Also, ASCII control
> characters are case insensitive: there's no separate ^n character.)

This makes sense iff the designer wanted to correct an accidentally held
down control key behavior (the code obviously never lived up to that due
to the regexp bug).

> I suppose this means we have to find a separate fix for the original
> bug...

... well, nothing hinders us assigning n, C-n and N to the same key.
But I'd like to hear Jay's comments first.

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jay.p.belanger <at> gmail.com:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #40 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Jay Belanger <jay.p.belanger <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Mon, 01 Sep 2008 21:33:48 -0500
martin rudalics <rudalics <at> gmx.at> writes:
...
>> I suppose this means we have to find a separate fix for the original
>> bug...
>
> ... well, nothing hinders us assigning n, C-n and N to the same key.
> But I'd like to hear Jay's comments first.

The Calc manual mentions that all three act the same in
calc-dispatch-map, so they all should all be available.  That's just a
matter of adding one line to Martin's patch.
To make it less opaque, perhaps C-letter could be handled with something
like 
  (define-key map (vector (list 'control (car x))) (cdr x)))
(or something better) instead of
  (define-key map (char-to-string (- (car x) ?a -1)) (cdr x)))

Jay




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#835; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #45 received at 835 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: jay.p.belanger <at> gmail.com
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 835 <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Tue, 02 Sep 2008 11:02:04 +0200
> The Calc manual mentions that all three act the same in
> calc-dispatch-map, so they all should all be available.  That's just a
> matter of adding one line to Martin's patch.
> To make it less opaque, perhaps C-letter could be handled with something
> like
>   (define-key map (vector (list 'control (car x))) (cdr x)))
> (or something better) instead of
>   (define-key map (char-to-string (- (car x) ?a -1)) (cdr x)))

I checked in a fix along these lines.  Please have a look.

martin




Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Markus Triska <markus.triska <at> gmx.at>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #50 received at 835-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: jay.p.belanger <at> gmail.com, 835-done <at> debbugs.gnu.org
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Tue, 02 Sep 2008 20:23:26 -0400
martin rudalics <rudalics <at> gmx.at> writes:

> I checked in a fix along these lines.  Please have a look.

Looks good.  Thanks.




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 01 Oct 2008 14:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 260 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.