(change-log-font-lock-keywords): Remove `:' from
[bpt/emacs.git] / lisp / descr-text.el
CommitLineData
dcb90b5f 1;;; descr-text.el --- describe text mode
2a1e884e 2
72354910 3;; Copyright (c) 1994, 95, 96, 2001, 02, 03, 04 Free Software Foundation, Inc.
2a1e884e
RS
4
5;; Author: Boris Goldowsky <boris@gnu.org>
6;; Keywords: faces
7
8;; This file is part of GNU Emacs.
9
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.
14
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.
19
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.
24
25;;; Commentary:
26
27;;; Describe-Text Mode.
28
29;;; Code:
30
309473d0 31(eval-when-compile (require 'button) (require 'quail))
831ccfa6 32
2a1e884e
RS
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)))
39
71296446 40(defvar describe-text-mode-map
2a1e884e
RS
41 (let ((map (make-sparse-keymap)))
42 (set-keymap-parent map widget-keymap)
43 map)
44 "Keymap for `describe-text-mode'.")
71296446 45
2a1e884e
RS
46(defcustom describe-text-mode-hook nil
47 "List of hook functions ran by `describe-text-mode'."
d77a0b9b
MR
48 :type 'hook
49 :group 'facemenu)
2a1e884e
RS
50
51(defun describe-text-mode ()
4adb7c09 52 "Major mode for buffers created by `describe-char'.
2a1e884e
RS
53
54\\{describe-text-mode-map}
55Entry to this mode calls the value of `describe-text-mode-hook'
56if 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)
f0397cde 62 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
2a1e884e
RS
63 (run-hooks 'describe-text-mode-hook))
64
65;;; Describe-Text Utilities.
66
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))
71296446 72 (format "%S" (if (symbolp widget)
2a1e884e
RS
73 widget
74 (car widget))))
75 (widget-insert " ")
76 (widget-create 'info-link :tag "widget" "(widget)Top"))
77
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))))
2a1e884e 98
4adb7c09 99(defun describe-property-list (properties)
2a1e884e
RS
100 "Insert a description of PROPERTIES in the current buffer.
101PROPERTIES should be a list of overlay or text properties.
4eb59450
JL
102The `category', `face' and `font-lock-face' properties are made
103into widget buttons that call `describe-text-category' or
104`describe-face' when pushed."
e2fa2f6e
CW
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)
4eb59450 114 (unless (or (memq key '(category face font-lock-face))
e2fa2f6e
CW
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)))
c1a1535a 125 (widget-insert (propertize (format " %-20s " key)
e2fa2f6e 126 'font-lock-face 'italic))
2a1e884e 127 (cond ((eq key 'category)
c1a1535a 128 (widget-create 'link
2a1e884e
RS
129 :notify `(lambda (&rest ignore)
130 (describe-text-category ',value))
131 (format "%S" value)))
4eb59450 132 ((memq key '(face font-lock-face))
72354910
JL
133 (widget-create 'link
134 :notify `(lambda (&rest ignore)
135 (describe-face ',value))
136 (format "%S" value)))
2a1e884e
RS
137 ((widgetp value)
138 (describe-text-widget value))
139 (t
e2fa2f6e
CW
140 (widget-insert value))))
141 (widget-insert "\n")))
2a1e884e
RS
142\f
143;;; Describe-Text Commands.
144
145(defun describe-text-category (category)
146 "Describe a text property category."
147 (interactive "S")
2a1e884e 148 (save-excursion
ca9088e7
SM
149 (with-output-to-temp-buffer "*Help*"
150 (set-buffer standard-output)
2a1e884e 151 (widget-insert "Category " (format "%S" category) ":\n\n")
4adb7c09 152 (describe-property-list (symbol-plist category))
2a1e884e
RS
153 (describe-text-mode)
154 (goto-char (point-min)))))
155
156;;;###autoload
4adb7c09
RS
157(defun describe-text-properties (pos &optional output-buffer)
158 "Describe widgets, buttons, overlays and text properties at POS.
159Interactively, describe them for the character after point.
160If optional second argument OUTPUT-BUFFER is non-nil,
161insert the output into that buffer, and don't initialize or clear it
162otherwise."
2a1e884e 163 (interactive "d")
4adb7c09
RS
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.")
4adb7c09 170 (let ((buffer (current-buffer)))
ca9088e7
SM
171 (when (eq buffer (get-buffer "*Help*"))
172 (error "Can't do self inspection"))
4adb7c09 173 (save-excursion
ca9088e7
SM
174 (with-output-to-temp-buffer "*Help*"
175 (set-buffer standard-output)
4adb7c09
RS
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))))))))
182
183(defun describe-text-properties-1 (pos output-buffer)
2a1e884e
RS
184 (let* ((properties (text-properties-at pos))
185 (overlays (overlays-at pos))
2a1e884e
RS
186 (wid-field (get-char-property pos 'field))
187 (wid-button (get-char-property pos 'button))
188 (wid-doc (get-char-property pos 'widget-doc))
189 ;; If button.el is not loaded, we have no buttons in the text.
190 (button (and (fboundp 'button-at) (button-at pos)))
191 (button-type (and button (button-type button)))
192 (button-label (and button (button-label button)))
193 (widget (or wid-field wid-button wid-doc)))
4adb7c09
RS
194 (with-current-buffer output-buffer
195 ;; Widgets
196 (when (widgetp widget)
197 (newline)
198 (widget-insert (cond (wid-field "This is an editable text area")
199 (wid-button "This is an active area")
200 (wid-doc "This is documentation text")))
201 (widget-insert " of a ")
202 (describe-text-widget widget)
203 (widget-insert ".\n\n"))
204 ;; Buttons
205 (when (and button (not (widgetp wid-button)))
206 (newline)
71296446 207 (widget-insert "Here is a " (format "%S" button-type)
4adb7c09
RS
208 " button labeled `" button-label "'.\n\n"))
209 ;; Overlays
210 (when overlays
211 (newline)
212 (if (eq (length overlays) 1)
213 (widget-insert "There is an overlay here:\n")
214 (widget-insert "There are " (format "%d" (length overlays))
215 " overlays here:\n"))
216 (dolist (overlay overlays)
71296446 217 (widget-insert " From " (format "%d" (overlay-start overlay))
4adb7c09
RS
218 " to " (format "%d" (overlay-end overlay)) "\n")
219 (describe-property-list (overlay-properties overlay)))
220 (widget-insert "\n"))
221 ;; Text properties
222 (when properties
223 (newline)
224 (widget-insert "There are text properties here:\n")
225 (describe-property-list properties)))))
d6c135fb 226\f
49c2a2dc
SM
227(defcustom describe-char-unicodedata-file nil
228 "Location of Unicode data file.
229This is the UnicodeData.txt file from the Unicode consortium, used for
230diagnostics. If it is non-nil `describe-char-after' will print data
231looked up from it. This facility is mostly of use to people doing
232multilingual development.
4adb7c09 233
49c2a2dc
SM
234This is a fairly large file, not typically present on GNU systems. At
235the time of writing it is at
236<URL:http://www.unicode.org/Public/UNIDATA/UnicodeData.txt>."
237 :group 'mule
238 :version "21.4"
239 :type '(choice (const :tag "None" nil)
240 file))
831ccfa6 241
49c2a2dc
SM
242;; We could convert the unidata file into a Lispy form once-for-all
243;; and distribute it for loading on demand. It might be made more
244;; space-efficient by splitting strings word-wise and replacing them
245;; with lists of symbols interned in a private obarray, e.g.
246;; "LATIN SMALL LETTER A" => '(LATIN SMALL LETTER A).
831ccfa6 247
49c2a2dc
SM
248;; Fixme: Check whether this needs updating for Unicode 4.
249(defun describe-char-unicode-data (char)
250 "Return a list of Unicode data for unicode CHAR.
251Each element is a list of a property description and the property value.
252The list is null if CHAR isn't found in `describe-char-unicodedata-file'."
253 (when describe-char-unicodedata-file
254 (unless (file-exists-p describe-char-unicodedata-file)
255 (error "`unicodedata-file' %s not found" describe-char-unicodedata-file))
256 (with-current-buffer
257 ;; Find file in fundamental mode to avoid, e.g. flyspell turned
258 ;; on for .txt. Don't use RAWFILE arg in case of DOS line endings.
259 (let ((auto-mode-alist))
260 (find-file-noselect describe-char-unicodedata-file))
261 (goto-char (point-min))
262 (let ((hex (format "%04X" char))
263 found first last)
264 (if (re-search-forward (concat "^" hex) nil t)
265 (setq found t)
266 ;; It's not listed explicitly. Look for ranges, e.g. CJK
267 ;; ideographs, and check whether it's in one of them.
268 (while (and (re-search-forward "^\\([^;]+\\);[^;]+First>;" nil t)
269 (>= char (setq first
270 (string-to-number (match-string 1) 16)))
271 (progn
272 (forward-line 1)
273 (looking-at "^\\([^;]+\\);[^;]+Last>;")
274 (> char
275 (setq last
276 (string-to-number (match-string 1) 16))))))
277 (if (and (>= char first)
278 (<= char last))
279 (setq found t)))
280 (if found
281 (let ((fields (mapcar (lambda (elt)
282 (if (> (length elt) 0)
283 elt))
284 (cdr (split-string
285 (buffer-substring
286 (line-beginning-position)
287 (line-end-position))
288 ";")))))
289 ;; The length depends on whether the last field was empty.
290 (unless (or (= 13 (length fields))
291 (= 14 (length fields)))
292 (error "Invalid contents in %s" describe-char-unicodedata-file))
293 ;; The field names and values lists are slightly
294 ;; modified from Mule-UCS unidata.el.
295 (list
296 (list "Name" (let ((name (nth 0 fields)))
297 ;; Check for <..., First>, <..., Last>
298 (if (string-match "\\`\\(<[^,]+\\)," name)
299 (concat (match-string 1 name) ">")
300 name)))
301 (list "Category"
302 (cdr (assoc
303 (nth 1 fields)
304 '(("Lu" . "uppercase letter")
305 ("Ll" . "lowercase letter")
306 ("Lt" . "titlecase letter")
307 ("Mn" . "non-spacing mark")
308 ("Mc" . "spacing-combining mark")
309 ("Me" . "enclosing mark")
310 ("Nd" . "decimal digit")
311 ("Nl" . "letter number")
312 ("No" . "other number")
313 ("Zs" . "space separator")
314 ("Zl" . "line separator")
315 ("Zp" . "paragraph separator")
316 ("Cc" . "other control")
317 ("Cf" . "other format")
318 ("Cs" . "surrogate")
319 ("Co" . "private use")
320 ("Cn" . "not assigned")
321 ("Lm" . "modifier letter")
322 ("Lo" . "other letter")
323 ("Pc" . "connector punctuation")
324 ("Pd" . "dash punctuation")
325 ("Ps" . "open punctuation")
326 ("Pe" . "close punctuation")
327 ("Pi" . "initial-quotation punctuation")
328 ("Pf" . "final-quotation punctuation")
329 ("Po" . "other punctuation")
330 ("Sm" . "math symbol")
331 ("Sc" . "currency symbol")
332 ("Sk" . "modifier symbol")
333 ("So" . "other symbol")))))
334 (list "Combining class"
335 (cdr (assoc
336 (string-to-number (nth 2 fields))
337 '((0 . "Spacing")
338 (1 . "Overlays and interior")
339 (7 . "Nuktas")
340 (8 . "Hiragana/Katakana voicing marks")
341 (9 . "Viramas")
342 (10 . "Start of fixed position classes")
343 (199 . "End of fixed position classes")
344 (200 . "Below left attached")
345 (202 . "Below attached")
346 (204 . "Below right attached")
347 (208 . "Left attached (reordrant around \
348single base character)")
349 (210 . "Right attached")
350 (212 . "Above left attached")
351 (214 . "Above attached")
352 (216 . "Above right attached")
353 (218 . "Below left")
354 (220 . "Below")
355 (222 . "Below right")
356 (224 . "Left (reordrant around single base \
357character)")
358 (226 . "Right")
359 (228 . "Above left")
360 (230 . "Above")
361 (232 . "Above right")
362 (233 . "Double below")
363 (234 . "Double above")
364 (240 . "Below (iota subscript)")))))
365 (list "Bidi category"
366 (cdr (assoc
367 (nth 3 fields)
368 '(("L" . "Left-to-Right")
369 ("LRE" . "Left-to-Right Embedding")
370 ("LRO" . "Left-to-Right Override")
371 ("R" . "Right-to-Left")
372 ("AL" . "Right-to-Left Arabic")
373 ("RLE" . "Right-to-Left Embedding")
374 ("RLO" . "Right-to-Left Override")
375 ("PDF" . "Pop Directional Format")
376 ("EN" . "European Number")
377 ("ES" . "European Number Separator")
378 ("ET" . "European Number Terminator")
379 ("AN" . "Arabic Number")
380 ("CS" . "Common Number Separator")
381 ("NSM" . "Non-Spacing Mark")
382 ("BN" . "Boundary Neutral")
383 ("B" . "Paragraph Separator")
384 ("S" . "Segment Separator")
385 ("WS" . "Whitespace")
386 ("ON" . "Other Neutrals")))))
387 (list
388 "Decomposition"
389 (if (nth 4 fields)
390 (let* ((parts (split-string (nth 4 fields)))
391 (info (car parts)))
392 (if (string-match "\\`<\\(.+\\)>\\'" info)
393 (setq info (match-string 1 info))
394 (setq info nil))
395 (if info (setq parts (cdr parts)))
396 ;; Maybe printing ? for unrepresentable unicodes
397 ;; here and below should be changed?
398 (setq parts (mapconcat
399 (lambda (arg)
400 (string (or (decode-char
401 'ucs
402 (string-to-number arg 16))
403 ??)))
404 parts " "))
405 (concat info parts))))
406 (list "Decimal digit value"
407 (nth 5 fields))
408 (list "Digit value"
409 (nth 6 fields))
410 (list "Numeric value"
411 (nth 7 fields))
412 (list "Mirrored"
413 (if (equal "Y" (nth 8 fields))
414 "yes"))
415 (list "Old name" (nth 9 fields))
416 (list "ISO 10646 comment" (nth 10 fields))
417 (list "Uppercase" (and (nth 11 fields)
418 (string (or (decode-char
419 'ucs
420 (string-to-number
421 (nth 11 fields) 16))
422 ??))))
423 (list "Lowercase" (and (nth 12 fields)
424 (string (or (decode-char
425 'ucs
426 (string-to-number
427 (nth 12 fields) 16))
428 ??))))
429 (list "Titlecase" (and (nth 13 fields)
430 (string (or (decode-char
431 'ucs
432 (string-to-number
433 (nth 13 fields) 16))
434 ??)))))))))))
f15078e2
KH
435
436;; Return information about how CHAR is displayed at the buffer
437;; position POS. If the selected frame is on a graphic display,
438;; return a cons (FONTNAME . GLYPH-CODE). Otherwise, return a string
439;; describing the terminal codes for the character.
440(defun describe-char-display (pos char)
441 (if (display-graphic-p (selected-frame))
442 (internal-char-font pos char)
443 (let* ((coding (terminal-coding-system))
444 (encoded (encode-coding-char char coding)))
445 (if encoded
446 (encoded-string-description encoded coding)))))
447
d6c135fb 448\f
4adb7c09
RS
449;;;###autoload
450(defun describe-char (pos)
451 "Describe the character after POS (interactively, the character after point).
452The information includes character code, charset and code points in it,
453syntax, category, how the character is encoded in a file,
454character composition information (if relevant),
455as well as widgets, buttons, overlays, and text properties."
456 (interactive "d")
4adb7c09
RS
457 (if (>= pos (point-max))
458 (error "No character follows specified position"))
459 (let* ((char (char-after pos))
460 (charset (char-charset char))
ca9088e7 461 (composition (find-composition pos nil nil t))
f15078e2
KH
462 (component-chars nil)
463 (display-table (or (window-display-table)
464 buffer-display-table
465 standard-display-table))
466 (disp-vector (and display-table (aref display-table char)))
4adb7c09 467 (multibyte-p enable-multibyte-characters)
6482d093
KH
468 (overlays (mapcar #'(lambda (o) (overlay-properties o))
469 (overlays-at pos)))
831ccfa6 470 item-list max-width unicode)
831ccfa6 471
ed441285
KH
472 (if (or (< char 256)
473 (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
474 (get-char-property pos 'untranslated-utf-8))
475 (setq unicode (or (get-char-property pos 'untranslated-utf-8)
476 (encode-char char 'ucs))))
477 (setq item-list
478 `(("character"
479 ,(format "%s (0%o, %d, 0x%x%s)"
480 (apply 'propertize (if (not multibyte-p)
481 (single-key-description char)
482 (if (< char 128)
483 (single-key-description char)
484 (string-to-multibyte
485 (char-to-string char))))
486 (text-properties-at pos))
487 char char char
488 (if unicode
489 (format ", U+%04X" unicode)
490 "")))
491 ("charset"
492 ,(symbol-name charset)
493 ,(format "(%s)" (charset-description charset)))
494 ("code point"
495 ,(let ((split (split-char char)))
496 (if (= (charset-dimension charset) 1)
497 (format "%d" (nth 1 split))
498 (format "%d %d" (nth 1 split) (nth 2 split)))))
499 ("syntax"
500 ,(let ((syntax (syntax-after pos)))
501 (with-temp-buffer
502 (internal-describe-syntax-value syntax)
503 (buffer-string))))
504 ("category"
505 ,@(let ((category-set (char-category-set char)))
506 (if (not category-set)
507 '("-- none --")
508 (mapcar #'(lambda (x) (format "%c:%s "
509 x (category-docstring x)))
510 (category-set-mnemonics category-set)))))
511 ,@(let ((props (aref char-code-property-table char))
512 ps)
513 (when props
514 (while props
515 (push (format "%s:" (pop props)) ps)
516 (push (format "%s;" (pop props)) ps))
517 (list (cons "Properties" (nreverse ps)))))
309473d0
KH
518 ("to input"
519 ,@(let ((key-list (and current-input-method
520 (quail-find-key char))))
521 (if (consp key-list)
522 (list "type"
523 (mapconcat #'(lambda (x) (concat "\"" x "\""))
524 key-list " or ")))))
ed441285
KH
525 ("buffer code"
526 ,(encoded-string-description
527 (string-as-unibyte (char-to-string char)) nil))
528 ("file code"
529 ,@(let* ((coding buffer-file-coding-system)
530 (encoded (encode-coding-char char coding)))
531 (if encoded
532 (list (encoded-string-description encoded coding)
533 (format "(encoded by coding system %S)" coding))
534 (list "not encodable by coding system"
535 (symbol-name coding)))))
536 ("display"
537 ,(cond
538 (disp-vector
539 (setq disp-vector (copy-sequence disp-vector))
540 (dotimes (i (length disp-vector))
541 (setq char (aref disp-vector i))
542 (aset disp-vector i
543 (cons char (describe-char-display pos char))))
544 (format "by display table entry [%s] (see below)"
545 (mapconcat #'(lambda (x) (format "?%c" (car x)))
546 disp-vector " ")))
547 (composition
548 (let ((from (car composition))
549 (to (nth 1 composition))
550 (next (1+ pos))
551 (components (nth 2 composition))
552 ch)
553 (setcar composition
554 (and (< from pos) (buffer-substring from pos)))
555 (setcar (cdr composition)
556 (and (< next to) (buffer-substring next to)))
557 (dotimes (i (length components))
558 (if (integerp (setq ch (aref components i)))
559 (push (cons ch (describe-char-display pos ch))
560 component-chars)))
561 (setq component-chars (nreverse component-chars))
562 (format "composed to form \"%s\" (see below)"
563 (buffer-substring from to))))
564 (t
565 (let ((display (describe-char-display pos char)))
566 (if (display-graphic-p (selected-frame))
f15078e2 567 (if display
ed441285
KH
568 (concat
569 "by this font (glyph code)\n"
570 (format " %s (0x%02X)"
571 (car display) (cdr display)))
572 "no font available")
573 (if display
574 (format "terminal code %s" display)
575 "not encodable for terminal"))))))
576 ,@(let ((unicodedata (and unicode
577 (describe-char-unicode-data unicode))))
578 (if unicodedata
579 (cons (list "Unicode data" " ") unicodedata)))))
4adb7c09
RS
580 (setq max-width (apply #'max (mapcar #'(lambda (x) (length (car x)))
581 item-list)))
4adb7c09 582 (with-output-to-temp-buffer "*Help*"
ca9088e7 583 (with-current-buffer standard-output
4adb7c09
RS
584 (set-buffer-multibyte multibyte-p)
585 (let ((formatter (format "%%%ds:" max-width)))
586 (dolist (elt item-list)
831ccfa6
DL
587 (when (cadr elt)
588 (insert (format formatter (car elt)))
589 (dolist (clm (cdr elt))
590 (when (>= (+ (current-column)
591 (or (string-match "\n" clm)
592 (string-width clm)) 1)
544cb6b0 593 (window-width))
831ccfa6
DL
594 (insert "\n")
595 (indent-to (1+ max-width)))
596 (insert " " clm))
597 (insert "\n"))))
f15078e2 598
ed441285
KH
599 (save-excursion
600 (goto-char (point-min))
601 (search-forward "character: ")
602 (setq pos (point)))
603 (if overlays
604 (mapc #'(lambda (props)
605 (let ((o (make-overlay pos (1+ pos))))
606 (while props
607 (overlay-put o (car props) (nth 1 props))
608 (setq props (cddr props)))))
609 overlays))
610
f15078e2
KH
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))
544cb6b0 627 (insert (car (aref disp-vector i))
f15078e2
KH
628 (propertize " " 'display '(space :align-to 5))
629 (or (cdr (aref disp-vector i)) "-- not encodable --")
630 "\n"))))
631
4adb7c09 632 (when composition
f15078e2
KH
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"))
4adb7c09 667
6482d093 668 (describe-text-properties pos (current-buffer))
02f32cf0 669 (describe-text-mode)))))
2a1e884e 670
831ccfa6
DL
671(defalias 'describe-char-after 'describe-char)
672(make-obsolete 'describe-char-after 'describe-char "21.5")
673
288395a7
CW
674(provide 'descr-text)
675
ab5796a9 676;;; arch-tag: fc55a498-f3e9-4312-b5bd-98cc02480af1
2a1e884e 677;;; descr-text.el ends here