diff options
| author | Juri Linkov | 2005-07-19 11:23:14 +0000 |
|---|---|---|
| committer | Juri Linkov | 2005-07-19 11:23:14 +0000 |
| commit | fedbc8e58cfd8d32181437674dcf5ee25dcfb6b4 (patch) | |
| tree | 266973517c61bd44af3c8d02c3accadcc75bf7f6 | |
| parent | 91f48803794c045f84f871639847158ee7d212f2 (diff) | |
| download | emacs-fedbc8e58cfd8d32181437674dcf5ee25dcfb6b4.tar.gz emacs-fedbc8e58cfd8d32181437674dcf5ee25dcfb6b4.zip | |
(describe-char): Create link buttons for `charset'
and `code point'. Add the current input method name with a link
button to `to input' field. Print face names of display table
characters in `The display table entry is displayed by' section
instead of printing face-id in the `display' field.
Guess hardcoded faces and create a link button for them.
Skip empty fields when calculating max-width.
Treat `widget-create' specially while inserting strings from the
collected field list.
(describe-char-after): Made obsolete in version 22.1, not 21.5.
| -rw-r--r-- | lisp/descr-text.el | 92 |
1 files changed, 72 insertions, 20 deletions
diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 3c548458713..f639b811a45 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el | |||
| @@ -479,13 +479,25 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 479 | (format ", U+%04X" unicode) | 479 | (format ", U+%04X" unicode) |
| 480 | ""))) | 480 | ""))) |
| 481 | ("charset" | 481 | ("charset" |
| 482 | ,(symbol-name charset) | 482 | ,`(widget-create 'link |
| 483 | :notify (lambda (&rest ignore) | ||
| 484 | (describe-character-set ',charset)) | ||
| 485 | ,(symbol-name charset)) | ||
| 483 | ,(format "(%s)" (charset-description charset))) | 486 | ,(format "(%s)" (charset-description charset))) |
| 484 | ("code point" | 487 | ("code point" |
| 485 | ,(let ((split (split-char char))) | 488 | ,(let ((split (split-char char))) |
| 486 | (if (= (charset-dimension charset) 1) | 489 | `(widget-create |
| 487 | (format "%d" (nth 1 split)) | 490 | 'link |
| 488 | (format "%d %d" (nth 1 split) (nth 2 split))))) | 491 | :notify (lambda (&rest ignore) |
| 492 | (list-charset-chars ',charset) | ||
| 493 | (with-selected-window | ||
| 494 | (get-buffer-window "*Character List*") | ||
| 495 | (goto-char (point-min)) | ||
| 496 | (search-forward ,(char-to-string char) | ||
| 497 | nil t))) | ||
| 498 | ,(if (= (charset-dimension charset) 1) | ||
| 499 | (format "%d" (nth 1 split)) | ||
| 500 | (format "%d %d" (nth 1 split) (nth 2 split)))))) | ||
| 489 | ("syntax" | 501 | ("syntax" |
| 490 | ,(let ((syntax (syntax-after pos))) | 502 | ,(let ((syntax (syntax-after pos))) |
| 491 | (with-temp-buffer | 503 | (with-temp-buffer |
| @@ -512,7 +524,14 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 512 | (if (consp key-list) | 524 | (if (consp key-list) |
| 513 | (list "type" | 525 | (list "type" |
| 514 | (mapconcat #'(lambda (x) (concat "\"" x "\"")) | 526 | (mapconcat #'(lambda (x) (concat "\"" x "\"")) |
| 515 | key-list " or "))))) | 527 | key-list " or ") |
| 528 | "with" | ||
| 529 | `(widget-create | ||
| 530 | 'link | ||
| 531 | :notify (lambda (&rest ignore) | ||
| 532 | (describe-input-method | ||
| 533 | ',current-input-method)) | ||
| 534 | ,(format "%s" current-input-method)))))) | ||
| 516 | ("buffer code" | 535 | ("buffer code" |
| 517 | ,(encoded-string-description | 536 | ,(encoded-string-description |
| 518 | (string-as-unibyte (char-to-string char)) nil)) | 537 | (string-as-unibyte (char-to-string char)) nil)) |
| @@ -536,11 +555,7 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 536 | (format "by display table entry [%s] (see below)" | 555 | (format "by display table entry [%s] (see below)" |
| 537 | (mapconcat | 556 | (mapconcat |
| 538 | #'(lambda (x) | 557 | #'(lambda (x) |
| 539 | (if (> (car x) #x7ffff) | 558 | (format "?%c" (logand (car x) #x7ffff))) |
| 540 | (format "?%c<face-id=%s>" | ||
| 541 | (logand (car x) #x7ffff) | ||
| 542 | (lsh (car x) -19)) | ||
| 543 | (format "?%c" (car x)))) | ||
| 544 | disp-vector " "))) | 559 | disp-vector " "))) |
| 545 | (composition | 560 | (composition |
| 546 | (let ((from (car composition)) | 561 | (let ((from (car composition)) |
| @@ -571,11 +586,31 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 571 | (if display | 586 | (if display |
| 572 | (format "terminal code %s" display) | 587 | (format "terminal code %s" display) |
| 573 | "not encodable for terminal")))))) | 588 | "not encodable for terminal")))))) |
| 589 | ,@(let ((face | ||
| 590 | (if (not (or disp-vector composition)) | ||
| 591 | (cond | ||
| 592 | ((and show-trailing-whitespace | ||
| 593 | (save-excursion (goto-char pos) | ||
| 594 | (looking-at "[ \t]+$"))) | ||
| 595 | 'trailing-whitespace) | ||
| 596 | ((and nobreak-char-display unicode (eq unicode '#xa0)) | ||
| 597 | 'nobreak-space) | ||
| 598 | ((and nobreak-char-display unicode (eq unicode '#xad)) | ||
| 599 | 'escape-glyph) | ||
| 600 | ((and (< char 32) (not (memq char '(9 10)))) | ||
| 601 | 'escape-glyph))))) | ||
| 602 | (if face (list (list "hardcoded face" | ||
| 603 | `(widget-create | ||
| 604 | 'link | ||
| 605 | :notify (lambda (&rest ignore) | ||
| 606 | (describe-face ',face)) | ||
| 607 | ,(format "%s" face)))))) | ||
| 574 | ,@(let ((unicodedata (and unicode | 608 | ,@(let ((unicodedata (and unicode |
| 575 | (describe-char-unicode-data unicode)))) | 609 | (describe-char-unicode-data unicode)))) |
| 576 | (if unicodedata | 610 | (if unicodedata |
| 577 | (cons (list "Unicode data" " ") unicodedata))))) | 611 | (cons (list "Unicode data" " ") unicodedata))))) |
| 578 | (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x))) | 612 | (setq max-width (apply #'max (mapcar #'(lambda (x) |
| 613 | (if (cadr x) (length (car x)) 0)) | ||
| 579 | item-list))) | 614 | item-list))) |
| 580 | (with-output-to-temp-buffer "*Help*" | 615 | (with-output-to-temp-buffer "*Help*" |
| 581 | (with-current-buffer standard-output | 616 | (with-current-buffer standard-output |
| @@ -585,13 +620,16 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 585 | (when (cadr elt) | 620 | (when (cadr elt) |
| 586 | (insert (format formatter (car elt))) | 621 | (insert (format formatter (car elt))) |
| 587 | (dolist (clm (cdr elt)) | 622 | (dolist (clm (cdr elt)) |
| 588 | (when (>= (+ (current-column) | 623 | (if (eq (car-safe clm) 'widget-create) |
| 589 | (or (string-match "\n" clm) | 624 | (progn (insert " ") (eval clm)) |
| 590 | (string-width clm)) 1) | 625 | (when (>= (+ (current-column) |
| 591 | (window-width)) | 626 | (or (string-match "\n" clm) |
| 592 | (insert "\n") | 627 | (string-width clm)) |
| 593 | (indent-to (1+ max-width))) | 628 | 1) |
| 594 | (insert " " clm)) | 629 | (window-width)) |
| 630 | (insert "\n") | ||
| 631 | (indent-to (1+ max-width))) | ||
| 632 | (insert " " clm))) | ||
| 595 | (insert "\n")))) | 633 | (insert "\n")))) |
| 596 | 634 | ||
| 597 | (save-excursion | 635 | (save-excursion |
| @@ -619,7 +657,21 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 619 | (format "%s (0x%02X)" (cadr (aref disp-vector i)) | 657 | (format "%s (0x%02X)" (cadr (aref disp-vector i)) |
| 620 | (cddr (aref disp-vector i))) | 658 | (cddr (aref disp-vector i))) |
| 621 | "-- no font --") | 659 | "-- no font --") |
| 622 | "\n "))) | 660 | "\n") |
| 661 | (when (> (car (aref disp-vector i)) #x7ffff) | ||
| 662 | (let* ((face-id (lsh (car (aref disp-vector i)) -19)) | ||
| 663 | (face (car (delq nil (mapcar (lambda (face) | ||
| 664 | (and (eq (face-id face) | ||
| 665 | face-id) face)) | ||
| 666 | (face-list)))))) | ||
| 667 | (when face | ||
| 668 | (insert (propertize " " 'display '(space :align-to 5)) | ||
| 669 | "face: ") | ||
| 670 | (widget-create 'link | ||
| 671 | :notify `(lambda (&rest ignore) | ||
| 672 | (describe-face ',face)) | ||
| 673 | (format "%S" face)) | ||
| 674 | (insert "\n")))))) | ||
| 623 | (insert "these terminal codes:\n") | 675 | (insert "these terminal codes:\n") |
| 624 | (dotimes (i (length disp-vector)) | 676 | (dotimes (i (length disp-vector)) |
| 625 | (insert (car (aref disp-vector i)) | 677 | (insert (car (aref disp-vector i)) |
| @@ -667,7 +719,7 @@ as well as widgets, buttons, overlays, and text properties." | |||
| 667 | (describe-text-mode))))) | 719 | (describe-text-mode))))) |
| 668 | 720 | ||
| 669 | (defalias 'describe-char-after 'describe-char) | 721 | (defalias 'describe-char-after 'describe-char) |
| 670 | (make-obsolete 'describe-char-after 'describe-char "21.5") | 722 | (make-obsolete 'describe-char-after 'describe-char "22.1") |
| 671 | 723 | ||
| 672 | (provide 'descr-text) | 724 | (provide 'descr-text) |
| 673 | 725 | ||