The current behaviour of what-cursor-position is annoyingly useless for
non-Latin-1 characters; it’s irrelevant what the character’s integer code
is, what I want to know about a character is its Unicode code point, and
then its Mule charset, and its position codes in that Mule charset. Our
friends in Massachusetts give more detailed information with a prefix
argument, like so:
character: ƒ (01210322, 331986, 0x510d2, U+0192)
charset: mule-unicode-0100-24ff
(Unicode characters of the range U+0100..U+24FF.)
code point: 33 82
syntax: w which means: word
category: l:Latin
buffer code: 0x9C 0xF4 0xA1 0xD2
file code: 0xC6 0x92 (encoded by coding system mule-utf-8)
display: by this font (glyph code)
-microsoft-verdana-medium-r-normal--12-116-74-75-p-74-iso10646-1 (0x192)
This is helpful (with the exception of the buffer code), but the functions
needed to integrate that into XEmacs that are very extensive, and I would
prefer to commit this for the moment:
lisp/ChangeLog addition:
2006-12-04 Aidan Kehoe <kehoea(a)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(a)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.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: src/text.c
===================================================================
RCS lisp/simple.el
===================================================================
RCS
Index: lisp/simple.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/simple.el,v
retrieving revision 1.56
diff -u -u -r1.56 simple.el
--- lisp/simple.el 2006/11/01 21:35:36 1.56
+++ lisp/simple.el 2006/12/04 21:03:26
@@ -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.
Index: src/text.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/text.c,v
retrieving revision 1.29
diff -u -u -r1.29 text.c
--- src/text.c 2006/08/24 21:21:36 1.29
+++ src/text.c 2006/12/04 21:03:29
@@ -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);
--
Santa Maradona, priez pour moi!
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches