aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2004-05-02 01:49:08 +0000
committerKenichi Handa2004-05-02 01:49:08 +0000
commit6482d093194a4b79f0e736ae468fa5c1bb3fa80b (patch)
tree16799fb04a7887b29238bd8cc06a8c905d4c2359
parent26fb226b87e48a33c4584fc2a3f4734f119ea619 (diff)
downloademacs-6482d093194a4b79f0e736ae468fa5c1bb3fa80b.tar.gz
emacs-6482d093194a4b79f0e736ae468fa5c1bb3fa80b.zip
(describe-char): Copy the character with text
properties and overlays into the first line, and call describe-text-properties on it.
-rw-r--r--lisp/descr-text.el50
1 files changed, 26 insertions, 24 deletions
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index c73cfeb02c3..4b6605aa426 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -465,6 +465,7 @@ as well as widgets, buttons, overlays, and text properties."
465 (if (>= pos (point-max)) 465 (if (>= pos (point-max))
466 (error "No character follows specified position")) 466 (error "No character follows specified position"))
467 (let* ((char (char-after pos)) 467 (let* ((char (char-after pos))
468 (char-string (buffer-substring pos (1+ pos)))
468 (charset (char-charset char)) 469 (charset (char-charset char))
469 (buffer (current-buffer)) 470 (buffer (current-buffer))
470 (composition (find-composition pos nil nil t)) 471 (composition (find-composition pos nil nil t))
@@ -474,16 +475,11 @@ as well as widgets, buttons, overlays, and text properties."
474 standard-display-table)) 475 standard-display-table))
475 (disp-vector (and display-table (aref display-table char))) 476 (disp-vector (and display-table (aref display-table char)))
476 (multibyte-p enable-multibyte-characters) 477 (multibyte-p enable-multibyte-characters)
477 text-prop-description 478 (overlays (mapcar #'(lambda (o) (overlay-properties o))
479 (overlays-at pos)))
478 item-list max-width unicode) 480 item-list max-width unicode)
479 (if (eq charset 'unknown) 481 (if (eq charset 'unknown)
480 (setq item-list 482 (setq item-list '("character"))
481 `(("character"
482 ,(format "%s (0%o, %d, 0x%x) -- invalid character code"
483 (if (< char 256)
484 (single-key-description char)
485 (char-to-string char))
486 char char char))))
487 483
488 (if (or (< char 256) 484 (if (or (< char 256)
489 (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos))) 485 (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
@@ -491,14 +487,7 @@ as well as widgets, buttons, overlays, and text properties."
491 (setq unicode (or (get-char-property pos 'untranslated-utf-8) 487 (setq unicode (or (get-char-property pos 'untranslated-utf-8)
492 (encode-char char 'ucs)))) 488 (encode-char char 'ucs))))
493 (setq item-list 489 (setq item-list
494 `(("character" 490 `(("character")
495 ,(format "%s (0%o, %d, 0x%x%s)" (if (< char 256)
496 (single-key-description char)
497 (char-to-string char))
498 char char char
499 (if unicode
500 (format ", U+%04X" unicode)
501 "")))
502 ("charset" 491 ("charset"
503 ,(symbol-name charset) 492 ,(symbol-name charset)
504 ,(format "(%s)" (charset-description charset))) 493 ,(format "(%s)" (charset-description charset)))
@@ -583,18 +572,31 @@ as well as widgets, buttons, overlays, and text properties."
583 (cons (list "Unicode data" " ") unicodedata)))))) 572 (cons (list "Unicode data" " ") unicodedata))))))
584 (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x))) 573 (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x)))
585 item-list))) 574 item-list)))
586 (setq text-prop-description 575 (pop item-list)
587 (with-temp-buffer
588 (let ((buf (current-buffer)))
589 (save-excursion
590 (set-buffer buffer)
591 (describe-text-properties pos buf)))
592 (buffer-string)))
593 576
594 (with-output-to-temp-buffer "*Help*" 577 (with-output-to-temp-buffer "*Help*"
595 (with-current-buffer standard-output 578 (with-current-buffer standard-output
596 (set-buffer-multibyte multibyte-p) 579 (set-buffer-multibyte multibyte-p)
597 (let ((formatter (format "%%%ds:" max-width))) 580 (let ((formatter (format "%%%ds:" max-width)))
581 (insert (format formatter "character") " ")
582 (setq pos (point))
583 (insert char-string
584 (format " (`%s', 0%o, %d, 0x%x"
585 (if (< char 256)
586 (single-key-description char)
587 (char-to-string char))
588 char char char)
589 (if (eq charset 'unknown)
590 ") -- invalid character code\n"
591 (if unicode
592 (format ", U+%04X)\n" unicode)
593 ")\n")))
594 (mapc #'(lambda (props)
595 (let ((o (make-overlay pos (1+ pos))))
596 (while props
597 (overlay-put o (car props) (nth 1 props))
598 (setq props (cddr props)))))
599 overlays)
598 (dolist (elt item-list) 600 (dolist (elt item-list)
599 (when (cadr elt) 601 (when (cadr elt)
600 (insert (format formatter (car elt))) 602 (insert (format formatter (car elt)))
@@ -665,7 +667,7 @@ as well as widgets, buttons, overlays, and text properties."
665 (insert "\nSee the variable `reference-point-alist' for " 667 (insert "\nSee the variable `reference-point-alist' for "
666 "the meaning of the rule.\n")) 668 "the meaning of the rule.\n"))
667 669
668 (insert text-prop-description) 670 (describe-text-properties pos (current-buffer))
669 (describe-text-mode))))) 671 (describe-text-mode)))))
670 672
671(defalias 'describe-char-after 'describe-char) 673(defalias 'describe-char-after 'describe-char)