changeset 24508:f9e613360d62

(what-cursor-position): Don't cause error when point is at invalid multibyte sequence.
author Kenichi Handa <handa@m17n.org>
date Mon, 22 Mar 1999 04:12:42 +0000
parents 2a7aa9cd6a19
children 3cb266497eb3
files lisp/simple.el
diffstat 1 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Mar 21 07:26:47 1999 +0000
+++ b/lisp/simple.el	Mon Mar 22 04:12:42 1999 +0000
@@ -524,18 +524,21 @@
 	(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 @@
 	      (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 ()