GNU bug report logs - #240
23.0.60; substitute-command-keys incorrect for self-insert-command

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 14 May 2008 04:05:05 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 240 in the body.
You can then email your comments to 240 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#240; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
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: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: 23.0.60; substitute-command-keys incorrect for self-insert-command
Date: Tue, 13 May 2008 20:56:23 -0700
emacs -Q
In *scratch* buffer, type this, then use C-x C-e after it:
(princ (substitute-command-keys "\\{global-map}") (current-buffer))
 
You will see this:
 
key             binding
---             -------
 
\200 .. \377 self-insert-command
 
C-@  set-mark-command
C-a  move-beginning-of-line
 
etc.
 
The bug is that the \200 and the \377 are treated differently. The
\200 is a single octal character; the \377 is four characters, \, 3,
7, 7.
 
This has consequences for code that uses this output as input.
 
 
 
In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-05-04 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include
-fno-crossjumping'
 







Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#240; 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 #10 received at 240 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: emacs-devel <at> gnu.org, 240 <at> debbugs.gnu.org
Subject: Re: 23.0.60; substitute-command-keys incorrect for self-insert-command
Date: Tue, 19 Aug 2008 17:02:57 -0400
> emacs -Q
> In *scratch* buffer, type this, then use C-x C-e after it:
> (princ (substitute-command-keys "\\{global-map}") (current-buffer))
> 
> You will see this:
> 
> key             binding
> ---             -------
> 
> \200 .. \377 self-insert-command
> 
> The bug is that the \200 and the \377 are treated differently. The \200
> is a single octal character; the \377 is four characters, \, 3, 7, 7.

I believe this is simply how the Lisp printer behaves.  Note that
string_count_byte8 is zero for \200, but one for \377; hence \200 is
printed literally, while \377 is converted into an escaped string.

Using `insert' rather than `princ' probably gives the result you want.

I'm no expert on this area, though, so maybe someone else could comment
more authoritatively.




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

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.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 #15 received at 240 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> stupidchicken.com>
Cc: <emacs-devel <at> gnu.org>, <240 <at> debbugs.gnu.org>
Subject: RE: 23.0.60; substitute-command-keys incorrect for self-insert-command
Date: Tue, 19 Aug 2008 14:43:09 -0700
> > emacs -Q
> > In *scratch* buffer, type this, then use C-x C-e after it:
> > (princ (substitute-command-keys "\\{global-map}") (current-buffer))
> > 
> > You will see this:
> > 
> > key             binding
> > ---             -------
> > 
> > \200 .. \377 self-insert-command
> > 
> > The bug is that the \200 and the \377 are treated 
> differently. The \200
> > is a single octal character; the \377 is four characters, 
> \, 3, 7, 7.
> 
>
> I believe this is simply how the Lisp printer behaves.  Note that
> string_count_byte8 is zero for \200, but one for \377; hence \200 is
> printed literally, while \377 is converted into an escaped string.
> 
> Using `insert' rather than `princ' probably gives the result you want.
> 
> I'm no expert on this area, though, so maybe someone else 
> could comment more authoritatively.


1. Yes, thanks. This treats the \200 and \377 the same way - both are single
octal characters:

(with-current-buffer "foo"
  (insert (substitute-command-keys
            (concat "\\{" "global-map" "}"))))

2. I'm using this in the *Help* buffer. The behavior of using octal chars here
is new with Emacs 23, BTW. In Emacs 22, I see instead "  .. y", where the first
char looks like a space char and the y is really a y with an
umlaut/diaresis/trema (two dots, at least). Dunno if the new behavior is
intended or not.

[I'm not sure those represent the same two character ranges, BTW, but in any
case in Emacs 22 there are no octal chars from `substitute-command-keys'.]





bug closed, send any further explanations to "Drew Adams" <drew.adams <at> oracle.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 19 Aug 2008 22:25:06 GMT) Full text and rfc822 format available.

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

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

Previous Next


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