unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
@ 2008-08-31  9:08 ` Markus Triska
  2008-08-31 10:48   ` martin rudalics
  2008-09-03  0:30   ` bug#835: marked as done (23.0.60; Quick calc is quietly disabled in view-mode) Emacs bug Tracking System
  0 siblings, 2 replies; 10+ messages in thread
From: Markus Triska @ 2008-08-31  9:08 UTC (permalink / raw)
  To: emacs-pretest-bug

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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-08-31  9:08 ` bug#835: 23.0.60; Quick calc is quietly disabled in view-mode Markus Triska
@ 2008-08-31 10:48   ` martin rudalics
  2008-09-01 17:47     ` martin rudalics
  2008-09-03  0:30   ` bug#835: marked as done (23.0.60; Quick calc is quietly disabled in view-mode) Emacs bug Tracking System
  1 sibling, 1 reply; 10+ messages in thread
From: martin rudalics @ 2008-08-31 10:48 UTC (permalink / raw)
  To: Markus Triska, 835

 > 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







^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-08-31 10:48   ` martin rudalics
@ 2008-09-01 17:47     ` martin rudalics
  0 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2008-09-01 17:47 UTC (permalink / raw)
  To: 835; +Cc: Markus Triska

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

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

[-- Attachment #2: 835.diff --]
[-- Type: text/plain, Size: 1108 bytes --]

*** 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 )

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
@ 2008-09-01 18:53 Chong Yidong
  2008-09-01 21:08 ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2008-09-01 18:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: 835

martin rudalics <rudalics@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?






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-09-01 18:53 bug#835: 23.0.60; Quick calc is quietly disabled in view-mode Chong Yidong
@ 2008-09-01 21:08 ` martin rudalics
  2008-09-01 21:50   ` Chong Yidong
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2008-09-01 21:08 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 835

 > !               (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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-09-01 21:08 ` martin rudalics
@ 2008-09-01 21:50   ` Chong Yidong
  2008-09-01 22:00     ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2008-09-01 21:50 UTC (permalink / raw)
  To: martin rudalics; +Cc: 835

martin rudalics <rudalics@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...






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-09-01 21:50   ` Chong Yidong
@ 2008-09-01 22:00     ` martin rudalics
  2008-09-02  2:33       ` Jay Belanger
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2008-09-01 22:00 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 835

 > 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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-09-01 22:00     ` martin rudalics
@ 2008-09-02  2:33       ` Jay Belanger
  2008-09-02  9:02         ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Jay Belanger @ 2008-09-02  2:33 UTC (permalink / raw)
  To: martin rudalics; +Cc: Chong Yidong, 835


martin rudalics <rudalics@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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
  2008-09-02  2:33       ` Jay Belanger
@ 2008-09-02  9:02         ` martin rudalics
  0 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2008-09-02  9:02 UTC (permalink / raw)
  To: jay.p.belanger; +Cc: Chong Yidong, 835

 > 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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#835: marked as done (23.0.60; Quick calc is quietly disabled  in view-mode)
  2008-08-31  9:08 ` bug#835: 23.0.60; Quick calc is quietly disabled in view-mode Markus Triska
  2008-08-31 10:48   ` martin rudalics
@ 2008-09-03  0:30   ` Emacs bug Tracking System
  1 sibling, 0 replies; 10+ messages in thread
From: Emacs bug Tracking System @ 2008-09-03  0:30 UTC (permalink / raw)
  To: Chong Yidong

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]


Your message dated Tue, 02 Sep 2008 20:23:26 -0400
with message-id <87sksi5b7l.fsf@cyd.mit.edu>
and subject line Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
has caused the Emacs bug report #835,
regarding 23.0.60; Quick calc is quietly disabled in view-mode
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
835: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=835
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 2712 bytes --]

From: Markus Triska <markus.triska@gmx.at>
To: emacs-pretest-bug@gnu.org
Subject: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Sun, 31 Aug 2008 05:08:14 -0400
Message-ID: <m1sksllfgh.fsf@v254-019.vps.tuwien.ac.at>

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



[-- Attachment #3: Type: message/rfc822, Size: 1469 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: martin rudalics <rudalics@gmx.at>
Cc: jay.p.belanger@gmail.com, 835-done@emacsbugs.donarmstrong.com
Subject: Re: bug#835: 23.0.60; Quick calc is quietly disabled in view-mode
Date: Tue, 02 Sep 2008 20:23:26 -0400
Message-ID: <87sksi5b7l.fsf@cyd.mit.edu>

martin rudalics <rudalics@gmx.at> writes:

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

Looks good.  Thanks.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-09-03  0:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87sksi5b7l.fsf@cyd.mit.edu>
2008-08-31  9:08 ` bug#835: 23.0.60; Quick calc is quietly disabled in view-mode Markus Triska
2008-08-31 10:48   ` martin rudalics
2008-09-01 17:47     ` martin rudalics
2008-09-03  0:30   ` bug#835: marked as done (23.0.60; Quick calc is quietly disabled in view-mode) Emacs bug Tracking System
2008-09-01 18:53 bug#835: 23.0.60; Quick calc is quietly disabled in view-mode Chong Yidong
2008-09-01 21:08 ` martin rudalics
2008-09-01 21:50   ` Chong Yidong
2008-09-01 22:00     ` martin rudalics
2008-09-02  2:33       ` Jay Belanger
2008-09-02  9:02         ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).