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