comparison lisp/simple.el @ 4468:a78d697ccd2c

Import and extend GNU's descr-text.el, supporting prefix argument for C-x = 2008-05-25 Aidan Kehoe <kehoea@parhasard.net> * descr-text.el: New. Taken from GNU's GPLV2 version of 2007-02-14, with modifications for XEmacs support and extensions for Unihan.txt support and db/dbm caches. * simple.el (what-cursor-position): Support an optional prefix argument, as does GNU, calling #'describe-char to giving more detail on the character at point, notably from UnicodeData and (in our case, optionally) Unihan.txt. * syntax.el (syntax-after): Make this available for the sake of #'describe-char. * mule/mule-cmds.el (iso-2022-control-alist): Make this available, for the sake of #'encoded-string-description and #'describe-char. * mule/mule-cmds.el (encoded-string-description): Make this available, for the sake of #'describe-char. * unicode.el (unicode-error-default-translation-table): Make this a char table of type generic, not of type char. Makes it possible to have the relevant logic in #'describe-char reasonably clear; also, and this is undocumented, makes it much easier to implement #'frob-unicode-errors-region. I should document this, and revise #'frob-unicode-errors-region.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 25 May 2008 21:11:35 +0200
parents bea04dade8af
children 891381effa11
comparison
equal deleted inserted replaced
4467:23ef20edf6ba 4468:a78d697ccd2c
780 (not (bolp))) 780 (not (bolp)))
781 (1+ done) 781 (1+ done)
782 done))) 782 done)))
783 (- (buffer-size) (forward-line (buffer-size))))))) 783 (- (buffer-size) (forward-line (buffer-size)))))))
784 784
785 (defun what-cursor-position () 785 (defun what-cursor-position (&optional detail)
786 "Print info on cursor position (on screen and within buffer). 786 "Print info on cursor position (on screen and within buffer).
787 Also describe the character after point, giving its UCS code point and Mule 787 Also describe the character after point, giving its UCS code point and Mule
788 charset and codes; for ASCII characters, give its code in octal, decimal and 788 charset and codes; for ASCII characters, give its code in octal, decimal and
789 hex." 789 hex.
790 ;; XEmacs change 790
791 (interactive "_") 791 With prefix argument, show extended details about the character in a
792 separate buffer. See also the command `describe-char'."
793 ;; XEmacs change "_"
794 (interactive "_P")
792 (let* ((char (char-after (point))) ; XEmacs 795 (let* ((char (char-after (point))) ; XEmacs
793 (beg (point-min)) 796 (beg (point-min))
794 (end (point-max)) 797 (end (point-max))
795 (pos (point)) 798 (pos (point))
796 (total (buffer-size)) 799 (total (buffer-size))
811 ""))) 814 "")))
812 815
813 (if (= pos end) 816 (if (= pos end)
814 (message "point=%d of %d(%d%%)%s column %d %s" 817 (message "point=%d of %d(%d%%)%s column %d %s"
815 pos total percent narrowed-details col hscroll) 818 pos total percent narrowed-details col hscroll)
819 (if detail
820 (describe-char (point)))
816 ;; XEmacs: don't use single-key-description, treat non-ASCII 821 ;; XEmacs: don't use single-key-description, treat non-ASCII
817 ;; characters differently. 822 ;; characters differently.
818 (if (< char ?\x80) 823 (if (< char ?\x80)
819 (message "Char: %s (0%o, %d, %x) point=%d of %d(%d%%)%s column %d %s" 824 (message "Char: %s (0%o, %d, %x) point=%d of %d(%d%%)%s column %d %s"
820 (text-char-description char) char char char pos total 825 (text-char-description char) char char char pos total