unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 23.0.60; substitute-command-keys incorrect for self-insert-command
@ 2008-05-14  3:56 Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2008-05-14  3:56 UTC (permalink / raw)
  To: emacs-pretest-bug

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'
 





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

* Re: 23.0.60; substitute-command-keys incorrect for self-insert-command
@ 2008-08-19 21:02 Chong Yidong
  2008-08-19 21:43 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2008-08-19 21:02 UTC (permalink / raw)
  To: Drew Adams; +Cc: 240, emacs-devel

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




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

* RE: 23.0.60; substitute-command-keys incorrect for self-insert-command
  2008-08-19 21:02 23.0.60; substitute-command-keys incorrect for self-insert-command Chong Yidong
@ 2008-08-19 21:43 ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2008-08-19 21:43 UTC (permalink / raw)
  To: 'Chong Yidong'; +Cc: 240, emacs-devel

> > 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'.]





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

end of thread, other threads:[~2008-08-19 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 21:02 23.0.60; substitute-command-keys incorrect for self-insert-command Chong Yidong
2008-08-19 21:43 ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2008-05-14  3:56 Drew Adams

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