From: Kenichi Handa Date: Mon, 22 Mar 1999 04:12:42 +0000 (+0000) Subject: (what-cursor-position): Don't cause error when point X-Git-Tag: emacs-20.4~441 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=28fd4883f6f01490e75301d50c072b828b708f18;p=emacs.git (what-cursor-position): Don't cause error when point is at invalid multibyte sequence. --- diff --git a/lisp/simple.el b/lisp/simple.el index ac3506a377a..92874f5f02e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -524,18 +524,21 @@ addition, the encoding is fully shown." (if (or (not coding) (eq (coding-system-type coding) t)) (setq coding default-buffer-file-coding-system)) - (setq encoded (and (>= char 128) (encode-coding-char char coding))) - (setq encoding-msg - (if encoded - (format "(0%o, %d, 0x%x, ext %s)" - char char char - (if (and (not detail) - (> (length encoded) 1)) - "..." - (concat - (encoded-string-description encoded coding) - (if (cmpcharp char) "..." "")))) - (format "(0%o, %d, 0x%x)" char char char))) + (if (not (char-valid-p char)) + (setq encoding-msg + (format "(0%o, %d, 0x%x, invalid)" char char char)) + (setq encoded (and (>= char 128) (encode-coding-char char coding))) + (setq encoding-msg + (if encoded + (format "(0%o, %d, 0x%x, ext %s)" + char char char + (if (and (not detail) + (> (length encoded) 1)) + "..." + (concat + (encoded-string-description encoded coding) + (if (cmpcharp char) "..." "")))) + (format "(0%o, %d, 0x%x)" char char char)))) (if detail ;; We show the detailed information of CHAR. (let ((internal @@ -549,18 +552,18 @@ addition, the encoding is fully shown." (message "Char: %s %s %s" (if (< char 256) (single-key-description char) - (char-to-string char)) + (buffer-substring (point) (1+ (point)))) encoding-msg internal)) (if (or (/= beg 1) (/= end (1+ total))) (message "Char: %s %s point=%d of %d(%d%%) <%d - %d> column %d %s" (if (< char 256) (single-key-description char) - (char-to-string char)) + (buffer-substring (point) (1+ (point)))) encoding-msg pos total percent beg end col hscroll) (message "Char: %s %s point=%d of %d(%d%%) column %d %s" (if (< char 256) (single-key-description char) - (char-to-string char)) + (buffer-substring (point) (1+ (point)))) encoding-msg pos total percent col hscroll))))))) (defun fundamental-mode ()