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