Subject: bug#5380: Problem with command sgml-name-8bit-mode in GNU emacs 23.1

From: Chong Yidong <[email-masked]>
Date: Wed, 20 Jan 2010 20:56:23 -0500

Could someone with a non-English keyboard please try to debug Bug#5380?

> I encountered a problem with the function ``sgml-name-8bit-mode'',
> (menu option (SGML/Toggle 8 bit insertion)...  After switching on the
> ``sgml name entity mode'' typing an umlaut character like ä (a umlaut)
> now no more (as in previous emacs versions and as expected) produces
> ``&auml;'' but ``\344''.

In sgml-mode-map, we do the following:

    (let ((c 127)
          (map (nth 1 map)))
      (while (< (setq c (1+ c)) 256)
        (aset map c 'sgml-maybe-name-self)))

where

(defun sgml-maybe-name-self ()
  "Insert a symbolic character name according to `sgml-char-names'."
  (interactive "*")
  (if sgml-name-8bit-mode
      (let ((mc last-command-event))
	(if (< mc 256)
	    (setq mc (unibyte-char-to-multibyte mc)))
	(or mc (setq mc last-command-event))
	(sgml-name-char mc))
    (self-insert-command 1)))

This must have broken with the switch to unicode, but it's inconvenient
for me to debug without a keyboard that can produce these characters.