Rob Riepel <riepel at networking.stanford.edu>
[emacs.git] / lisp / descr-text.el
blobd14aba7ae6f40b31dc304867b5fe93c62622f5c5
1 ;;; descr-text.el --- describe text mode
3 ;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Boris Goldowsky <boris@gnu.org>
7 ;; Maintainer: FSF
8 ;; Keywords: faces, i18n, Unicode, multilingual
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
27 ;;; Commentary:
29 ;;; Describe-Text Mode.
31 ;;; Code:
33 (eval-when-compile (require 'quail))
34 (require 'help-fns)
36 ;;; Describe-Text Utilities.
38 (defun describe-text-widget (widget)
39 "Insert text to describe WIDGET in the current buffer."
40 (insert-text-button
41 (symbol-name (if (symbolp widget) widget (car widget)))
42 'action `(lambda (&rest ignore)
43 (widget-browse ',widget))
44 'help-echo "mouse-2, RET: browse this widget")
45 (insert " ")
46 (insert-text-button
47 "(widget)Top" 'type 'help-info 'help-args '("(widget)Top")))
49 (defun describe-text-sexp (sexp)
50 "Insert a short description of SEXP in the current buffer."
51 (let ((pp (condition-case signal
52 (pp-to-string sexp)
53 (error (prin1-to-string signal)))))
54 (when (string-match "\n\\'" pp)
55 (setq pp (substring pp 0 (1- (length pp)))))
56 (if (cond ((string-match "\n" pp)
57 nil)
58 ((> (length pp) (- (window-width) (current-column)))
59 nil)
60 (t t))
61 (insert pp)
62 (insert-text-button
63 "[Show]" 'action `(lambda (&rest ignore)
64 (with-output-to-temp-buffer
65 "*Pp Eval Output*"
66 (princ ',pp)))
67 'help-echo "mouse-2, RET: pretty print value in another buffer"))))
69 (defun describe-property-list (properties)
70 "Insert a description of PROPERTIES in the current buffer.
71 PROPERTIES should be a list of overlay or text properties.
72 The `category', `face' and `font-lock-face' properties are made
73 into help buttons that call `describe-text-category' or
74 `describe-face' when pushed."
75 ;; Sort the properties by the size of their value.
76 (dolist (elt (sort (let (ret)
77 (while properties
78 (push (list (pop properties) (pop properties)) ret))
79 ret)
80 (lambda (a b) (string< (prin1-to-string (nth 0 a) t)
81 (prin1-to-string (nth 0 b) t)))))
82 (let ((key (nth 0 elt))
83 (value (nth 1 elt)))
84 (insert (propertize (format " %-20s " key)
85 'face 'help-argument-name))
86 (cond ((eq key 'category)
87 (insert-text-button
88 (symbol-name value)
89 'action `(lambda (&rest ignore)
90 (describe-text-category ',value))
91 'help-echo "mouse-2, RET: describe this category"))
92 ((memq key '(face font-lock-face mouse-face))
93 (insert-text-button
94 (format "%S" value)
95 'type 'help-face 'help-args (list value)))
96 ((widgetp value)
97 (describe-text-widget value))
99 (describe-text-sexp value))))
100 (insert "\n")))
102 ;;; Describe-Text Commands.
104 (defun describe-text-category (category)
105 "Describe a text property category."
106 (interactive "SCategory: ")
107 (help-setup-xref (list #'describe-text-category category) (interactive-p))
108 (save-excursion
109 (with-output-to-temp-buffer "*Help*"
110 (set-buffer standard-output)
111 (insert "Category " (format "%S" category) ":\n\n")
112 (describe-property-list (symbol-plist category))
113 (goto-char (point-min)))))
115 ;;;###autoload
116 (defun describe-text-properties (pos &optional output-buffer)
117 "Describe widgets, buttons, overlays and text properties at POS.
118 Interactively, describe them for the character after point.
119 If optional second argument OUTPUT-BUFFER is non-nil,
120 insert the output into that buffer, and don't initialize or clear it
121 otherwise."
122 (interactive "d")
123 (if (>= pos (point-max))
124 (error "No character follows specified position"))
125 (if output-buffer
126 (describe-text-properties-1 pos output-buffer)
127 (if (not (or (text-properties-at pos) (overlays-at pos)))
128 (message "This is plain text.")
129 (let ((buffer (current-buffer))
130 (target-buffer "*Help*"))
131 (when (eq buffer (get-buffer target-buffer))
132 (setq target-buffer "*Help*<2>"))
133 (save-excursion
134 (with-output-to-temp-buffer target-buffer
135 (set-buffer standard-output)
136 (setq output-buffer (current-buffer))
137 (insert "Text content at position " (format "%d" pos) ":\n\n")
138 (with-current-buffer buffer
139 (describe-text-properties-1 pos output-buffer))
140 (goto-char (point-min))))))))
142 (defun describe-text-properties-1 (pos output-buffer)
143 (let* ((properties (text-properties-at pos))
144 (overlays (overlays-at pos))
145 (wid-field (get-char-property pos 'field))
146 (wid-button (get-char-property pos 'button))
147 (wid-doc (get-char-property pos 'widget-doc))
148 ;; If button.el is not loaded, we have no buttons in the text.
149 (button (and (fboundp 'button-at) (button-at pos)))
150 (button-type (and button (button-type button)))
151 (button-label (and button (button-label button)))
152 (widget (or wid-field wid-button wid-doc)))
153 (with-current-buffer output-buffer
154 ;; Widgets
155 (when (widgetp widget)
156 (newline)
157 (insert (cond (wid-field "This is an editable text area")
158 (wid-button "This is an active area")
159 (wid-doc "This is documentation text")))
160 (insert " of a ")
161 (describe-text-widget widget)
162 (insert ".\n\n"))
163 ;; Buttons
164 (when (and button (not (widgetp wid-button)))
165 (newline)
166 (insert "Here is a `" (format "%S" button-type)
167 "' button labeled `" button-label "'.\n\n"))
168 ;; Overlays
169 (when overlays
170 (newline)
171 (if (eq (length overlays) 1)
172 (insert "There is an overlay here:\n")
173 (insert "There are " (format "%d" (length overlays))
174 " overlays here:\n"))
175 (dolist (overlay overlays)
176 (insert " From " (format "%d" (overlay-start overlay))
177 " to " (format "%d" (overlay-end overlay)) "\n")
178 (describe-property-list (overlay-properties overlay)))
179 (insert "\n"))
180 ;; Text properties
181 (when properties
182 (newline)
183 (insert "There are text properties here:\n")
184 (describe-property-list properties)))))
186 (defcustom describe-char-unicodedata-file nil
187 "Location of Unicode data file.
188 This is the UnicodeData.txt file from the Unicode Consortium, used for
189 diagnostics. If it is non-nil `describe-char' will print data
190 looked up from it. This facility is mostly of use to people doing
191 multilingual development.
193 This is a fairly large file, not typically present on GNU systems.
194 At the time of writing it is at the URL
195 `http://www.unicode.org/Public/UNIDATA/UnicodeData.txt'."
196 :group 'mule
197 :version "22.1"
198 :type '(choice (const :tag "None" nil)
199 file))
201 ;; We could convert the unidata file into a Lispy form once-for-all
202 ;; and distribute it for loading on demand. It might be made more
203 ;; space-efficient by splitting strings word-wise and replacing them
204 ;; with lists of symbols interned in a private obarray, e.g.
205 ;; "LATIN SMALL LETTER A" => '(LATIN SMALL LETTER A).
207 ;; Fixme: Check whether this needs updating for Unicode 4.
208 (defun describe-char-unicode-data (char)
209 "Return a list of Unicode data for unicode CHAR.
210 Each element is a list of a property description and the property value.
211 The list is null if CHAR isn't found in `describe-char-unicodedata-file'."
212 (when describe-char-unicodedata-file
213 (unless (file-exists-p describe-char-unicodedata-file)
214 (error "`unicodedata-file' %s not found" describe-char-unicodedata-file))
215 (with-current-buffer (get-buffer-create " *Unicode Data*")
216 (when (zerop (buffer-size))
217 ;; Don't use -literally in case of DOS line endings.
218 (insert-file-contents describe-char-unicodedata-file))
219 (goto-char (point-min))
220 (let ((hex (format "%04X" char))
221 found first last)
222 (if (re-search-forward (concat "^" hex) nil t)
223 (setq found t)
224 ;; It's not listed explicitly. Look for ranges, e.g. CJK
225 ;; ideographs, and check whether it's in one of them.
226 (while (and (re-search-forward "^\\([^;]+\\);[^;]+First>;" nil t)
227 (>= char (setq first
228 (string-to-number (match-string 1) 16)))
229 (progn
230 (forward-line 1)
231 (looking-at "^\\([^;]+\\);[^;]+Last>;")
232 (> char
233 (setq last
234 (string-to-number (match-string 1) 16))))))
235 (if (and (>= char first)
236 (<= char last))
237 (setq found t)))
238 (if found
239 (let ((fields (mapcar (lambda (elt)
240 (if (> (length elt) 0)
241 elt))
242 (cdr (split-string
243 (buffer-substring
244 (line-beginning-position)
245 (line-end-position))
246 ";")))))
247 ;; The length depends on whether the last field was empty.
248 (unless (or (= 13 (length fields))
249 (= 14 (length fields)))
250 (error "Invalid contents in %s" describe-char-unicodedata-file))
251 ;; The field names and values lists are slightly
252 ;; modified from Mule-UCS unidata.el.
253 (list
254 (list "Name" (let ((name (nth 0 fields)))
255 ;; Check for <..., First>, <..., Last>
256 (if (string-match "\\`\\(<[^,]+\\)," name)
257 (concat (match-string 1 name) ">")
258 name)))
259 (list "Category"
260 (cdr (assoc
261 (nth 1 fields)
262 '(("Lu" . "uppercase letter")
263 ("Ll" . "lowercase letter")
264 ("Lt" . "titlecase letter")
265 ("Mn" . "non-spacing mark")
266 ("Mc" . "spacing-combining mark")
267 ("Me" . "enclosing mark")
268 ("Nd" . "decimal digit")
269 ("Nl" . "letter number")
270 ("No" . "other number")
271 ("Zs" . "space separator")
272 ("Zl" . "line separator")
273 ("Zp" . "paragraph separator")
274 ("Cc" . "other control")
275 ("Cf" . "other format")
276 ("Cs" . "surrogate")
277 ("Co" . "private use")
278 ("Cn" . "not assigned")
279 ("Lm" . "modifier letter")
280 ("Lo" . "other letter")
281 ("Pc" . "connector punctuation")
282 ("Pd" . "dash punctuation")
283 ("Ps" . "open punctuation")
284 ("Pe" . "close punctuation")
285 ("Pi" . "initial-quotation punctuation")
286 ("Pf" . "final-quotation punctuation")
287 ("Po" . "other punctuation")
288 ("Sm" . "math symbol")
289 ("Sc" . "currency symbol")
290 ("Sk" . "modifier symbol")
291 ("So" . "other symbol")))))
292 (list "Combining class"
293 (cdr (assoc
294 (string-to-number (nth 2 fields))
295 '((0 . "Spacing")
296 (1 . "Overlays and interior")
297 (7 . "Nuktas")
298 (8 . "Hiragana/Katakana voicing marks")
299 (9 . "Viramas")
300 (10 . "Start of fixed position classes")
301 (199 . "End of fixed position classes")
302 (200 . "Below left attached")
303 (202 . "Below attached")
304 (204 . "Below right attached")
305 (208 . "Left attached (reordrant around \
306 single base character)")
307 (210 . "Right attached")
308 (212 . "Above left attached")
309 (214 . "Above attached")
310 (216 . "Above right attached")
311 (218 . "Below left")
312 (220 . "Below")
313 (222 . "Below right")
314 (224 . "Left (reordrant around single base \
315 character)")
316 (226 . "Right")
317 (228 . "Above left")
318 (230 . "Above")
319 (232 . "Above right")
320 (233 . "Double below")
321 (234 . "Double above")
322 (240 . "Below (iota subscript)")))))
323 (list "Bidi category"
324 (cdr (assoc
325 (nth 3 fields)
326 '(("L" . "Left-to-Right")
327 ("LRE" . "Left-to-Right Embedding")
328 ("LRO" . "Left-to-Right Override")
329 ("R" . "Right-to-Left")
330 ("AL" . "Right-to-Left Arabic")
331 ("RLE" . "Right-to-Left Embedding")
332 ("RLO" . "Right-to-Left Override")
333 ("PDF" . "Pop Directional Format")
334 ("EN" . "European Number")
335 ("ES" . "European Number Separator")
336 ("ET" . "European Number Terminator")
337 ("AN" . "Arabic Number")
338 ("CS" . "Common Number Separator")
339 ("NSM" . "Non-Spacing Mark")
340 ("BN" . "Boundary Neutral")
341 ("B" . "Paragraph Separator")
342 ("S" . "Segment Separator")
343 ("WS" . "Whitespace")
344 ("ON" . "Other Neutrals")))))
345 (list
346 "Decomposition"
347 (if (nth 4 fields)
348 (let* ((parts (split-string (nth 4 fields)))
349 (info (car parts)))
350 (if (string-match "\\`<\\(.+\\)>\\'" info)
351 (setq info (match-string 1 info))
352 (setq info nil))
353 (if info (setq parts (cdr parts)))
354 ;; Maybe printing ? for unrepresentable unicodes
355 ;; here and below should be changed?
356 (setq parts (mapconcat
357 (lambda (arg)
358 (string (or (decode-char
359 'ucs
360 (string-to-number arg 16))
361 ??)))
362 parts " "))
363 (concat info parts))))
364 (list "Decimal digit value"
365 (nth 5 fields))
366 (list "Digit value"
367 (nth 6 fields))
368 (list "Numeric value"
369 (nth 7 fields))
370 (list "Mirrored"
371 (if (equal "Y" (nth 8 fields))
372 "yes"))
373 (list "Old name" (nth 9 fields))
374 (list "ISO 10646 comment" (nth 10 fields))
375 (list "Uppercase" (and (nth 11 fields)
376 (string (or (decode-char
377 'ucs
378 (string-to-number
379 (nth 11 fields) 16))
380 ??))))
381 (list "Lowercase" (and (nth 12 fields)
382 (string (or (decode-char
383 'ucs
384 (string-to-number
385 (nth 12 fields) 16))
386 ??))))
387 (list "Titlecase" (and (nth 13 fields)
388 (string (or (decode-char
389 'ucs
390 (string-to-number
391 (nth 13 fields) 16))
392 ??)))))))))))
394 ;; Return information about how CHAR is displayed at the buffer
395 ;; position POS. If the selected frame is on a graphic display,
396 ;; return a cons (FONTNAME . GLYPH-CODE). Otherwise, return a string
397 ;; describing the terminal codes for the character.
398 (defun describe-char-display (pos char)
399 (if (display-graphic-p (selected-frame))
400 (internal-char-font pos char)
401 (let* ((coding (terminal-coding-system))
402 (encoded (encode-coding-char char coding)))
403 (if encoded
404 (encoded-string-description encoded coding)))))
407 ;;;###autoload
408 (defun describe-char (pos)
409 "Describe the character after POS (interactively, the character after point).
410 The information includes character code, charset and code points in it,
411 syntax, category, how the character is encoded in a file,
412 character composition information (if relevant),
413 as well as widgets, buttons, overlays, and text properties."
414 (interactive "d")
415 (if (>= pos (point-max))
416 (error "No character follows specified position"))
417 (let* ((char (char-after pos))
418 (charset (char-charset char))
419 (composition (find-composition pos nil nil t))
420 (component-chars nil)
421 (display-table (or (window-display-table)
422 buffer-display-table
423 standard-display-table))
424 (disp-vector (and display-table (aref display-table char)))
425 (multibyte-p enable-multibyte-characters)
426 (overlays (mapcar #'(lambda (o) (overlay-properties o))
427 (overlays-at pos)))
428 (char-description (if (not multibyte-p)
429 (single-key-description char)
430 (if (< char 128)
431 (single-key-description char)
432 (string-to-multibyte
433 (char-to-string char)))))
434 (text-props-desc
435 (let ((tmp-buf (generate-new-buffer " *text-props*")))
436 (unwind-protect
437 (progn
438 (describe-text-properties pos tmp-buf)
439 (with-current-buffer tmp-buf (buffer-string)))
440 (kill-buffer tmp-buf))))
441 item-list max-width unicode)
443 (if (or (< char 256)
444 (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
445 (get-char-property pos 'untranslated-utf-8))
446 (setq unicode (or (get-char-property pos 'untranslated-utf-8)
447 (encode-char char 'ucs))))
448 (setq item-list
449 `(("character"
450 ,(format "%s (%d, #o%o, #x%x%s)"
451 (apply 'propertize char-description
452 (text-properties-at pos))
453 char char char
454 (if unicode
455 (format ", U+%04X" unicode)
456 "")))
457 ("charset"
458 ,`(insert-text-button
459 ,(symbol-name charset)
460 'type 'help-character-set 'help-args '(,charset))
461 ,(format "(%s)" (charset-description charset)))
462 ("code point"
463 ,(let ((split (split-char char)))
464 `(insert-text-button
465 ,(if (= (charset-dimension charset) 1)
466 (format "#x%02X" (nth 1 split))
467 (format "#x%02X #x%02X" (nth 1 split)
468 (nth 2 split)))
469 'action (lambda (&rest ignore)
470 (list-charset-chars ',charset)
471 (with-selected-window
472 (get-buffer-window "*Character List*" 0)
473 (goto-char (point-min))
474 (forward-line 2) ;Skip the header.
475 (let ((case-fold-search nil))
476 (search-forward ,(char-to-string char)
477 nil t))))
478 'help-echo
479 "mouse-2, RET: show this character in its character set")))
480 ("syntax"
481 ,(let ((syntax (syntax-after pos)))
482 (with-temp-buffer
483 (internal-describe-syntax-value syntax)
484 (buffer-string))))
485 ("category"
486 ,@(let ((category-set (char-category-set char)))
487 (if (not category-set)
488 '("-- none --")
489 (mapcar #'(lambda (x) (format "%c:%s"
490 x (category-docstring x)))
491 (category-set-mnemonics category-set)))))
492 ,@(let ((props (aref char-code-property-table char))
494 (when props
495 (while props
496 (push (format "%s:" (pop props)) ps)
497 (push (format "%s;" (pop props)) ps))
498 (list (cons "Properties" (nreverse ps)))))
499 ("to input"
500 ,@(let ((key-list (and (eq input-method-function
501 'quail-input-method)
502 (quail-find-key char))))
503 (if (consp key-list)
504 (list "type"
505 (mapconcat #'(lambda (x) (concat "\"" x "\""))
506 key-list " or ")
507 "with"
508 `(insert-text-button
509 ,current-input-method
510 'type 'help-input-method
511 'help-args '(,current-input-method))))))
512 ("buffer code"
513 ,(encoded-string-description
514 (string-as-unibyte (char-to-string char)) nil))
515 ("file code"
516 ,@(let* ((coding buffer-file-coding-system)
517 (encoded (encode-coding-char char coding)))
518 (if encoded
519 (list (encoded-string-description encoded coding)
520 (format "(encoded by coding system %S)" coding))
521 (list "not encodable by coding system"
522 (symbol-name coding)))))
523 ("display"
524 ,(cond
525 (disp-vector
526 (setq disp-vector (copy-sequence disp-vector))
527 (dotimes (i (length disp-vector))
528 (setq char (aref disp-vector i))
529 (aset disp-vector i
530 (cons char (describe-char-display
531 pos (glyph-char char)))))
532 (format "by display table entry [%s] (see below)"
533 (mapconcat
534 #'(lambda (x)
535 (format "?%c" (glyph-char (car x))))
536 disp-vector " ")))
537 (composition
538 (let ((from (car composition))
539 (to (nth 1 composition))
540 (next (1+ pos))
541 (components (nth 2 composition))
543 (setcar composition
544 (and (< from pos) (buffer-substring from pos)))
545 (setcar (cdr composition)
546 (and (< next to) (buffer-substring next to)))
547 (dotimes (i (length components))
548 (if (integerp (setq ch (aref components i)))
549 (push (cons ch (describe-char-display pos ch))
550 component-chars)))
551 (setq component-chars (nreverse component-chars))
552 (format "composed to form \"%s\" (see below)"
553 (buffer-substring from to))))
555 (let ((display (describe-char-display pos char)))
556 (if (display-graphic-p (selected-frame))
557 (if display
558 (concat
559 "by this font (glyph code)\n"
560 (format " %s (#x%02X)"
561 (car display) (cdr display)))
562 "no font available")
563 (if display
564 (format "terminal code %s" display)
565 "not encodable for terminal"))))))
566 ,@(let ((face
567 (if (not (or disp-vector composition))
568 (cond
569 ((and show-trailing-whitespace
570 (save-excursion (goto-char pos)
571 (looking-at "[ \t]+$")))
572 'trailing-whitespace)
573 ((and nobreak-char-display unicode (eq unicode '#xa0))
574 'nobreak-space)
575 ((and nobreak-char-display unicode (eq unicode '#xad))
576 'escape-glyph)
577 ((and (< char 32) (not (memq char '(9 10))))
578 'escape-glyph)))))
579 (if face (list (list "hardcoded face"
580 `(insert-text-button
581 ,(symbol-name face)
582 'type 'help-face 'help-args '(,face))))))
583 ,@(let ((unicodedata (and unicode
584 (describe-char-unicode-data unicode))))
585 (if unicodedata
586 (cons (list "Unicode data" " ") unicodedata)))))
587 (setq max-width (apply #'max (mapcar #'(lambda (x)
588 (if (cadr x) (length (car x)) 0))
589 item-list)))
590 (help-setup-xref nil (interactive-p))
591 (with-output-to-temp-buffer (help-buffer)
592 (with-current-buffer standard-output
593 (set-buffer-multibyte multibyte-p)
594 (let ((formatter (format "%%%ds:" max-width)))
595 (dolist (elt item-list)
596 (when (cadr elt)
597 (insert (format formatter (car elt)))
598 (dolist (clm (cdr elt))
599 (if (eq (car-safe clm) 'insert-text-button)
600 (progn (insert " ") (eval clm))
601 (when (>= (+ (current-column)
602 (or (string-match "\n" clm)
603 (string-width clm))
605 (window-width))
606 (insert "\n")
607 (indent-to (1+ max-width)))
608 (insert " " clm)))
609 (insert "\n"))))
611 (when overlays
612 (save-excursion
613 (goto-char (point-min))
614 (re-search-forward "character:[ \t\n]+")
615 (let* ((end (+ (point) (length char-description))))
616 (mapc #'(lambda (props)
617 (let ((o (make-overlay (point) end)))
618 (while props
619 (overlay-put o (car props) (nth 1 props))
620 (setq props (cddr props)))))
621 overlays))))
623 (when disp-vector
624 (insert
625 "\nThe display table entry is displayed by ")
626 (if (display-graphic-p (selected-frame))
627 (progn
628 (insert "these fonts (glyph codes):\n")
629 (dotimes (i (length disp-vector))
630 (insert (glyph-char (car (aref disp-vector i))) ?:
631 (propertize " " 'display '(space :align-to 5))
632 (if (cdr (aref disp-vector i))
633 (format "%s (#x%02X)" (cadr (aref disp-vector i))
634 (cddr (aref disp-vector i)))
635 "-- no font --")
636 "\n")
637 (let ((face (glyph-face (car (aref disp-vector i)))))
638 (when face
639 (insert (propertize " " 'display '(space :align-to 5))
640 "face: ")
641 (insert (concat "`" (symbol-name face) "'"))
642 (insert "\n")))))
643 (insert "these terminal codes:\n")
644 (dotimes (i (length disp-vector))
645 (insert (car (aref disp-vector i))
646 (propertize " " 'display '(space :align-to 5))
647 (or (cdr (aref disp-vector i)) "-- not encodable --")
648 "\n"))))
650 (when composition
651 (insert "\nComposed")
652 (if (car composition)
653 (if (cadr composition)
654 (insert " with the surrounding characters \""
655 (car composition) "\" and \""
656 (cadr composition) "\"")
657 (insert " with the preceding character(s) \""
658 (car composition) "\""))
659 (if (cadr composition)
660 (insert " with the following character(s) \""
661 (cadr composition) "\"")))
662 (insert " by the rule:\n\t("
663 (mapconcat (lambda (x)
664 (format (if (consp x) "%S" "?%c") x))
665 (nth 2 composition)
666 " ")
667 ")")
668 (insert "\nThe component character(s) are displayed by ")
669 (if (display-graphic-p (selected-frame))
670 (progn
671 (insert "these fonts (glyph codes):")
672 (dolist (elt component-chars)
673 (insert "\n " (car elt) ?:
674 (propertize " " 'display '(space :align-to 5))
675 (if (cdr elt)
676 (format "%s (#x%02X)" (cadr elt) (cddr elt))
677 "-- no font --"))))
678 (insert "these terminal codes:")
679 (dolist (elt component-chars)
680 (insert "\n " (car elt) ":"
681 (propertize " " 'display '(space :align-to 5))
682 (or (cdr elt) "-- not encodable --"))))
683 (insert "\nSee the variable `reference-point-alist' for "
684 "the meaning of the rule.\n"))
686 (if text-props-desc (insert text-props-desc))
687 (setq help-xref-stack-item (list 'help-insert-string (buffer-string)))
688 (toggle-read-only 1)
689 (print-help-return-message)))))
691 (defalias 'describe-char-after 'describe-char)
692 (make-obsolete 'describe-char-after 'describe-char "22.1")
694 (provide 'descr-text)
696 ;; arch-tag: fc55a498-f3e9-4312-b5bd-98cc02480af1
697 ;;; descr-text.el ends here