comparison lisp/simple.el @ 65862:8b246680b846

(what-cursor-position): If the character is displayed by some `display' text property, show that. Don't use single-key-description for eight-bit characters in multibyte mode.
author Kenichi Handa <handa@m17n.org>
date Thu, 06 Oct 2005 06:55:45 +0000
parents d88ec92a0f15
children 13abee3a9bc6 08b4dd6a6e87 aa89c814f853
comparison
equal deleted inserted replaced
65861:8063c9277e58 65862:8b246680b846
894 (message "point=%d of %d (%d%%) <%d - %d> column %d %s" 894 (message "point=%d of %d (%d%%) <%d - %d> column %d %s"
895 pos total percent beg end col hscroll) 895 pos total percent beg end col hscroll)
896 (message "point=%d of %d (%d%%) column %d %s" 896 (message "point=%d of %d (%d%%) column %d %s"
897 pos total percent col hscroll)) 897 pos total percent col hscroll))
898 (let ((coding buffer-file-coding-system) 898 (let ((coding buffer-file-coding-system)
899 encoded encoding-msg) 899 encoded encoding-msg display-prop under-display)
900 (if (or (not coding) 900 (if (or (not coding)
901 (eq (coding-system-type coding) t)) 901 (eq (coding-system-type coding) t))
902 (setq coding default-buffer-file-coding-system)) 902 (setq coding default-buffer-file-coding-system))
903 (if (not (char-valid-p char)) 903 (if (not (char-valid-p char))
904 (setq encoding-msg 904 (setq encoding-msg
905 (format "(0%o, %d, 0x%x, invalid)" char char char)) 905 (format "(0%o, %d, 0x%x, invalid)" char char char))
906 (setq encoded (and (>= char 128) (encode-coding-char char coding))) 906 ;; Check if the character is displayed with some `display'
907 ;; text property. In that case, set under-display to the
908 ;; buffer substring covered by that property.
909 (setq display-prop (get-text-property pos 'display))
910 (if display-prop
911 (let ((to (or (next-single-property-change pos 'display)
912 (point-max))))
913 (if (< to (+ pos 4))
914 (setq under-display "")
915 (setq under-display "..."
916 to (+ pos 4)))
917 (setq under-display
918 (concat (buffer-substring-no-properties pos to)
919 under-display)))
920 (setq encoded (and (>= char 128) (encode-coding-char char coding))))
907 (setq encoding-msg 921 (setq encoding-msg
908 (if encoded 922 (if display-prop
909 (format "(0%o, %d, 0x%x, file %s)" 923 (if (not (stringp display-prop))
910 char char char 924 (format "(0%o, %d, 0x%x, part of display \"%s\")"
911 (if (> (length encoded) 1) 925 char char char under-display)
912 "..." 926 (format "(0%o, %d, 0x%x, part of display \"%s\"->\"%s\")"
913 (encoded-string-description encoded coding))) 927 char char char under-display display-prop))
914 (format "(0%o, %d, 0x%x)" char char char)))) 928 (if encoded
929 (format "(0%o, %d, 0x%x, file %s)"
930 char char char
931 (if (> (length encoded) 1)
932 "..."
933 (encoded-string-description encoded coding)))
934 (format "(0%o, %d, 0x%x)" char char char)))))
915 (if detail 935 (if detail
916 ;; We show the detailed information about CHAR. 936 ;; We show the detailed information about CHAR.
917 (describe-char (point))) 937 (describe-char (point)))
918 (if (or (/= beg 1) (/= end (1+ total))) 938 (if (or (/= beg 1) (/= end (1+ total)))
919 (message "Char: %s %s point=%d of %d (%d%%) <%d - %d> column %d %s" 939 (message "Char: %s %s point=%d of %d (%d%%) <%d - %d> column %d %s"
920 (if (< char 256) 940 (if (< char 256)
921 (single-key-description char) 941 (single-key-description char)
922 (buffer-substring-no-properties (point) (1+ (point)))) 942 (buffer-substring-no-properties (point) (1+ (point))))
923 encoding-msg pos total percent beg end col hscroll) 943 encoding-msg pos total percent beg end col hscroll)
924 (message "Char: %s %s point=%d of %d (%d%%) column %d %s" 944 (message "Char: %s %s point=%d of %d (%d%%) column %d %s"
925 (if (< char 256) 945 (if enable-multibyte-characters
926 (single-key-description char) 946 (if (< char 128)
927 (buffer-substring-no-properties (point) (1+ (point)))) 947 (single-key-description char)
948 (buffer-substring-no-properties (point) (1+ (point))))
949 (single-key-description char))
928 encoding-msg pos total percent col hscroll)))))) 950 encoding-msg pos total percent col hscroll))))))
929 951
930 (defvar read-expression-map 952 (defvar read-expression-map
931 (let ((m (make-sparse-keymap))) 953 (let ((m (make-sparse-keymap)))
932 (define-key m "\M-\t" 'lisp-complete-symbol) 954 (define-key m "\M-\t" 'lisp-complete-symbol)