comparison 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
comparison
equal deleted inserted replaced
3723:a44f0c573e7a 3724:1fe680cefdb7
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 ()
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
788 charset and codes; for ASCII characters, give its code in octal, decimal and
789 hex."
787 ;; XEmacs change 790 ;; XEmacs change
788 (interactive "_") 791 (interactive "_")
789 (let* ((char (char-after (point))) ; XEmacs 792 (let* ((char (char-after (point))) ; XEmacs
790 (beg (point-min)) 793 (beg (point-min))
791 (end (point-max)) 794 (end (point-max))
796 (/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1)) 799 (/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1))
797 (/ (+ (/ total 2) (* 100 (1- pos))) (max total 1)))) 800 (/ (+ (/ total 2) (* 100 (1- pos))) (max total 1))))
798 (hscroll (if (= (window-hscroll) 0) 801 (hscroll (if (= (window-hscroll) 0)
799 "" 802 ""
800 (format " Hscroll=%d" (window-hscroll)))) 803 (format " Hscroll=%d" (window-hscroll))))
801 (col (+ (current-column) (if column-number-start-at-one 1 0)))) 804 (col (+ (current-column) (if column-number-start-at-one 1 0)))
805 (unicode (and char (encode-char char 'ucs)))
806 (unicode-string (and unicode (natnump unicode)
807 (format (if (> unicode #xFFFF) "U+%06X" "U+%04X")
808 unicode)))
809 (narrowed-details (if (or (/= beg 1) (/= end (1+ total)))
810 (format " <%d - %d>" beg end)
811 "")))
812
802 (if (= pos end) 813 (if (= pos end)
803 (if (or (/= beg 1) (/= end (1+ total))) 814 (message "point=%d of %d(%d%%)%s column %d %s"
804 (message "point=%d of %d(%d%%) <%d - %d> column %d %s" 815 pos total percent narrowed-details col hscroll)
805 pos total percent beg end col hscroll) 816 ;; XEmacs: don't use single-key-description, treat non-ASCII
806 (message "point=%d of %d(%d%%) column %d %s" 817 ;; characters differently.
807 pos total percent col hscroll)) 818 (if (< char ?\x80)
808 ;; XEmacs: don't use single-key-description 819 (message "Char: %s (0%o, %d, %x) point=%d of %d(%d%%)%s column %d %s"
809 (if (or (/= beg 1) (/= end (1+ total))) 820 (text-char-description char) char char char pos total
810 (message "Char: %s (0%o, %d, 0x%x) point=%d of %d(%d%%) <%d - %d> column %d %s" 821 percent narrowed-details col hscroll)
811 (text-char-description char) char char char pos total 822 (message "Char: %s (%s %s) point=%d of %d(%d%%)%s column %d %s"
812 percent beg end col hscroll) 823 (text-char-description char) unicode-string
813 (message "Char: %s (0%o, %d, 0x%x) point=%d of %d(%d%%) column %d %s" 824 (mapconcat (lambda (arg) (format "%S" arg)) (split-char char) " ")
814 (text-char-description char) char char char pos total 825 pos total
815 percent col hscroll))))) 826 percent narrowed-details col hscroll)))))
816 827
817 (defun fundamental-mode () 828 (defun fundamental-mode ()
818 "Major mode not specialized for anything in particular. 829 "Major mode not specialized for anything in particular.
819 Other major modes are defined by comparison with this one." 830 Other major modes are defined by comparison with this one."
820 (interactive) 831 (interactive)