Subject: Re: 23.0.60; substitute-command-keys incorrect for self-insert-command

From: Chong Yidong <[email-masked]>
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.