Mercurial > emacs
annotate lisp/descr-text.el @ 94344:2005e38cd431
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 25 Apr 2008 09:51:03 +0000 |
parents | 587f5f26f25d |
children | ee5932bf781d |
rev | line source |
---|---|
45057 | 1 ;;; descr-text.el --- describe text mode |
45022 | 2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64636
diff
changeset
|
3 ;; Copyright (C) 1994, 1995, 1996, 2001, 2002, 2003, 2004, |
79721 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
45022 | 5 |
6 ;; Author: Boris Goldowsky <boris@gnu.org> | |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
7 ;; Maintainer: FSF |
59752 | 8 ;; Keywords: faces, i18n, Unicode, multilingual |
45022 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75872
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
45022 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64091 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
45022 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;;; Describe-Text Mode. | |
30 | |
31 ;;; Code: | |
32 | |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
33 (eval-when-compile (require 'quail)) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
34 (require 'help-fns) |
51127 | 35 |
45022 | 36 ;;; Describe-Text Utilities. |
37 | |
38 (defun describe-text-widget (widget) | |
39 "Insert text to describe WIDGET in the current buffer." | |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
40 (insert-text-button |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
41 (symbol-name (if (symbolp widget) widget (car widget))) |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
42 'action `(lambda (&rest ignore) |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
43 (widget-browse ',widget)) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
44 'help-echo "mouse-2, RET: browse this widget") |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
45 (insert " ") |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
46 (insert-text-button |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
47 "(widget)Top" 'type 'help-info 'help-args '("(widget)Top"))) |
45022 | 48 |
49 (defun describe-text-sexp (sexp) | |
50 "Insert a short description of SEXP in the current buffer." | |
51 (let ((pp (condition-case signal | |
52 (pp-to-string sexp) | |
53 (error (prin1-to-string signal))))) | |
54 (when (string-match "\n\\'" pp) | |
55 (setq pp (substring pp 0 (1- (length pp))))) | |
56 (if (cond ((string-match "\n" pp) | |
57 nil) | |
58 ((> (length pp) (- (window-width) (current-column))) | |
59 nil) | |
60 (t t)) | |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
61 (insert pp) |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
62 (insert-text-button |
67865
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
63 "[Show]" 'action `(lambda (&rest ignore) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
64 (with-output-to-temp-buffer |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
65 "*Pp Eval Output*" |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
66 (princ ',pp))) |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
67 'help-echo "mouse-2, RET: pretty print value in another buffer")))) |
45022 | 68 |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
69 (defun describe-property-list (properties) |
45022 | 70 "Insert a description of PROPERTIES in the current buffer. |
71 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
|
72 The `category', `face' and `font-lock-face' properties are made |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
73 into help buttons that call `describe-text-category' or |
54686
d74ae0505dad
(describe-property-list): Add `font-lock-face'.
Juri Linkov <juri@jurta.org>
parents:
54545
diff
changeset
|
74 `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
|
75 ;; Sort the properties by the size of their value. |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
76 (dolist (elt (sort (let (ret) |
45697
234b16d90545
(describe-text-properties): Sort the output by the size of the values.
Colin Walters <walters@gnu.org>
parents:
45057
diff
changeset
|
77 (while properties |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
78 (push (list (pop properties) (pop properties)) ret)) |
45697
234b16d90545
(describe-text-properties): Sort the output by the size of the values.
Colin Walters <walters@gnu.org>
parents:
45057
diff
changeset
|
79 ret) |
65376
22f4c45c6f2f
(describe-property-list): Handle non-symbol prop names.
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
80 (lambda (a b) (string< (prin1-to-string (nth 0 a) t) |
22f4c45c6f2f
(describe-property-list): Handle non-symbol prop names.
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
81 (prin1-to-string (nth 0 b) t))))) |
45697
234b16d90545
(describe-text-properties): Sort the output by the size of the values.
Colin Walters <walters@gnu.org>
parents:
45057
diff
changeset
|
82 (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
|
83 (value (nth 1 elt))) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
84 (insert (propertize (format " %-20s " key) |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
85 'face 'help-argument-name)) |
45022 | 86 (cond ((eq key 'category) |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
87 (insert-text-button |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
88 (symbol-name value) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
89 'action `(lambda (&rest ignore) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
90 (describe-text-category ',value)) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
91 'help-echo "mouse-2, RET: describe this category")) |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
92 ((memq key '(face font-lock-face mouse-face)) |
67865
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
93 (insert-text-button |
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
94 (format "%S" value) |
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
95 'type 'help-face 'help-args (list value))) |
55754
da7a694d2097
(describe-property-list): Add [show] button for
Juri Linkov <juri@jurta.org>
parents:
55584
diff
changeset
|
96 ((widgetp value) |
45022 | 97 (describe-text-widget value)) |
98 (t | |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
99 (describe-text-sexp value)))) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
100 (insert "\n"))) |
45022 | 101 |
102 ;;; Describe-Text Commands. | |
103 | |
104 (defun describe-text-category (category) | |
105 "Describe a text property category." | |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
106 (interactive "SCategory: ") |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
107 (help-setup-xref (list #'describe-text-category category) (interactive-p)) |
45022 | 108 (save-excursion |
47601
7d00d911e8b9
(describe-text-category): Use *Help*. Don't kill-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47379
diff
changeset
|
109 (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
|
110 (set-buffer standard-output) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
111 (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
|
112 (describe-property-list (symbol-plist category)) |
45022 | 113 (goto-char (point-min))))) |
114 | |
115 ;;;###autoload | |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
116 (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
|
117 "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
|
118 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
|
119 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
|
120 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
|
121 otherwise." |
45022 | 122 (interactive "d") |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
123 (if (>= pos (point-max)) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
124 (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
|
125 (if output-buffer |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
126 (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
|
127 (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
|
128 (message "This is plain text.") |
57857
6d1cf277e127
(describe-text-properties): Don't err if called in
Kim F. Storm <storm@cua.dk>
parents:
57181
diff
changeset
|
129 (let ((buffer (current-buffer)) |
6d1cf277e127
(describe-text-properties): Don't err if called in
Kim F. Storm <storm@cua.dk>
parents:
57181
diff
changeset
|
130 (target-buffer "*Help*")) |
6d1cf277e127
(describe-text-properties): Don't err if called in
Kim F. Storm <storm@cua.dk>
parents:
57181
diff
changeset
|
131 (when (eq buffer (get-buffer target-buffer)) |
67559
da1c54077c04
(describe-text-properties): Replace buffer name "*Help-2*" with "*Help*<2>".
Juri Linkov <juri@jurta.org>
parents:
67542
diff
changeset
|
132 (setq target-buffer "*Help*<2>")) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
133 (save-excursion |
57857
6d1cf277e127
(describe-text-properties): Don't err if called in
Kim F. Storm <storm@cua.dk>
parents:
57181
diff
changeset
|
134 (with-output-to-temp-buffer target-buffer |
47601
7d00d911e8b9
(describe-text-category): Use *Help*. Don't kill-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47379
diff
changeset
|
135 (set-buffer standard-output) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
136 (setq output-buffer (current-buffer)) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
137 (insert "Text content at position " (format "%d" pos) ":\n\n") |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
138 (with-current-buffer buffer |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
139 (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
|
140 (goto-char (point-min)))))))) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
141 |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
142 (defun describe-text-properties-1 (pos output-buffer) |
45022 | 143 (let* ((properties (text-properties-at pos)) |
144 (overlays (overlays-at pos)) | |
145 (wid-field (get-char-property pos 'field)) | |
146 (wid-button (get-char-property pos 'button)) | |
147 (wid-doc (get-char-property pos 'widget-doc)) | |
148 ;; If button.el is not loaded, we have no buttons in the text. | |
149 (button (and (fboundp 'button-at) (button-at pos))) | |
150 (button-type (and button (button-type button))) | |
151 (button-label (and button (button-label button))) | |
152 (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
|
153 (with-current-buffer output-buffer |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
154 ;; Widgets |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
155 (when (widgetp widget) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
156 (newline) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
157 (insert (cond (wid-field "This is an editable text area") |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
158 (wid-button "This is an active area") |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
159 (wid-doc "This is documentation text"))) |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
160 (insert " of a ") |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
161 (describe-text-widget widget) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
162 (insert ".\n\n")) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
163 ;; Buttons |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
164 (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
|
165 (newline) |
67865
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
166 (insert "Here is a `" (format "%S" button-type) |
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
167 "' button labeled `" button-label "'.\n\n")) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
168 ;; Overlays |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
169 (when overlays |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
170 (newline) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
171 (if (eq (length overlays) 1) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
172 (insert "There is an overlay here:\n") |
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
173 (insert "There are " (format "%d" (length overlays)) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
174 " overlays here:\n")) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
175 (dolist (overlay overlays) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
176 (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
|
177 " 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
|
178 (describe-property-list (overlay-properties overlay))) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
179 (insert "\n")) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
180 ;; Text properties |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
181 (when properties |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
182 (newline) |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
183 (insert "There are text properties here:\n") |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
184 (describe-property-list properties))))) |
51278
7192dc1bfcf4
(describe-char-unicode-data): New dummy definition.
Richard M. Stallman <rms@gnu.org>
parents:
51127
diff
changeset
|
185 |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
186 (defcustom describe-char-unidata-list nil |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
187 "List of Unicode-based character property names shown by `describe-char'." |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
188 :group 'mule |
90104
a01e7a9f1659
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-14
Miles Bader <miles@gnu.org>
parents:
90103
diff
changeset
|
189 :version "23.1" |
93054
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
190 :type '(choice (const :tag "All properties" t) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
191 (set |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
192 (const :tag "Unicode Name" name) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
193 (const :tag "Unicode general category " general-category) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
194 (const :tag "Unicode canonical combining class" |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
195 canonical-combining-class) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
196 (const :tag "Unicode bidi class" bidi-class) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
197 (const :tag "Unicode decomposition mapping" decomposition) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
198 (const :tag "Unicode decimal digit value" decimal-digit-value) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
199 (const :tag "Unicode digit value" digit-value) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
200 (const :tag "Unicode numeric value" numeric-value) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
201 (const :tag "Unicode mirrored" mirrored) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
202 (const :tag "Unicode old name" old-name) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
203 (const :tag "Unicode ISO 10646 comment" iso-10646-comment) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
204 (const :tag "Unicode simple uppercase mapping" uppercase) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
205 (const :tag "Unicode simple lowercase mapping" lowercase) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
206 (const :tag "Unicode simple titlecase mapping" titlecase)))) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
207 |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
208 (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
|
209 "Location of Unicode data file. |
74356
25c9571827a2
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
210 This is the UnicodeData.txt file from the Unicode Consortium, used for |
59758
b8352a1f354a
(describe-char-unicodedata-file): Docstring fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59752
diff
changeset
|
211 diagnostics. If it is non-nil `describe-char' will print data |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
212 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
|
213 multilingual development. |
51127 | 214 |
74356
25c9571827a2
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
215 This is a fairly large file, not typically present on GNU systems. |
25c9571827a2
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
216 At the time of writing it is at the URL |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
217 `http://www.unicode.org/Public/UNIDATA/UnicodeData.txt'." |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
218 :group 'mule |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59758
diff
changeset
|
219 :version "22.1" |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
220 :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
|
221 file)) |
51278
7192dc1bfcf4
(describe-char-unicode-data): New dummy definition.
Richard M. Stallman <rms@gnu.org>
parents:
51127
diff
changeset
|
222 |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
223 (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
|
224 "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
|
225 Each element is a list of a property description and the property value. |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
226 The list is null if CHAR isn't found in `describe-char-unicodedata-file'. |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
227 This function is semi-obsolete. Use `get-char-code-property'." |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
228 (when describe-char-unicodedata-file |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
229 (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
|
230 (error "`unicodedata-file' %s not found" describe-char-unicodedata-file)) |
74403
04f1edde004d
(describe-char-unicode-data): Use a hidden buffer for Unicode data file pointed
Juanma Barranquero <lekktu@gmail.com>
parents:
74356
diff
changeset
|
231 (with-current-buffer (get-buffer-create " *Unicode Data*") |
04f1edde004d
(describe-char-unicode-data): Use a hidden buffer for Unicode data file pointed
Juanma Barranquero <lekktu@gmail.com>
parents:
74356
diff
changeset
|
232 (when (zerop (buffer-size)) |
04f1edde004d
(describe-char-unicode-data): Use a hidden buffer for Unicode data file pointed
Juanma Barranquero <lekktu@gmail.com>
parents:
74356
diff
changeset
|
233 ;; Don't use -literally in case of DOS line endings. |
04f1edde004d
(describe-char-unicode-data): Use a hidden buffer for Unicode data file pointed
Juanma Barranquero <lekktu@gmail.com>
parents:
74356
diff
changeset
|
234 (insert-file-contents describe-char-unicodedata-file)) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
235 (goto-char (point-min)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
236 (let ((hex (format "%04X" char)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
237 found first last) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
238 (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
|
239 (setq found t) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
240 ;; 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
|
241 ;; 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
|
242 (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
|
243 (>= char (setq first |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
244 (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
|
245 (progn |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
246 (forward-line 1) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
247 (looking-at "^\\([^;]+\\);[^;]+Last>;") |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
248 (> char |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
249 (setq last |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
250 (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
|
251 (if (and (>= char first) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
252 (<= char last)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
253 (setq found t))) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
254 (if found |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
255 (let ((fields (mapcar (lambda (elt) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
256 (if (> (length elt) 0) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
257 elt)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
258 (cdr (split-string |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
259 (buffer-substring |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
260 (line-beginning-position) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
261 (line-end-position)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
262 ";"))))) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
263 ;; 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
|
264 (unless (or (= 13 (length fields)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
265 (= 14 (length fields))) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
266 (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
|
267 ;; 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
|
268 ;; 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
|
269 (list |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
270 (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
|
271 ;; Check for <..., First>, <..., Last> |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
272 (if (string-match "\\`\\(<[^,]+\\)," name) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
273 (concat (match-string 1 name) ">") |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
274 name))) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
275 (list "Category" |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
276 (let ((val (nth 1 fields))) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
277 (or (char-code-property-description |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
278 'general-category (intern val)) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
279 val))) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
280 (list "Combining class" |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
281 (let ((val (nth 1 fields))) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
282 (or (char-code-property-description |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
283 'canonical-combining-class (intern val)) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
284 val))) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
285 (list "Bidi category" |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
286 (let ((val (nth 1 fields))) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
287 (or (char-code-property-description |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
288 'bidi-class (intern val)) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
289 val))) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
290 (list |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
291 "Decomposition" |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
292 (if (nth 4 fields) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
293 (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
|
294 (info (car parts))) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
295 (if (string-match "\\`<\\(.+\\)>\\'" info) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
296 (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
|
297 (setq info nil)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
298 (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
|
299 (setq parts (mapconcat |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
300 (lambda (arg) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
301 (string (string-to-number arg 16))) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
302 parts " ")) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
303 (concat info parts)))) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
304 (list "Decimal digit value" |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
305 (nth 5 fields)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
306 (list "Digit value" |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
307 (nth 6 fields)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
308 (list "Numeric value" |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
309 (nth 7 fields)) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
310 (list "Mirrored" |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
311 (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
|
312 "yes")) |
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
313 (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
|
314 (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
|
315 (list "Uppercase" (and (nth 11 fields) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
316 (string (string-to-number |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
317 (nth 11 fields) 16)))) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
318 (list "Lowercase" (and (nth 12 fields) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
319 (string (string-to-number |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
320 (nth 12 fields) 16)))) |
55584
bdbbd721cc67
(describe-char-unicode-data, describe-char-unicodedata-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55543
diff
changeset
|
321 (list "Titlecase" (and (nth 13 fields) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
322 (string (string-to-number |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
323 (nth 13 fields) 16))))))))))) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
324 |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
325 ;; 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
|
326 ;; position POS. If the selected frame is on a graphic display, |
91328
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
327 ;; return a cons (FONTNAME . GLYPH-CODE) where GLYPH-CODE is a |
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
328 ;; hexadigit string representing the glyph-ID. Otherwise, return a |
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
329 ;; string describing the terminal codes for the character. |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
330 (defun describe-char-display (pos char) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
331 (if (display-graphic-p (selected-frame)) |
91328
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
332 (let ((char-font-info (internal-char-font pos char))) |
91335
07ce8496076f
(describe-char-display): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
91328
diff
changeset
|
333 (if char-font-info |
07ce8496076f
(describe-char-display): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
91328
diff
changeset
|
334 (if (integerp (cdr char-font-info)) |
07ce8496076f
(describe-char-display): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
91328
diff
changeset
|
335 (setcdr char-font-info (format "%02X" (cdr char-font-info))) |
07ce8496076f
(describe-char-display): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
91328
diff
changeset
|
336 (setcdr char-font-info |
07ce8496076f
(describe-char-display): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
91328
diff
changeset
|
337 (format "%04X%04X" |
07ce8496076f
(describe-char-display): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
91328
diff
changeset
|
338 (cadr char-font-info) (cddr char-font-info))))) |
91328
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
339 char-font-info) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
340 (let* ((coding (terminal-coding-system)) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
341 (encoded (encode-coding-char char coding))) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
342 (if encoded |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
343 (encoded-string-description encoded coding))))) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
344 |
51278
7192dc1bfcf4
(describe-char-unicode-data): New dummy definition.
Richard M. Stallman <rms@gnu.org>
parents:
51127
diff
changeset
|
345 |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
346 ;;;###autoload |
67855
d6290d5c2df4
(describe-char): Set help-xref-stack-item
Nick Roberts <nickrob@snap.net.nz>
parents:
67815
diff
changeset
|
347 (defun describe-char (pos) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
348 "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
|
349 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
|
350 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
|
351 character composition information (if relevant), |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
352 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
|
353 (interactive "d") |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
354 (if (>= pos (point-max)) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
355 (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
|
356 (let* ((char (char-after pos)) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
357 (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
|
358 (composition (find-composition pos nil nil t)) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
359 (component-chars nil) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
360 (display-table (or (window-display-table) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
361 buffer-display-table |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
362 standard-display-table)) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
363 (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
|
364 (multibyte-p enable-multibyte-characters) |
55305
b1c52f4076c4
(describe-char): Copy the character with text
Kenichi Handa <handa@m17n.org>
parents:
55036
diff
changeset
|
365 (overlays (mapcar #'(lambda (o) (overlay-properties o)) |
b1c52f4076c4
(describe-char): Copy the character with text
Kenichi Handa <handa@m17n.org>
parents:
55036
diff
changeset
|
366 (overlays-at pos))) |
67050
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
367 (char-description (if (not multibyte-p) |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
368 (single-key-description char) |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
369 (if (< char 128) |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
370 (single-key-description char) |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
371 (string-to-multibyte |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
372 (char-to-string char))))) |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
373 (text-props-desc |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
374 (let ((tmp-buf (generate-new-buffer " *text-props*"))) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
375 (unwind-protect |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
376 (progn |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
377 (describe-text-properties pos tmp-buf) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
378 (with-current-buffer tmp-buf (buffer-string))) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
379 (kill-buffer tmp-buf)))) |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
380 item-list max-width code) |
51127 | 381 |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
382 (setq code (encode-char char charset)) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
383 (setq item-list |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
384 `(("character" |
90261
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
385 ,(format "%s (%d, #o%o, #x%x)" |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
386 (apply 'propertize char-description |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
387 (text-properties-at pos)) |
90261
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
388 char char char)) |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
389 ("preferred charset" |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
390 ,`(insert-text-button |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
391 ,(symbol-name charset) |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
392 'type 'help-character-set 'help-args '(,charset)) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
393 ,(format "(%s)" (charset-description charset))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
394 ("code point" |
90215
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
395 ,(let ((str (if (integerp code) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
396 (format (if (< code 256) "0x%02X" "0x%04X") code) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
397 (format "0x%04X%04X" (car code) (cdr code))))) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
398 (if (<= (charset-dimension charset) 2) |
90261
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
399 `(insert-text-button |
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
400 ,str |
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
401 'action (lambda (&rest ignore) |
90215
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
402 (list-charset-chars ',charset) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
403 (with-selected-window |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
404 (get-buffer-window "*Character List*" 0) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
405 (goto-char (point-min)) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
406 (forward-line 2) ;Skip the header. |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
407 (let ((case-fold-search nil)) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
408 (if (search-forward ,(char-to-string char) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
409 nil t) |
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
410 (goto-char (match-beginning 0)))))) |
90261
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
411 'help-echo |
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
412 "mouse-2, RET: show this character in its character set") |
90215
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
413 str))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
414 ("syntax" |
58416
28906724d6e3
(syntax-after): Undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58150
diff
changeset
|
415 ,(let ((syntax (syntax-after pos))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
416 (with-temp-buffer |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
417 (internal-describe-syntax-value syntax) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
418 (buffer-string)))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
419 ("category" |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
420 ,@(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
|
421 (if (not category-set) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
422 '("-- none --") |
67035
0f0c4f1205cd
(describe-char): Use Lisp-readable syntax for octal and hex.
Juri Linkov <juri@jurta.org>
parents:
65376
diff
changeset
|
423 (mapcar #'(lambda (x) (format "%c:%s" |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
424 x (category-docstring x))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
425 (category-set-mnemonics category-set))))) |
55543
7b6cb8aae6f3
Require quail at comile time.
Kenichi Handa <handa@m17n.org>
parents:
55491
diff
changeset
|
426 ("to input" |
57181
8818a855274d
(describe-char): Checking of quail activation
Kenichi Handa <handa@m17n.org>
parents:
55754
diff
changeset
|
427 ,@(let ((key-list (and (eq input-method-function |
8818a855274d
(describe-char): Checking of quail activation
Kenichi Handa <handa@m17n.org>
parents:
55754
diff
changeset
|
428 'quail-input-method) |
55543
7b6cb8aae6f3
Require quail at comile time.
Kenichi Handa <handa@m17n.org>
parents:
55491
diff
changeset
|
429 (quail-find-key char)))) |
7b6cb8aae6f3
Require quail at comile time.
Kenichi Handa <handa@m17n.org>
parents:
55491
diff
changeset
|
430 (if (consp key-list) |
7b6cb8aae6f3
Require quail at comile time.
Kenichi Handa <handa@m17n.org>
parents:
55491
diff
changeset
|
431 (list "type" |
7b6cb8aae6f3
Require quail at comile time.
Kenichi Handa <handa@m17n.org>
parents:
55491
diff
changeset
|
432 (mapconcat #'(lambda (x) (concat "\"" x "\"")) |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
433 key-list " or ") |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
434 "with" |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
435 `(insert-text-button |
67865
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
436 ,current-input-method |
67814
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
437 'type 'help-input-method |
cc79e7966f97
2005-12-27 Nick Roberts <nickrob@snap.net.nz>
Nick Roberts <nickrob@snap.net.nz>
parents:
67752
diff
changeset
|
438 'help-args '(,current-input-method)))))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
439 ("buffer code" |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
440 ,(encoded-string-description |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
441 (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
|
442 ("file code" |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
443 ,@(let* ((coding buffer-file-coding-system) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
444 (encoded (encode-coding-char char coding))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
445 (if encoded |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
446 (list (encoded-string-description encoded coding) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
447 (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
|
448 (list "not encodable by coding system" |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
449 (symbol-name coding))))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
450 ("display" |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
451 ,(cond |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
452 (disp-vector |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
453 (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
|
454 (dotimes (i (length disp-vector)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
455 (setq char (aref disp-vector i)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
456 (aset disp-vector i |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
457 (cons char (describe-char-display |
75872
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
458 pos (glyph-char char))))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
459 (format "by display table entry [%s] (see below)" |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
460 (mapconcat |
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
461 #'(lambda (x) |
75872
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
462 (format "?%c" (glyph-char (car x)))) |
58994
720c9b9bf376
(describe-property-list): Don't treat syntax-table
Juri Linkov <juri@jurta.org>
parents:
58416
diff
changeset
|
463 disp-vector " "))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
464 (composition |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
465 (let ((from (car composition)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
466 (to (nth 1 composition)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
467 (next (1+ pos)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
468 (components (nth 2 composition)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
469 ch) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
470 (setcar composition |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
471 (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
|
472 (setcar (cdr composition) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
473 (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
|
474 (dotimes (i (length components)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
475 (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
|
476 (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
|
477 component-chars))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
478 (setq component-chars (nreverse component-chars)) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
479 (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
|
480 (buffer-substring from to)))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
481 (t |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
482 (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
|
483 (if (display-graphic-p (selected-frame)) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
484 (if display |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
485 (concat |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
486 "by this font (glyph code)\n" |
91328
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
487 (format " %s (#x%s)" |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
488 (car display) (cdr display))) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
489 "no font available") |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
490 (if display |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
491 (format "terminal code %s" display) |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
492 "not encodable for terminal")))))) |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
493 ,@(let ((face |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
494 (if (not (or disp-vector composition)) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
495 (cond |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
496 ((and show-trailing-whitespace |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
497 (save-excursion (goto-char pos) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
498 (looking-at "[ \t]+$"))) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
499 'trailing-whitespace) |
90215
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
500 ((and nobreak-char-display char (eq char '#xa0)) |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
501 'nobreak-space) |
90215
7217d5a385f8
(describe-char): Sync with the main trunk.
Kenichi Handa <handa@m17n.org>
parents:
90203
diff
changeset
|
502 ((and nobreak-char-display char (eq char '#xad)) |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
503 'escape-glyph) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
504 ((and (< char 32) (not (memq char '(9 10)))) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
505 'escape-glyph))))) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
506 (if face (list (list "hardcoded face" |
67865
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
507 `(insert-text-button |
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
508 ,(symbol-name face) |
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
509 'type 'help-face 'help-args '(,face)))))) |
90275
50eb9e2ff05f
(describe-char): Fix for sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90261
diff
changeset
|
510 ,@(let ((unicodedata (describe-char-unicode-data char))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
511 (if unicodedata |
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
512 (cons (list "Unicode data" " ") unicodedata))))) |
93058
273ed23a0a68
(describe-char): When specifying all properties,
Juanma Barranquero <lekktu@gmail.com>
parents:
93054
diff
changeset
|
513 (setq max-width (apply #'max (mapcar #'(lambda (x) |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
514 (if (cadr x) (length (car x)) 0)) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
515 item-list))) |
67855
d6290d5c2df4
(describe-char): Set help-xref-stack-item
Nick Roberts <nickrob@snap.net.nz>
parents:
67815
diff
changeset
|
516 (help-setup-xref nil (interactive-p)) |
86008
054e548612aa
(describe-char): Use with-help-window instead of with-output-to-temp-buffer.
Martin Rudalics <rudalics@gmx.at>
parents:
78236
diff
changeset
|
517 (with-help-window (help-buffer) |
47601
7d00d911e8b9
(describe-text-category): Use *Help*. Don't kill-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47379
diff
changeset
|
518 (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
|
519 (set-buffer-multibyte multibyte-p) |
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
520 (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
|
521 (dolist (elt item-list) |
51127 | 522 (when (cadr elt) |
523 (insert (format formatter (car elt))) | |
524 (dolist (clm (cdr elt)) | |
67752
dd459879f1e7
Add FSF as maintainer.
Nick Roberts <nickrob@snap.net.nz>
parents:
67559
diff
changeset
|
525 (if (eq (car-safe clm) 'insert-text-button) |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
526 (progn (insert " ") (eval clm)) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
527 (when (>= (+ (current-column) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
528 (or (string-match "\n" clm) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
529 (string-width clm)) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
530 1) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
531 (window-width)) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
532 (insert "\n") |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
533 (indent-to (1+ max-width))) |
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
534 (insert " " clm))) |
51127 | 535 (insert "\n")))) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
536 |
67371
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
537 (when overlays |
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
538 (save-excursion |
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
539 (goto-char (point-min)) |
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
540 (re-search-forward "character:[ \t\n]+") |
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
541 (let* ((end (+ (point) (length char-description)))) |
67050
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
542 (mapc #'(lambda (props) |
67371
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
543 (let ((o (make-overlay (point) end))) |
67050
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
544 (while props |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
545 (overlay-put o (car props) (nth 1 props)) |
c365e04ea266
(describe-char): When copying overlays put them
Andreas Schwab <schwab@suse.de>
parents:
67035
diff
changeset
|
546 (setq props (cddr props))))) |
67371
0df745d01551
(describe-char): Use *Help-2* buffer if the
Kenichi Handa <handa@m17n.org>
parents:
67050
diff
changeset
|
547 overlays)))) |
55491
79abf8a72f5a
(describe-char): Fix previous change. Don't make
Kenichi Handa <handa@m17n.org>
parents:
55305
diff
changeset
|
548 |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
549 (when disp-vector |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
550 (insert |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
551 "\nThe display table entry is displayed by ") |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
552 (if (display-graphic-p (selected-frame)) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
553 (progn |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
554 (insert "these fonts (glyph codes):\n") |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
555 (dotimes (i (length disp-vector)) |
75872
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
556 (insert (glyph-char (car (aref disp-vector i))) ?: |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
557 (propertize " " 'display '(space :align-to 5)) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
558 (if (cdr (aref disp-vector i)) |
91328
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
559 (format "%s (#x%s)" (cadr (aref disp-vector i)) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
560 (cddr (aref disp-vector i))) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
561 "-- no font --") |
64495
524cffc1c27d
(describe-char): Create link buttons for `charset'
Juri Linkov <juri@jurta.org>
parents:
64091
diff
changeset
|
562 "\n") |
75872
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
563 (let ((face (glyph-face (car (aref disp-vector i))))) |
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
564 (when face |
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
565 (insert (propertize " " 'display '(space :align-to 5)) |
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
566 "face: ") |
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
567 (insert (concat "`" (symbol-name face) "'")) |
a527b46e9ab2
(describe-char): Use glyph-char and glyph-face.
Kim F. Storm <storm@cua.dk>
parents:
75347
diff
changeset
|
568 (insert "\n"))))) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
569 (insert "these terminal codes:\n") |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
570 (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
|
571 (insert (car (aref disp-vector i)) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
572 (propertize " " 'display '(space :align-to 5)) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
573 (or (cdr (aref disp-vector i)) "-- not encodable --") |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
574 "\n")))) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
575 |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
576 (when composition |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
577 (insert "\nComposed") |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
578 (if (car composition) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
579 (if (cadr composition) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
580 (insert " with the surrounding characters \"" |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
581 (car composition) "\" and \"" |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
582 (cadr composition) "\"") |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
583 (insert " with the preceding character(s) \"" |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
584 (car composition) "\"")) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
585 (if (cadr composition) |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
586 (insert " with the following character(s) \"" |
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
587 (cadr composition) "\""))) |
91180
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
588 (if (and (vectorp (nth 2 composition)) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
589 (vectorp (aref (nth 2 composition) 0))) |
52655
8d4e6d1d7201
(describe-char-display): New function.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
590 (progn |
91216
79d9f396e42f
(describe-char): Improve the previous change (show
Kenichi Handa <handa@m17n.org>
parents:
91180
diff
changeset
|
591 (insert " using this font:\n " |
79d9f396e42f
(describe-char): Improve the previous change (show
Kenichi Handa <handa@m17n.org>
parents:
91180
diff
changeset
|
592 (aref (query-font (aref (aref (nth 2 composition) 0) 0)) |
79d9f396e42f
(describe-char): Improve the previous change (show
Kenichi Handa <handa@m17n.org>
parents:
91180
diff
changeset
|
593 0) |
79d9f396e42f
(describe-char): Improve the previous change (show
Kenichi Handa <handa@m17n.org>
parents:
91180
diff
changeset
|
594 "\nby these glyphs:\n") |
91180
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
595 (mapc (lambda (x) (insert (format " %S\n" x))) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
596 (nth 2 composition))) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
597 (insert " by the rule:\n\t(" |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
598 (mapconcat (lambda (x) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
599 (if (consp x) (format "%S" x) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
600 (if (= x ?\t) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
601 (single-key-description x) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
602 (string ?? x)))) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
603 (nth 2 composition) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
604 " ") |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
605 ")") |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
606 (insert "\nThe component character(s) are displayed by ") |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
607 (if (display-graphic-p (selected-frame)) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
608 (progn |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
609 (insert "these fonts (glyph codes):") |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
610 (dolist (elt component-chars) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
611 (if (/= (car elt) ?\t) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
612 (insert "\n " (car elt) ?: |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
613 (propertize " " 'display '(space :align-to 5)) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
614 (if (cdr elt) |
91328
f64f6ef4cdfe
(describe-char-display): Convert a GLYPH-CODE to a
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
615 (format "%s (#x%s)" (cadr elt) (cddr elt)) |
91180
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
616 "-- no font --"))))) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
617 (insert "these terminal codes:") |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
618 (dolist (elt component-chars) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
619 (insert "\n " (car elt) ":" |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
620 (propertize " " 'display '(space :align-to 4)) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
621 (or (cdr elt) "-- not encodable --")))) |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
622 (insert "\nSee the variable `reference-point-alist' for " |
583ca8a88936
(describe-char): Handle a composition of the new
Kenichi Handa <handa@m17n.org>
parents:
91085
diff
changeset
|
623 "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
|
624 |
93054
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
625 (insert (if (not describe-char-unidata-list) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
626 "\nCharacter code properties are not shown: " |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
627 "\nCharacter code properties: ")) |
90284
f12f7e75abbe
(describe-char): Use insert-text-button instead of
Kenichi Handa <handa@m17n.org>
parents:
90275
diff
changeset
|
628 (insert-text-button |
f12f7e75abbe
(describe-char): Use insert-text-button instead of
Kenichi Handa <handa@m17n.org>
parents:
90275
diff
changeset
|
629 "customize what to show" |
f12f7e75abbe
(describe-char): Use insert-text-button instead of
Kenichi Handa <handa@m17n.org>
parents:
90275
diff
changeset
|
630 'action (lambda (&rest ignore) |
f12f7e75abbe
(describe-char): Use insert-text-button instead of
Kenichi Handa <handa@m17n.org>
parents:
90275
diff
changeset
|
631 (customize-variable |
f12f7e75abbe
(describe-char): Use insert-text-button instead of
Kenichi Handa <handa@m17n.org>
parents:
90275
diff
changeset
|
632 'describe-char-unidata-list))) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
633 (insert "\n") |
93054
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
634 (dolist (elt (if (eq describe-char-unidata-list t) |
93058
273ed23a0a68
(describe-char): When specifying all properties,
Juanma Barranquero <lekktu@gmail.com>
parents:
93054
diff
changeset
|
635 (nreverse (mapcar 'car char-code-property-alist)) |
93054
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
636 describe-char-unidata-list)) |
90087
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
637 (let ((val (get-char-code-property char elt)) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
638 description) |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
639 (when val |
230281e520b3
(describe-char-unidata-list): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90085
diff
changeset
|
640 (setq description (char-code-property-description elt val)) |
93054
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
641 (insert (if description |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
642 (format " %s: %s (%s)\n" elt val description) |
ca8b9e092766
(describe-char-unidata-list): Allow specifying just all properties.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91335
diff
changeset
|
643 (format " %s: %s\n" elt val)))))) |
45868
97041c98624e
(describe-char): Moved from mule-diag.el, renamed
Richard M. Stallman <rms@gnu.org>
parents:
45700
diff
changeset
|
644 |
67542
c6a040f6797b
(describe-char): Rework last fix to solve the problem
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67371
diff
changeset
|
645 (if text-props-desc (insert text-props-desc)) |
67865
f94acc1b8bc2
(describe-text-sexp): Use square brackets for
Juri Linkov <juri@jurta.org>
parents:
67855
diff
changeset
|
646 (setq help-xref-stack-item (list 'help-insert-string (buffer-string))) |
86008
054e548612aa
(describe-char): Use with-help-window instead of with-output-to-temp-buffer.
Martin Rudalics <rudalics@gmx.at>
parents:
78236
diff
changeset
|
647 (toggle-read-only 1))))) |
45022 | 648 |
94147
587f5f26f25d
(describe-char-after): Use `define-obsolete-function-alias'.
Juanma Barranquero <lekktu@gmail.com>
parents:
93058
diff
changeset
|
649 (define-obsolete-function-alias 'describe-char-after 'describe-char "22.1") |
51127 | 650 |
45700
a54155344566
(toplevel): Provide `descr-text'.
Colin Walters <walters@gnu.org>
parents:
45697
diff
changeset
|
651 (provide 'descr-text) |
a54155344566
(toplevel): Provide `descr-text'.
Colin Walters <walters@gnu.org>
parents:
45697
diff
changeset
|
652 |
58416
28906724d6e3
(syntax-after): Undo last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58150
diff
changeset
|
653 ;; arch-tag: fc55a498-f3e9-4312-b5bd-98cc02480af1 |
45022 | 654 ;;; descr-text.el ends here |