Commit 993b2a7d authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(encoded-string-description):

Rewritten.   Try pretty description for ISO 2022 escape sequences
only if CODING-SYSTEM is based on ISO 2022.
parent 14c04384
......@@ -1815,23 +1815,13 @@ It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
(defun encoded-string-description (str coding-system)
"Return a pretty description of STR that is encoded by CODING-SYSTEM."
(setq str (string-as-unibyte str))
(let ((char (aref str 0))
desc)
(when (< char 128)
(setq desc (or (cdr (assq char iso-2022-control-alist))
(char-to-string char)))
(let ((i 1)
(len (length str)))
(while (< i len)
(setq char (aref str i))
(if (>= char 128)
(setq desc nil i len)
(setq desc (concat desc " "
(or (cdr (assq char iso-2022-control-alist))
(char-to-string char)))
i (1+ i))))))
(or desc
(mapconcat (function (lambda (x) (format "0x%02x" x))) str " "))))
(mapconcat
(if (eq (coding-system-type coding-system) 2)
;; Try to get a pretty description for ISO 2022 escape sequences.
(function (lambda (x) (or (cdr (assq x iso-2022-control-alist))
(format "%02X" x))))
(function (lambda (x) (format "0x%02x" x))))
str " "))
(defun encode-coding-char (char coding-system)
"Encode CHAR by CODING-SYSTEM and return the resulting string.
......
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