changeset 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 a44f0c573e7a
children 98f4d96216d5
files lisp/ChangeLog lisp/simple.el src/ChangeLog src/text.c
diffstat 4 files changed, 43 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Dec 05 22:51:25 2006 +0000
+++ b/lisp/ChangeLog	Wed Dec 06 21:28:54 2006 +0000
@@ -1,3 +1,10 @@
+2006-12-06  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.
+
 2006-11-30  Mike Sperber  <mike@xemacs.org>
 
 	* code-files.el (insert-file-contents): Call the file-name handler
--- 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.
--- a/src/ChangeLog	Tue Dec 05 22:51:25 2006 +0000
+++ b/src/ChangeLog	Wed Dec 06 21:28:54 2006 +0000
@@ -1,3 +1,9 @@
+2006-12-06  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. 
+
 2006-11-30  Mike Sperber  <mike@xemacs.org>
 
 	* fileio.c (Finsert_file_contents_internal): Don't call the
--- a/src/text.c	Tue Dec 05 22:51:25 2006 +0000
+++ b/src/text.c	Wed Dec 06 21:28:54 2006 +0000
@@ -5000,6 +5000,8 @@
     invalid_constant ("Octet number must be 0 or 1", n);
 }
 
+#endif /* MULE */
+
 DEFUN ("split-char", Fsplit_char, 1, 1, 0, /*
 Return list of charset and one or two position-codes of CHAR.
 */
@@ -5016,7 +5018,7 @@
 
   BREAKUP_ICHAR (XCHAR (character), charset, c1, c2);
 
-  if (XCHARSET_DIMENSION (Fget_charset (charset)) == 2)
+  if (XCHARSET_DIMENSION (charset) == 2)
     {
       rc = list3 (XCHARSET_NAME (charset), make_int (c1), make_int (c2));
     }
@@ -5029,8 +5031,6 @@
   return rc;
 }
 
-#endif /* MULE */
-
 
 /************************************************************************/
 /*                     composite character functions                    */
@@ -5128,11 +5128,11 @@
 syms_of_text (void)
 {
   DEFSUBR (Fmake_char);
+  DEFSUBR (Fsplit_char);
 
 #ifdef MULE
   DEFSUBR (Fchar_charset);
   DEFSUBR (Fchar_octet);
-  DEFSUBR (Fsplit_char);
 
 #ifdef ENABLE_COMPOSITE_CHARS
   DEFSUBR (Fmake_composite_char);