From 993b2a7dd4fdb4960ac5a022eac0307c6881211c Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 3 Apr 2000 04:05:41 +0000 Subject: [PATCH] (encoded-string-description): Rewritten. Try pretty description for ISO 2022 escape sequences only if CODING-SYSTEM is based on ISO 2022. --- lisp/international/mule-cmds.el | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 4193e81030d..c575a142364 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -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. -- 2.39.5