diff options
| -rw-r--r-- | lisp/international/mule-diag.el | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 61405128e88..6a36e74d100 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el | |||
| @@ -532,138 +532,6 @@ PC `codepages' and other coded character sets. See `non-iso-charset-alist'." | |||
| 532 | (insert (format "Preferred coding system: %s\n" coding)) | 532 | (insert (format "Preferred coding system: %s\n" coding)) |
| 533 | (search-backward (symbol-name coding)) | 533 | (search-backward (symbol-name coding)) |
| 534 | (help-xref-button 0 'help-coding-system coding))))))) | 534 | (help-xref-button 0 'help-coding-system coding))))))) |
| 535 | |||
| 536 | ;;;###autoload | ||
| 537 | (defun describe-char-after (&optional pos) | ||
| 538 | "Display information about the character at POS in the current buffer. | ||
| 539 | POS defaults to point. | ||
| 540 | The information includes character code, charset and code points in it, | ||
| 541 | syntax, category, how the character is encoded in a file, | ||
| 542 | which font is being used for displaying the character, | ||
| 543 | and text properties." | ||
| 544 | (interactive) | ||
| 545 | (or pos | ||
| 546 | (setq pos (point))) | ||
| 547 | (if (>= pos (point-max)) | ||
| 548 | (error "No character at point")) | ||
| 549 | (let* ((char (char-after pos)) | ||
| 550 | (charset (char-charset char)) | ||
| 551 | (props (text-properties-at pos)) | ||
| 552 | (composition (find-composition (point) nil nil t)) | ||
| 553 | (composed (if composition (buffer-substring (car composition) | ||
| 554 | (nth 1 composition)))) | ||
| 555 | (multibyte-p enable-multibyte-characters) | ||
| 556 | item-list max-width) | ||
| 557 | (if (eq charset 'unknown) | ||
| 558 | (setq item-list | ||
| 559 | `(("character" | ||
| 560 | ,(format "%s (0%o, %d, 0x%x) -- invalid character code" | ||
| 561 | (if (< char 256) | ||
| 562 | (single-key-description char) | ||
| 563 | (char-to-string char)) | ||
| 564 | char char char)))) | ||
| 565 | (setq item-list | ||
| 566 | `(("character" | ||
| 567 | ,(format "%s (0%o, %d, 0x%x)" (if (< char 256) | ||
| 568 | (single-key-description char) | ||
| 569 | (char-to-string char)) | ||
| 570 | char char char)) | ||
| 571 | ("charset" | ||
| 572 | ,(symbol-name charset) | ||
| 573 | ,(format "(%s)" (charset-description charset))) | ||
| 574 | ("code point" | ||
| 575 | ,(let ((split (split-char char))) | ||
| 576 | (if (= (charset-dimension charset) 1) | ||
| 577 | (format "%d" (nth 1 split)) | ||
| 578 | (format "%d %d" (nth 1 split) (nth 2 split))))) | ||
| 579 | ("syntax" | ||
| 580 | ,(let ((syntax (get-char-property (point) 'syntax-table))) | ||
| 581 | (with-temp-buffer | ||
| 582 | (internal-describe-syntax-value | ||
| 583 | (if (consp syntax) syntax | ||
| 584 | (aref (or syntax (syntax-table)) char))) | ||
| 585 | (buffer-string)))) | ||
| 586 | ("category" | ||
| 587 | ,@(let ((category-set (char-category-set char))) | ||
| 588 | (if (not category-set) | ||
| 589 | '("-- none --") | ||
| 590 | (mapcar #'(lambda (x) (format "%c:%s " | ||
| 591 | x (category-docstring x))) | ||
| 592 | (category-set-mnemonics category-set))))) | ||
| 593 | ,@(let ((props (aref char-code-property-table char)) | ||
| 594 | ps) | ||
| 595 | (when props | ||
| 596 | (while props | ||
| 597 | (push (format "%s:" (pop props)) ps) | ||
| 598 | (push (format "%s;" (pop props)) ps)) | ||
| 599 | (list (cons "Properties" (nreverse ps))))) | ||
| 600 | ("buffer code" | ||
| 601 | ,(encoded-string-description | ||
| 602 | (string-as-unibyte (char-to-string char)) nil)) | ||
| 603 | ("file code" | ||
| 604 | ,@(let* ((coding buffer-file-coding-system) | ||
| 605 | (encoded (encode-coding-char char coding))) | ||
| 606 | (if encoded | ||
| 607 | (list (encoded-string-description encoded coding) | ||
| 608 | (format "(encoded by coding system %S)" coding)) | ||
| 609 | (list "not encodable by coding system" | ||
| 610 | (symbol-name coding))))) | ||
| 611 | ,@(if (or (memq 'mule-utf-8 | ||
| 612 | (find-coding-systems-region (point) (1+ (point)))) | ||
| 613 | (get-char-property (point) 'untranslated-utf-8)) | ||
| 614 | (let ((uc (or (get-char-property (point) | ||
| 615 | 'untranslated-utf-8) | ||
| 616 | (encode-char (char-after) 'ucs)))) | ||
| 617 | (if uc | ||
| 618 | (list (list "Unicode" | ||
| 619 | (format "%04X" uc)))))) | ||
| 620 | ,(if (display-graphic-p (selected-frame)) | ||
| 621 | (list "font" (or (internal-char-font (point)) | ||
| 622 | "-- none --")) | ||
| 623 | (list "terminal code" | ||
| 624 | (let* ((coding (terminal-coding-system)) | ||
| 625 | (encoded (encode-coding-char char coding))) | ||
| 626 | (if encoded | ||
| 627 | (encoded-string-description encoded coding) | ||
| 628 | "not encodable"))))))) | ||
| 629 | (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x))) | ||
| 630 | item-list))) | ||
| 631 | (with-output-to-temp-buffer "*Help*" | ||
| 632 | (save-excursion | ||
| 633 | (set-buffer standard-output) | ||
| 634 | (set-buffer-multibyte multibyte-p) | ||
| 635 | (let ((formatter (format "%%%ds:" max-width))) | ||
| 636 | (dolist (elt item-list) | ||
| 637 | (insert (format formatter (car elt))) | ||
| 638 | (dolist (clm (cdr elt)) | ||
| 639 | (when (>= (+ (current-column) | ||
| 640 | (or (string-match "\n" clm) | ||
| 641 | (string-width clm)) 1) | ||
| 642 | (frame-width)) | ||
| 643 | (insert "\n") | ||
| 644 | (indent-to (1+ max-width))) | ||
| 645 | (insert " " clm)) | ||
| 646 | (insert "\n"))) | ||
| 647 | (when composition | ||
| 648 | (insert "\nComposed with the following character(s) " | ||
| 649 | (mapconcat (lambda (x) (format "`%c'" x)) | ||
| 650 | (substring composed 1) | ||
| 651 | ", ") | ||
| 652 | " to form `" composed "'") | ||
| 653 | (if (nth 3 composition) | ||
| 654 | (insert ".\n") | ||
| 655 | (insert "\nby the rule (" | ||
| 656 | (mapconcat (lambda (x) | ||
| 657 | (format (if (consp x) "%S" "?%c") x)) | ||
| 658 | (nth 2 composition) | ||
| 659 | " ") | ||
| 660 | ").\n" | ||
| 661 | "See the variable `reference-point-alist' for " | ||
| 662 | "the meaning of the rule.\n"))) | ||
| 663 | (when props | ||
| 664 | (insert "\nText properties\n") | ||
| 665 | (require 'descr-text) | ||
| 666 | (describe-text-properties props)))))) | ||
| 667 | 535 | ||
| 668 | ;;; CODING-SYSTEM | 536 | ;;; CODING-SYSTEM |
| 669 | 537 | ||