bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Kenichi Handa
Subject: bug#5380: Problem with command sgml-name-8bit-mode in GNU emacs 23.1
Date: Thu, 21 Jan 2010 11:47:46 +0900

In article <address@hidden>, Chong Yidong <address@hidden> writes:

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

As Emacs receives already decoded character event now,
defining sgml-maybe-name-self simply as below will work.

(defun sgml-maybe-name-self ()
  "Insert a symbolic character name according to `sgml-char-names'."
  (interactive "*")
  (if sgml-name-8bit-mode
      (sgml-name-char last-command-event)
    (self-insert-command 1)))

> but it's inconvenient for me to debug without a keyboard
> that can produce these characters.

You can test it as below:

(let ((sgml-name-8bit-mode t)
      (last-command-event #xC0))
  (call-interactively 'sgml-maybe-name-self))

---
Kenichi Handa
address@hidden






reply via email to

[Prev in Thread] Current Thread [Next in Thread]