annotate lisp/descr-text.el @ 55305:b1c52f4076c4

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