comparison lisp/simple.el @ 24301:b09b949b5433

(what-cursor-position): Don't use the variable charset-origin-alist, but use charset-origin-alist property of buffer-file-coding-system to decide external character set code.
author Kenichi Handa <handa@m17n.org>
date Fri, 12 Feb 1999 08:06:39 +0000
parents 62548105541c
children d00b069a7d17
comparison
equal deleted inserted replaced
24300:362153f8a336 24301:b09b949b5433
515 (if (or (/= beg 1) (/= end (1+ total))) 515 (if (or (/= beg 1) (/= end (1+ total)))
516 (message "point=%d of %d(%d%%) <%d - %d> column %d %s" 516 (message "point=%d of %d(%d%%) <%d - %d> column %d %s"
517 pos total percent beg end col hscroll) 517 pos total percent beg end col hscroll)
518 (message "point=%d of %d(%d%%) column %d %s" 518 (message "point=%d of %d(%d%%) column %d %s"
519 pos total percent col hscroll)) 519 pos total percent col hscroll))
520 (let* ((coding-system buffer-file-coding-system) 520 (let ((charset (char-charset char))
521 (encoding 521 (coding-system buffer-file-coding-system)
522 (encode-coding-string (char-to-string char) coding-system t)) 522 slot external encoding-msg)
523 (encoding-string-hex 523 ;; To decided an external character code, we use
524 (mapconcat (lambda (ch) (format "0x%x" ch)) encoding " ")) 524 ;; charset-origin-alist property of buffer-file-coding-system.
525 (encoding-msg 525 ;; But, if buffer-file-coding-system is nil of undecided, use
526 (if (and coding-system 526 ;; that property of default-buffer-file-coding-system. If
527 (not (and (= (length encoding) 1) 527 ;; that property value is nil, we don't show external
528 (= (aref encoding 0) char)))) 528 ;; character code.
529 (format "(0%o, %d, 0x%x, ext %s)" 529 (if (or (not coding-system)
530 char char char 530 (eq (coding-system-type coding-system) t))
531 encoding-string-hex) 531 (setq coding-system default-buffer-file-coding-system))
532 (format "(0%o, %d, 0x%x)" 532 (if (and coding-system
533 char char char)))) 533 (setq slot
534 (coding-system-get coding-system 'charset-origin-alist))
535 (setq slot (assq charset slot)))
536 (setq external (list (nth 1 slot) (funcall (nth 2 slot) char))))
537 (setq encoding-msg
538 (if external
539 (format "(0%o, %d, 0x%x, ext 0x%x)"
540 char char char (nth 1 external))
541 (format "(0%o, %d, 0x%x)" char char char)))
534 (if detail 542 (if detail
535 (let* ((internal (split-char char)) 543 ;; We show the detailed information of CHAR.
536 (charset (char-charset char)) 544 (let (internal)
537 (slot (assq charset charset-origin-alist)) 545 (if (eq charset 'composition)
538 external) 546 ;; For a composite character, we show the components
539 (if slot 547 ;; only.
540 (setq external (list (nth 1 slot) (funcall (nth 2 slot) char))) 548 (setq internal (concat "(composition of \""
541 (if (eq charset 'composition) 549 (decompose-composite-char char)
542 (setq internal '("composite-character")) 550 "\")")
551 external nil)
552 (setq internal (split-char char))
553 (unless external
543 (setq external (cons (charset-short-name charset) 554 (setq external (cons (charset-short-name charset)
544 (copy-sequence (cdr internal)))) 555 (copy-sequence (cdr internal))))
545 (if (= (charset-iso-graphic-plane charset) 1) 556 (if (= (charset-iso-graphic-plane charset) 1)
546 (progn 557 (progn
547 (setcar (cdr external) (+ (nth 1 external) 128)) 558 (setcar (cdr external) (+ (nth 1 external) 128))
550 (+ (nth 2 external) 128))))))) 561 (+ (nth 2 external) 128)))))))
551 (message "Char: %s %s %s %s" 562 (message "Char: %s %s %s %s"
552 (if (< char 256) 563 (if (< char 256)
553 (single-key-description char) 564 (single-key-description char)
554 (char-to-string char)) 565 (char-to-string char))
555 encoding-msg (or internal "") (or external ""))) 566 encoding-msg internal (or external "")))
556 (if (or (/= beg 1) (/= end (1+ total))) 567 (if (or (/= beg 1) (/= end (1+ total)))
557 (message "Char: %s %s point=%d of %d(%d%%) <%d - %d> column %d %s" 568 (message "Char: %s %s point=%d of %d(%d%%) <%d - %d> column %d %s"
558 (if (< char 256) 569 (if (< char 256)
559 (single-key-description char) 570 (single-key-description char)
560 (char-to-string char)) 571 (char-to-string char))