diff lisp/simple.el @ 3724:1fe680cefdb7

[xemacs-hg @ 2006-12-06 21:28:47 by aidan] lisp/ChangeLog addition: 2006-12-04 Aidan Kehoe <kehoea@parhasard.net> * simple.el (what-cursor-position): For non-ASCII characters, give details on what a character maps to in Unicode, and its Mule charsets and codes, instead of simply its integer code point in this XEmacs. src/ChangeLog addition: 2006-12-04 Aidan Kehoe <kehoea@parhasard.net> * text.c (Fsplit_char): Make split-char available on non-Mule builds, taking out a superfluous call to get-charset to make that possible.
author aidan
date Wed, 06 Dec 2006 21:28:54 +0000
parents bd7189f2e967
children 6b2ef948e140
line wrap: on
line diff
--- a/lisp/simple.el	Tue Dec 05 22:51:25 2006 +0000
+++ b/lisp/simple.el	Wed Dec 06 21:28:54 2006 +0000
@@ -783,7 +783,10 @@
 	(- (buffer-size) (forward-line (buffer-size)))))))
 
 (defun what-cursor-position ()
-  "Print info on cursor position (on screen and within buffer)."
+  "Print info on cursor position (on screen and within buffer).
+Also describe the character after point, giving its UCS code point and Mule
+charset and codes; for ASCII characters, give its code in octal, decimal and
+hex."
   ;; XEmacs change
   (interactive "_")
   (let* ((char (char-after (point))) ; XEmacs
@@ -798,21 +801,29 @@
 	 (hscroll (if (= (window-hscroll) 0)
 		      ""
 		    (format " Hscroll=%d" (window-hscroll))))
-	 (col (+ (current-column) (if column-number-start-at-one 1 0))))
+	 (col (+ (current-column) (if column-number-start-at-one 1 0)))
+         (unicode (and char (encode-char char 'ucs)))
+         (unicode-string (and unicode (natnump unicode)
+                              (format (if (> unicode #xFFFF) "U+%06X" "U+%04X")
+                                      unicode)))
+         (narrowed-details (if (or (/= beg 1) (/= end (1+ total)))
+                               (format " <%d - %d>" beg end)
+                             "")))
+         
     (if (= pos end)
-	(if (or (/= beg 1) (/= end (1+ total)))
-	    (message "point=%d of %d(%d%%) <%d - %d>  column %d %s"
-		     pos total percent beg end col hscroll)
-	  (message "point=%d of %d(%d%%)  column %d %s"
-		   pos total percent col hscroll))
-      ;; XEmacs: don't use single-key-description
-      (if (or (/= beg 1) (/= end (1+ total)))
-	  (message "Char: %s (0%o, %d, 0x%x)  point=%d of %d(%d%%) <%d - %d>  column %d %s"
-		   (text-char-description char) char char char pos total
-		   percent beg end col hscroll)
-	(message "Char: %s (0%o, %d, 0x%x)  point=%d of %d(%d%%)  column %d %s"
-		 (text-char-description char) char char char pos total
-		 percent col hscroll)))))
+        (message "point=%d of %d(%d%%)%s column %d %s"
+                 pos total percent narrowed-details col hscroll)
+      ;; XEmacs: don't use single-key-description, treat non-ASCII
+      ;; characters differently.
+      (if (< char ?\x80)
+          (message "Char: %s (0%o, %d, %x) point=%d of %d(%d%%)%s column %d %s"
+                       (text-char-description char) char char char pos total
+                       percent narrowed-details col hscroll)
+        (message "Char: %s (%s %s) point=%d of %d(%d%%)%s column %d %s"
+                 (text-char-description char) unicode-string
+                 (mapconcat (lambda (arg) (format "%S" arg)) (split-char char) " ")
+                 pos total
+                 percent narrowed-details col hscroll)))))
 
 (defun fundamental-mode ()
   "Major mode not specialized for anything in particular.