Commit ed441285 authored by Kenichi Handa's avatar Kenichi Handa

(describe-char): Fix previous change. Don't make

a unibyte character to multibyte in the *Help* buffer.
parent 9a28b921
......@@ -465,7 +465,6 @@ as well as widgets, buttons, overlays, and text properties."
(if (>= pos (point-max))
(error "No character follows specified position"))
(let* ((char (char-after pos))
(char-string (buffer-substring pos (1+ pos)))
(charset (char-charset char))
(buffer (current-buffer))
(composition (find-composition pos nil nil t))
......@@ -478,8 +477,6 @@ as well as widgets, buttons, overlays, and text properties."
(overlays (mapcar #'(lambda (o) (overlay-properties o))
(overlays-at pos)))
item-list max-width unicode)
(if (eq charset 'unknown)
(setq item-list '("character"))
(if (or (< char 256)
(memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
......@@ -487,7 +484,19 @@ as well as widgets, buttons, overlays, and text properties."
(setq unicode (or (get-char-property pos 'untranslated-utf-8)
(encode-char char 'ucs))))
(setq item-list
`(("character")
`(("character"
,(format "%s (0%o, %d, 0x%x%s)"
(apply 'propertize (if (not multibyte-p)
(single-key-description char)
(if (< char 128)
(single-key-description char)
(string-to-multibyte
(char-to-string char))))
(text-properties-at pos))
char char char
(if unicode
(format ", U+%04X" unicode)
"")))
("charset"
,(symbol-name charset)
,(format "(%s)" (charset-description charset)))
......@@ -569,34 +578,13 @@ as well as widgets, buttons, overlays, and text properties."
,@(let ((unicodedata (and unicode
(describe-char-unicode-data unicode))))
(if unicodedata
(cons (list "Unicode data" " ") unicodedata))))))
(cons (list "Unicode data" " ") unicodedata)))))
(setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x)))
item-list)))
(pop item-list)
(with-output-to-temp-buffer "*Help*"
(with-current-buffer standard-output
(set-buffer-multibyte multibyte-p)
(let ((formatter (format "%%%ds:" max-width)))
(insert (format formatter "character") " ")
(setq pos (point))
(insert char-string
(format " (`%s', 0%o, %d, 0x%x"
(if (< char 256)
(single-key-description char)
(char-to-string char))
char char char)
(if (eq charset 'unknown)
") -- invalid character code\n"
(if unicode
(format ", U+%04X)\n" unicode)
")\n")))
(mapc #'(lambda (props)
(let ((o (make-overlay pos (1+ pos))))
(while props
(overlay-put o (car props) (nth 1 props))
(setq props (cddr props)))))
overlays)
(dolist (elt item-list)
(when (cadr elt)
(insert (format formatter (car elt)))
......@@ -610,6 +598,18 @@ as well as widgets, buttons, overlays, and text properties."
(insert " " clm))
(insert "\n"))))
(save-excursion
(goto-char (point-min))
(search-forward "character: ")
(setq pos (point)))
(if overlays
(mapc #'(lambda (props)
(let ((o (make-overlay pos (1+ pos))))
(while props
(overlay-put o (car props) (nth 1 props))
(setq props (cddr props)))))
overlays))
(when disp-vector
(insert
"\nThe display table entry is displayed by ")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment