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