Mercurial > emacs
annotate lisp/international/mule-diag.el @ 89638:1a8a006eeb76
(make-coding-system): Fix generation of properties.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 22 Nov 2003 07:46:20 +0000 |
parents | bc83bb07e632 |
children | dd442ee53657 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36989
diff
changeset
|
1 ;;; mule-diag.el --- show diagnosis of multilingual environment (Mule) |
17052 | 2 |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
89483 | 4 ;; Licensed to the Free Software Foundation. |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
5 ;; Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
89483 | 6 ;; Copyright (C) 2003 |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
7 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
8 ;; Registration Number H13PRO009 |
17052 | 9 |
27953 | 10 ;; Keywords: multilingual, charset, coding system, fontset, diagnosis, i18n |
17052 | 11 |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
16 ;; the Free Software Foundation; either version 2, or (at your option) | |
17 ;; any later version. | |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
17071 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
27 ;; Boston, MA 02111-1307, USA. | |
17052 | 28 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36989
diff
changeset
|
29 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36989
diff
changeset
|
30 |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36989
diff
changeset
|
31 ;;; Code: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36989
diff
changeset
|
32 |
40722
1b9616706fd5
(help-funs): Require help-funs.
Richard M. Stallman <rms@gnu.org>
parents:
40664
diff
changeset
|
33 ;; Make sure the help-xref button type is defined. |
41586
f41a14872734
Require help-fns instead of help-funs.
Eli Zaretskii <eliz@gnu.org>
parents:
40722
diff
changeset
|
34 (require 'help-fns) |
40722
1b9616706fd5
(help-funs): Require help-funs.
Richard M. Stallman <rms@gnu.org>
parents:
40664
diff
changeset
|
35 |
17052 | 36 ;;; General utility function |
37 | |
38 (defun print-list (&rest args) | |
88534 | 39 "Print all arguments with single space separator in one line." |
17052 | 40 (while (cdr args) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
41 (when (car args) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
42 (princ (car args)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
43 (princ " ")) |
17052 | 44 (setq args (cdr args))) |
45 (princ (car args)) | |
46 (princ "\n")) | |
47 | |
48 ;;; CHARSET | |
49 | |
40639 | 50 (define-button-type 'sort-listed-character-sets |
51 'help-echo (purecopy "mouse-2, RET: sort on this column") | |
52 'face 'bold | |
53 'action #'(lambda (button) | |
54 (sort-listed-character-sets (button-get button 'sort-key)))) | |
55 | |
56 (define-button-type 'list-charset-chars | |
57 :supertype 'help-xref | |
58 'help-function #'list-charset-chars | |
59 'help-echo "mouse-2, RET: show table of characters for this character set") | |
60 | |
17052 | 61 ;;;###autoload |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
62 (defun list-character-sets (arg) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
63 "Display a list of all character sets. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
64 |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
65 The D column contains the dimension of this character set. The CH |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
66 column contains the number of characters in a block of this character |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
67 set. The FINAL-CHAR column contains an ISO-2022 <final-char> to use |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
68 for designating this character set in ISO-2022-based coding systems. |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
69 |
22306 | 70 With prefix arg, the output format gets more cryptic, |
71 but still shows the full information." | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
72 (interactive "P") |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
73 (help-setup-xref (list #'list-character-sets arg) (interactive-p)) |
47603
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
74 (with-output-to-temp-buffer "*Character Set List*" |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
75 (with-current-buffer standard-output |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
76 (if arg |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
77 (list-character-sets-2) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
78 ;; Insert header. |
47605
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
79 (insert "Indirectly supported character sets are shown below.\n") |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
80 (insert |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
81 (substitute-command-keys |
27973
cf535f97695d
(list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents:
27953
diff
changeset
|
82 (concat "Use " |
cf535f97695d
(list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents:
27953
diff
changeset
|
83 (if (display-mouse-p) "\\[help-follow-mouse] or ") |
cf535f97695d
(list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents:
27953
diff
changeset
|
84 "\\[help-follow]:\n"))) |
cf535f97695d
(list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents:
27953
diff
changeset
|
85 (insert " on a column title to sort by that title,") |
88534 | 86 (indent-to 48) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
87 (insert "+----DIMENSION\n") |
27973
cf535f97695d
(list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents:
27953
diff
changeset
|
88 (insert " on a charset name to list characters.") |
88534 | 89 (indent-to 48) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
90 (insert "| +--CHARS\n") |
88534 | 91 (let ((columns '(("CHARSET-NAME" . name) "\t\t\t\t\t" |
92 ("D CH FINAL-CHAR" . iso-spec))) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
93 pos) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
94 (while columns |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
95 (if (stringp (car columns)) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
96 (insert (car columns)) |
40639 | 97 (insert-text-button (car (car columns)) |
98 :type 'sort-listed-character-sets | |
99 'sort-key (cdr (car columns))) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
100 (goto-char (point-max))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
101 (setq columns (cdr columns))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
102 (insert "\n")) |
88534 | 103 (insert "------------\t\t\t\t\t- --- ----------\n") |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
104 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
105 ;; Insert body sorted by charset IDs. |
88534 | 106 (list-character-sets-1 'name))))) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
107 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
108 (defun sort-listed-character-sets (sort-key) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
109 (if sort-key |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
110 (save-excursion |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
111 (help-setup-xref (list #'list-character-sets nil) t) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
112 (let ((buffer-read-only nil)) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
113 (goto-char (point-min)) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
114 (re-search-forward "[0-9][0-9][0-9]") |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
115 (beginning-of-line) |
47605
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
116 (let ((pos (point))) |
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
117 (search-forward "----------") |
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
118 (beginning-of-line) |
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
119 (save-restriction |
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
120 (narrow-to-region pos (point)) |
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
121 (delete-region (point-min) (point-max)) |
22df356e38df
(list-character-sets): List also indirectly supported character sets.
Kenichi Handa <handa@m17n.org>
parents:
47603
diff
changeset
|
122 (list-character-sets-1 sort-key))))))) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
123 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
124 (defun list-character-sets-1 (sort-key) |
88534 | 125 "Insert a list of character sets sorted by SORT-KEY. |
126 SORT-KEY should be `name' or `iso-spec' (default `name')." | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
127 (or sort-key |
88534 | 128 (setq sort-key 'name)) |
129 (let ((tail charset-list) | |
130 charset-info-list charset sort-func) | |
131 (dolist (charset charset-list) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
132 ;; Generate a list that contains all information to display. |
88534 | 133 (push (list charset |
134 (charset-dimension charset) | |
135 (charset-chars charset) | |
136 (charset-iso-final-char charset)) | |
137 charset-info-list)) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
138 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
139 ;; Determine a predicate for `sort' by SORT-KEY. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
140 (setq sort-func |
88534 | 141 (cond ((eq sort-key 'name) |
142 (lambda (x y) (string< (car x) (car y)))) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
143 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
144 ((eq sort-key 'iso-spec) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
145 ;; Sort by DIMENSION CHARS FINAL-CHAR |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
146 (function |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
147 (lambda (x y) |
88534 | 148 (or (< (nth 1 x) (nth 1 y)) |
149 (and (= (nth 1 x) (nth 1 y)) | |
150 (or (< (nth 2 x) (nth 2 y)) | |
151 (and (= (nth 2 x) (nth 2 y)) | |
152 (< (nth 3 x) (nth 3 y))))))))) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
153 (t |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
154 (error "Invalid charset sort key: %s" sort-key)))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
155 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
156 (setq charset-info-list (sort charset-info-list sort-func)) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
157 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
158 ;; Insert information of character sets. |
88537
4668340a1e0d
(list-character-sets-1): Fix last change.
Dave Love <fx@gnu.org>
parents:
88534
diff
changeset
|
159 (dolist (elt charset-info-list) |
88534 | 160 (insert-text-button (symbol-name (car elt)) |
40639 | 161 :type 'list-charset-chars |
88534 | 162 'help-args (list (car elt))) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
163 (goto-char (point-max)) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
164 (insert "\t") |
88534 | 165 (indent-to 48) |
166 (insert (format "%d %3d " (nth 1 elt) (nth 2 elt)) ; DIMENSION and CHARS | |
167 (if (< (nth 3 elt) 0) | |
168 "none" | |
169 (nth 3 elt))) ; FINAL-CHAR | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
170 (insert "\n")))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
171 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
172 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
173 ;; List all character sets in a form that a program can easily parse. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
174 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
175 (defun list-character-sets-2 () |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
176 (insert "######################### |
17052 | 177 ## LIST OF CHARSETS |
178 ## Each line corresponds to one charset. | |
179 ## The following attributes are listed in this order | |
180 ## separated by a colon `:' in one line. | |
181 ## CHARSET-SYMBOL-NAME, | |
182 ## DIMENSION (1 or 2) | |
183 ## CHARS (94 or 96) | |
184 ## WIDTH (occupied column numbers: 1 or 2), | |
185 ## DIRECTION (0:left-to-right, 1:right-to-left), | |
186 ## ISO-FINAL-CHAR (character code of ISO-2022's final character) | |
187 ## ISO-GRAPHIC-PLANE (ISO-2022's graphic plane, 0:GL, 1:GR) | |
188 ## DESCRIPTION (describing string of the charset) | |
189 ") | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
190 (let ((l charset-list) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
191 charset) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
192 (while l |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
193 (setq charset (car l) l (cdr l)) |
88534 | 194 (princ (format "%s:%d:%d:%d:%d:%s\n" |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
195 charset |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
196 (charset-dimension charset) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
197 (charset-chars charset) |
88534 | 198 (aref char-width-table (make-char charset)) |
199 ;;; (charset-direction charset) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
200 (charset-iso-final-char charset) |
88534 | 201 ;;; (charset-iso-graphic-plane charset) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
202 (charset-description charset)))))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
203 |
88534 | 204 (defvar non-iso-charset-alist nil |
205 "Obsolete.") | |
206 (make-obsolete-variable 'non-iso-charset-alist "no longer relevant" "22.1") | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
207 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
208 (defun decode-codepage-char (codepage code) |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
209 "Decode a character that has code CODE in CODEPAGE. |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
210 Return a decoded character string. Each CODEPAGE corresponds to a |
88534 | 211 coding system cpCODEPAGE. This function is obsolete." |
212 (decode-char (intern (format "cp%d" codepage)) code)) | |
213 (make-obsolete 'decode-codepage-char 'decode-char "22.1") | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
214 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
215 ;; A variable to hold charset input history. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
216 (defvar charset-history nil) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
217 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
218 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
219 ;;;###autoload |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
220 (defun read-charset (prompt &optional default-value initial-input) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
221 "Read a character set from the minibuffer, prompting with string PROMPT. |
88534 | 222 It must be an Emacs character set listed in the variable `charset-list'. |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
223 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
224 Optional arguments are DEFAULT-VALUE and INITIAL-INPUT. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
225 DEFAULT-VALUE, if non-nil, is the default value. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
226 INITIAL-INPUT, if non-nil, is a string inserted in the minibuffer initially. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
227 See the documentation of the function `completing-read' for the |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
228 detailed meanings of these arguments." |
88534 | 229 (let* ((table (mapcar (lambda (x) (list (symbol-name x))) charset-list)) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
230 (charset (completing-read prompt table |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
231 nil t initial-input 'charset-history |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
232 default-value))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
233 (if (> (length charset) 0) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
234 (intern charset)))) |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
235 |
89483 | 236 ;; Vector of 16 space-only strings. Nth string has display property |
237 ;; '(space :align-to COL) when COL is the column number to align the | |
238 ;; Nth character in a row. Used by `list-block-of-chars'. | |
239 | |
240 (defconst stretches-for-character-list | |
241 (let ((stretches (make-vector 16 nil))) | |
242 (dotimes (i 16) | |
243 (aset stretches i | |
244 (propertize " " 'display `(space :align-to ,(+ 6 (* i 4)))))) | |
245 stretches) | |
246 "For internal use only.") | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
247 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
248 ;; List characters of the range MIN and MAX of CHARSET. If dimension |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
249 ;; of CHARSET is two (i.e. 2-byte charset), ROW is the first byte |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
250 ;; (block index) of the characters, and MIN and MAX are the second |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
251 ;; bytes of the characters. If the dimension is one, ROW should be 0. |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
252 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
253 (defun list-block-of-chars (charset row min max) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
254 (let (i ch) |
89483 | 255 (insert-char ?- (+ 5 (* 4 16))) |
256 (insert "\n ") | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
257 (setq i 0) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
258 (while (< i 16) |
89483 | 259 (insert (format "%4X" i)) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
260 (setq i (1+ i))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
261 (setq i (* (/ min 16) 16)) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
262 (while (<= i max) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
263 (if (= (% i 16) 0) |
89483 | 264 (insert (format "\n%4Xx" (/ (+ (* row 256) i) 16)))) |
265 (setq ch (if (< i min) | |
266 32 | |
267 (or (decode-char charset (+ (* row 256) i)) | |
268 32))) ; gap in mapping | |
269 ;; Don't insert a control code. | |
270 (if (or (< ch 32) (= ch 127)) | |
271 (setq ch (single-key-description ch)) | |
272 (if (and (>= ch 128) (< ch 160)) | |
273 (setq ch (format "%02Xh" ch)))) | |
274 (insert (aref stretches-for-character-list (% i 16)) ch) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
275 (setq i (1+ i)))) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
276 (insert "\n")) |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
277 |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
278 ;;;###autoload |
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
279 (defun list-charset-chars (charset) |
88540 | 280 "Display a list of characters in character set CHARSET." |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
281 (interactive (list (read-charset "Character set: "))) |
47603
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
282 (with-output-to-temp-buffer "*Character List*" |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
283 (with-current-buffer standard-output |
89498
bc83bb07e632
(list-charset-chars): Set buffer file
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
284 (if (coding-system-p charset) |
bc83bb07e632
(list-charset-chars): Set buffer file
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
285 ;; Useful to be able to do C-u C-x = to find file code, for |
bc83bb07e632
(list-charset-chars): Set buffer file
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
286 ;; instance: |
bc83bb07e632
(list-charset-chars): Set buffer file
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
287 (set-buffer-file-coding-system charset)) |
47603
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
288 (setq mode-line-format (copy-sequence mode-line-format)) |
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
289 (let ((slot (memq 'mode-line-buffer-identification mode-line-format))) |
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
290 (if slot |
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
291 (setcdr slot |
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
292 (cons (format " (%s)" charset) |
28c9630ee23e
(list-character-sets): Use the buffer
Kenichi Handa <handa@m17n.org>
parents:
47548
diff
changeset
|
293 (cdr slot))))) |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
294 (setq indent-tabs-mode nil) |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
295 (set-buffer-multibyte t) |
88540 | 296 (unless (charsetp charset) |
297 (error "Invalid character set %s" charset)) | |
298 (let ((dim (charset-dimension charset)) | |
299 (chars (charset-chars charset)) | |
300 ;; (plane (charset-iso-graphic-plane charset)) | |
301 (plane 1) | |
302 (range (plist-get (charset-plist charset) :code-space)) | |
303 min max min2 max2) | |
304 (if (> dim 2) | |
305 (error "Can only list 1- and 2-dimensional charsets")) | |
306 (insert (format "Characters in the coded character set %s.\n" charset)) | |
307 (setq min (aref range 0) | |
308 max (aref range 1)) | |
309 (if (= dim 1) | |
310 (list-block-of-chars charset 0 min max) | |
311 (setq min2 (aref range 2) | |
312 max2 (aref range 3)) | |
313 (let ((i min2)) | |
314 (while (<= i max2) | |
315 (list-block-of-chars charset i min max) | |
316 (setq i (1+ i))))))))) | |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
317 |
28899
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
318 |
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
319 ;;;###autoload |
31246
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
320 (defun describe-character-set (charset) |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
321 "Display information about built-in character set CHARSET." |
88534 | 322 (interactive (list (read-charset "Charset: "))) |
31246
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
323 (or (charsetp charset) |
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
324 (error "Invalid charset: %S" charset)) |
88537
4668340a1e0d
(list-character-sets-1): Fix last change.
Dave Love <fx@gnu.org>
parents:
88534
diff
changeset
|
325 (help-setup-xref (list #'describe-character-set charset) (interactive-p)) |
4668340a1e0d
(list-character-sets-1): Fix last change.
Dave Love <fx@gnu.org>
parents:
88534
diff
changeset
|
326 (with-output-to-temp-buffer (help-buffer) |
4668340a1e0d
(list-character-sets-1): Fix last change.
Dave Love <fx@gnu.org>
parents:
88534
diff
changeset
|
327 (with-current-buffer standard-output |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
328 (insert "Character set: " (symbol-name charset)) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
329 (let ((name (get-charset-property charset :name))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
330 (if (not (eq name charset)) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
331 (insert " (alias of " (symbol-name name) ?\)))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
332 (insert "\n\n" (charset-description charset) "\n\n") |
88701
c68f88e42678
(describe-character-set): Account for
Dave Love <fx@gnu.org>
parents:
88655
diff
changeset
|
333 (insert "Number of contained characters: ") |
c68f88e42678
(describe-character-set): Account for
Dave Love <fx@gnu.org>
parents:
88655
diff
changeset
|
334 (dotimes (i (charset-dimension charset)) |
c68f88e42678
(describe-character-set): Account for
Dave Love <fx@gnu.org>
parents:
88655
diff
changeset
|
335 (unless (= i 0) |
89412 | 336 (insert ?×)) |
337 (insert (format "%d" (charset-chars charset (1+ i))))) | |
88701
c68f88e42678
(describe-character-set): Account for
Dave Love <fx@gnu.org>
parents:
88655
diff
changeset
|
338 (insert ?\n) |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
339 (let ((char (charset-iso-final-char charset))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
340 (when (> char 0) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
341 (insert "Final char of ISO2022 designation sequence: ") |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
342 (insert (format "`%c'\n" char)))) |
88537
4668340a1e0d
(list-character-sets-1): Fix last change.
Dave Love <fx@gnu.org>
parents:
88534
diff
changeset
|
343 (insert (format "Width (how many columns on screen): %d\n" |
88540 | 344 (aref char-width-table (make-char charset)))) |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
345 (let (aliases) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
346 (dolist (c charset-list) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
347 (if (and (not (eq c charset)) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
348 (eq charset (get-charset-property c :name))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
349 (push c aliases))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
350 (if aliases |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
351 (insert "Aliases: " (mapconcat #'symbol-name aliases ", ") ?\n))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
352 |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
353 (dolist (elt `((:ascii-compatible-p "ASCII compatible." nil) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
354 (:map "Map file: " identity) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
355 (:unify-map "Unification map file: " identity) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
356 (:invalid-code |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
357 nil |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
358 ,(lambda (c) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
359 (format "Invalid character: %c (code %d)" c c))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
360 (:emacs-mule-id "Id in emacs-mule coding system: " |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
361 number-to-string) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
362 (:parents "Parents: " |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
363 (lambda (parents) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
364 (mapconcat ,(lambda (elt) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
365 (format "%s" elt)) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
366 parents |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
367 ", "))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
368 (:code-space "Code space: " ,(lambda (c) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
369 (format "%s" c))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
370 (:code-offset "Code offset: " number-to-string) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
371 (:iso-revision-number "ISO revision number: " |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
372 number-to-string) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
373 (:supplementary-p |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
374 "Used only as a parent of some other charset." nil))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
375 (let ((val (get-charset-property charset (car elt)))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
376 (when val |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
377 (if (cadr elt) (insert (cadr elt))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
378 (if (nth 2 elt) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
379 (insert (funcall (nth 2 elt) val))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
380 (insert ?\n))))))) |
17052 | 381 |
382 ;;; CODING-SYSTEM | |
383 | |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
384 (eval-when-compile ; dynamic bondage |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
385 (defvar graphic-register)) |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
386 |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
387 ;; Print information about designation of each graphic register in |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
388 ;; DESIGNATIONS in human readable format. See the documentation of |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
389 ;; `define-coding-system' for the meaning of DESIGNATIONS |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
390 ;; (`:designation' property). |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
391 (defun print-designation (designations) |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
392 (let (charset) |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
393 (dotimes (graphic-register 4) |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
394 (setq charset (aref designations graphic-register)) |
17052 | 395 (princ (format |
396 " G%d -- %s\n" | |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
397 graphic-register |
17052 | 398 (cond ((null charset) |
399 "never used") | |
400 ((eq charset t) | |
401 "no initial designation, and used by any charsets") | |
402 ((symbolp charset) | |
403 (format "%s:%s" | |
404 charset (charset-description charset))) | |
405 ((listp charset) | |
406 (if (charsetp (car charset)) | |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
407 (format "%s:%s, and also used by the following:" |
17052 | 408 (car charset) |
409 (charset-description (car charset))) | |
410 "no initial designation, and used by the followings:")) | |
411 (t | |
412 "invalid designation information")))) | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
413 (when (listp charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
414 (setq charset (cdr charset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
415 (while charset |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
416 (cond ((eq (car charset) t) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
417 (princ "\tany other charsets\n")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
418 ((charsetp (car charset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
419 (princ (format "\t%s:%s\n" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
420 (car charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
421 (charset-description (car charset))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
422 (t |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
423 "invalid designation information")) |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
424 (setq charset (cdr charset))))))) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
425 |
17052 | 426 ;;;###autoload |
427 (defun describe-coding-system (coding-system) | |
22306 | 428 "Display information about CODING-SYSTEM." |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
429 (interactive "zDescribe coding system (default, current choices): ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
430 (if (null coding-system) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
431 (describe-current-coding-system) |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
432 (help-setup-xref (list #'describe-coding-system coding-system) |
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
433 (interactive-p)) |
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
434 (with-output-to-temp-buffer (help-buffer) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
435 (print-coding-system-briefly coding-system 'doc-string) |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
436 (let ((type (coding-system-type coding-system)) |
89483 | 437 ;; Fixme: use this |
438 (extra-spec (coding-system-plist coding-system))) | |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
439 (princ "Type: ") |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
440 (princ type) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
441 (cond ((eq type 'undecided) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
442 (princ " (do automatic conversion)")) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
443 ((eq type 'utf-8) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
444 (princ " (UTF-8: Emacs internal multibyte form)")) |
88993
a7223f475d71
(describe-coding-system): Add utf-16
Dave Love <fx@gnu.org>
parents:
88895
diff
changeset
|
445 ((eq type 'utf-16) |
a7223f475d71
(describe-coding-system): Add utf-16
Dave Love <fx@gnu.org>
parents:
88895
diff
changeset
|
446 ;; (princ " (UTF-16)") |
a7223f475d71
(describe-coding-system): Add utf-16
Dave Love <fx@gnu.org>
parents:
88895
diff
changeset
|
447 ) |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
448 ((eq type 'shift-jis) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
449 (princ " (Shift-JIS, MS-KANJI)")) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
450 ((eq type 'iso-2022) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
451 (princ " (variant of ISO-2022)\n") |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
452 (princ "Initial designations:\n") |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
453 (print-designation (coding-system-get coding-system |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
454 :designation)) |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
455 |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
456 (when (coding-system-get coding-system :flags) |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
457 (princ "Other specifications: \n ") |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
458 (apply #'print-list |
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
459 (coding-system-get coding-system :flags)))) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
460 ((eq type 'charset) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
461 (princ " (charset)")) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
462 ((eq type 'ccl) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
463 (princ " (do conversion by CCL program)")) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
464 ((eq type 'raw-text) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
465 (princ " (text with random binary characters)")) |
88566
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
466 ((eq type 'emacs-mule) |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
467 (princ " (Emacs 21 internal encoding)")) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
468 (t (princ ": invalid coding-system."))) |
20163
5ff1329561b4
(list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents:
20114
diff
changeset
|
469 (princ "\nEOL type: ") |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
470 (let ((eol-type (coding-system-eol-type coding-system))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
471 (cond ((vectorp eol-type) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
472 (princ "Automatic selection from:\n\t") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
473 (princ eol-type) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
474 (princ "\n")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
475 ((or (null eol-type) (eq eol-type 0)) (princ "LF\n")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
476 ((eq eol-type 1) (princ "CRLF\n")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
477 ((eq eol-type 2) (princ "CR\n")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
478 (t (princ "invalid\n"))))) |
88534 | 479 (let ((postread (coding-system-get coding-system :post-read-conversion))) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
480 (when postread |
35585 | 481 (princ "After decoding text normally,") |
482 (princ " perform post-conversion using the function: ") | |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
483 (princ "\n ") |
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
484 (princ postread) |
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
485 (princ "\n"))) |
88534 | 486 (let ((prewrite (coding-system-get coding-system :pre-write-conversion))) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
487 (when prewrite |
35585 | 488 (princ "Before encoding text normally,") |
489 (princ " perform pre-conversion using the function: ") | |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
490 (princ "\n ") |
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
491 (princ prewrite) |
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
492 (princ "\n"))) |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
493 (with-current-buffer standard-output |
88566
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
494 (let ((charsets (coding-system-charset-list coding-system))) |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
495 (when (and (not (eq (coding-system-base coding-system) 'raw-text)) |
36989
ce090eb0edda
(describe-coding-system): For raw-text and emacs-mule, don't add
Kenichi Handa <handa@m17n.org>
parents:
35747
diff
changeset
|
496 charsets) |
88566
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
497 (cond |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
498 ((eq charsets 'iso-2022) |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
499 (insert "This coding system can encode all ISO 2022 charsets.")) |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
500 ((eq charsets 'emacs-mule) |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
501 (insert "This coding system can encode all emacs-mule charsets\ |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
502 .""")) |
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
503 (t |
35585 | 504 (insert "This coding system encodes the following charsets:\n ") |
31246
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
505 (while charsets |
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
506 (insert " " (symbol-name (car charsets))) |
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
507 (search-backward (symbol-name (car charsets))) |
40639 | 508 (help-xref-button 0 'help-character-set (car charsets)) |
31246
d8ce7bce2aab
(charset-multibyte-form-string): New function.
Kenichi Handa <handa@m17n.org>
parents:
30765
diff
changeset
|
509 (goto-char (point-max)) |
88566
2c3cb7fbba2a
(describe-coding-system): Avoid error
Dave Love <fx@gnu.org>
parents:
88542
diff
changeset
|
510 (setq charsets (cdr charsets))))))))))) |
17052 | 511 |
512 ;;;###autoload | |
513 (defun describe-current-coding-system-briefly () | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
514 "Display coding systems currently used in a brief format in echo area. |
17052 | 515 |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
516 The format is \"F[..],K[..],T[..],P>[..],P<[..], default F[..],P<[..],P<[..]\", |
17052 | 517 where mnemonics of the following coding systems come in this order |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
518 in place of `..': |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
519 `buffer-file-coding-system' (of the current buffer) |
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
520 eol-type of `buffer-file-coding-system' (of the current buffer) |
22306 | 521 Value returned by `keyboard-coding-system' |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
522 eol-type of `keyboard-coding-system' |
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
523 Value returned by `terminal-coding-system'. |
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
524 eol-type of `terminal-coding-system' |
22306 | 525 `process-coding-system' for read (of the current buffer, if any) |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
526 eol-type of `process-coding-system' for read (of the current buffer, if any) |
22306 | 527 `process-coding-system' for write (of the current buffer, if any) |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
528 eol-type of `process-coding-system' for write (of the current buffer, if any) |
22306 | 529 `default-buffer-file-coding-system' |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
530 eol-type of `default-buffer-file-coding-system' |
22306 | 531 `default-process-coding-system' for read |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
532 eol-type of `default-process-coding-system' for read |
22306 | 533 `default-process-coding-system' for write |
30765
1e5a486b8b25
punctuation fixes in doc strings
Sam Steingold <sds@gnu.org>
parents:
30126
diff
changeset
|
534 eol-type of `default-process-coding-system'" |
17052 | 535 (interactive) |
536 (let* ((proc (get-buffer-process (current-buffer))) | |
537 (process-coding-systems (if proc (process-coding-system proc)))) | |
538 (message | |
24865
a4b8bb7bed21
(describe-current-coding-system-briefly): Fix format string.
Kenichi Handa <handa@m17n.org>
parents:
24724
diff
changeset
|
539 "F[%c%s],K[%c%s],T[%c%s],P>[%c%s],P<[%c%s], default F[%c%s],P>[%c%s],P<[%c%s]" |
17052 | 540 (coding-system-mnemonic buffer-file-coding-system) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
541 (coding-system-eol-type-mnemonic buffer-file-coding-system) |
17052 | 542 (coding-system-mnemonic (keyboard-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
543 (coding-system-eol-type-mnemonic (keyboard-coding-system)) |
17052 | 544 (coding-system-mnemonic (terminal-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
545 (coding-system-eol-type-mnemonic (terminal-coding-system)) |
17052 | 546 (coding-system-mnemonic (car process-coding-systems)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
547 (coding-system-eol-type-mnemonic (car process-coding-systems)) |
17052 | 548 (coding-system-mnemonic (cdr process-coding-systems)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
549 (coding-system-eol-type-mnemonic (cdr process-coding-systems)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
550 (coding-system-mnemonic default-buffer-file-coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
551 (coding-system-eol-type-mnemonic default-buffer-file-coding-system) |
17052 | 552 (coding-system-mnemonic (car default-process-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
553 (coding-system-eol-type-mnemonic (car default-process-coding-system)) |
17052 | 554 (coding-system-mnemonic (cdr default-process-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
555 (coding-system-eol-type-mnemonic (cdr default-process-coding-system)) |
17052 | 556 ))) |
557 | |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
558 (defun print-coding-system-briefly (coding-system &optional doc-string) |
89483 | 559 "Print symbol name and mnemonic letter of CODING-SYSTEM with `princ'. |
560 If DOC-STRING is non-nil, print also the docstring of CODING-SYSTEM. | |
561 If DOC-STRING is `tightly', don't print an empty line before the | |
562 docstring, and print only the first line of the docstring." | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
563 (if (not coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
564 (princ "nil\n") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
565 (princ (format "%c -- %s" |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
566 (coding-system-mnemonic coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
567 coding-system)) |
88655
ea446bb886ad
(print-coding-system-briefly): Fix
Dave Love <fx@gnu.org>
parents:
88648
diff
changeset
|
568 (let ((aliases (coding-system-aliases coding-system))) |
46490
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
569 (cond ((eq coding-system (car aliases)) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
570 (if (cdr aliases) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
571 (princ (format " %S" (cons 'alias: (cdr aliases)))))) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
572 ((memq coding-system aliases) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
573 (princ (format " (alias of %s)" (car aliases)))) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
574 (t |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
575 (let ((eol-type (coding-system-eol-type coding-system)) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
576 (base-eol-type (coding-system-eol-type (car aliases)))) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
577 (if (and (integerp eol-type) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
578 (vectorp base-eol-type) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
579 (not (eq coding-system (aref base-eol-type eol-type)))) |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
580 (princ (format " (alias of %s)" |
e541dfaa4964
(print-coding-system-briefly): Fix the handling of an alias of which
Kenichi Handa <handa@m17n.org>
parents:
45909
diff
changeset
|
581 (aref base-eol-type eol-type)))))))) |
50496
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
582 (princ "\n") |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
583 (or (eq doc-string 'tightly) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
584 (princ "\n")) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
585 (if doc-string |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
586 (let ((doc (or (coding-system-doc-string coding-system) ""))) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
587 (when (eq doc-string 'tightly) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
588 (if (string-match "\n" doc) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
589 (setq doc (substring doc 0 (match-beginning 0)))) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
590 (setq doc (concat " " doc))) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
591 (princ (format "%s\n" doc)))))) |
17052 | 592 |
593 ;;;###autoload | |
594 (defun describe-current-coding-system () | |
22306 | 595 "Display coding systems currently used, in detail." |
17052 | 596 (interactive) |
597 (with-output-to-temp-buffer "*Help*" | |
598 (let* ((proc (get-buffer-process (current-buffer))) | |
599 (process-coding-systems (if proc (process-coding-system proc)))) | |
19081
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
600 (princ "Coding system for saving this buffer:\n ") |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
601 (if (local-variable-p 'buffer-file-coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
602 (print-coding-system-briefly buffer-file-coding-system) |
19081
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
603 (princ "Not set locally, use the default.\n")) |
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
604 (princ "Default coding system (for new files):\n ") |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
605 (print-coding-system-briefly default-buffer-file-coding-system) |
19081
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
606 (princ "Coding system for keyboard input:\n ") |
17052 | 607 (print-coding-system-briefly (keyboard-coding-system)) |
19081
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
608 (princ "Coding system for terminal output:\n ") |
17052 | 609 (print-coding-system-briefly (terminal-coding-system)) |
88705 | 610 (princ "Coding system for inter-client cut and paste:\n ") |
611 (print-coding-system-briefly selection-coding-system) | |
19081
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
612 (when (get-buffer-process (current-buffer)) |
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
613 (princ "Coding systems for process I/O:\n") |
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
614 (princ " encoding input to the process: ") |
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
615 (print-coding-system-briefly (cdr process-coding-systems)) |
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
616 (princ " decoding output from the process: ") |
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
617 (print-coding-system-briefly (car process-coding-systems))) |
19657
940d50684d68
(describe-current-coding-system): Add missing newline in output.
Richard M. Stallman <rms@gnu.org>
parents:
19557
diff
changeset
|
618 (princ "Defaults for subprocess I/O:\n") |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
619 (princ " decoding: ") |
17052 | 620 (print-coding-system-briefly (car default-process-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
621 (princ " encoding: ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
622 (print-coding-system-briefly (cdr default-process-coding-system))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
623 |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
624 (with-current-buffer standard-output |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
625 |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
626 (princ " |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
627 Priority order for recognizing coding systems when reading files:\n") |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
628 (let ((i 1)) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
629 (dolist (elt (coding-system-priority-list)) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
630 (princ (format " %d. %s " i elt)) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
631 (let ((aliases (coding-system-aliases elt))) |
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
632 (if (eq elt (car aliases)) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
633 (if (cdr aliases) |
88648
dd88ab5e7207
(describe-current-coding-system): Fix
Dave Love <fx@gnu.org>
parents:
88637
diff
changeset
|
634 (princ (cons 'alias: (cdr aliases)))) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
635 (princ (list 'alias 'of (car aliases)))) |
19265
6b31dac7f72b
(print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents:
19081
diff
changeset
|
636 (terpri) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
637 (setq i (1+ i))))) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
638 |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
639 (princ "\n Other coding systems cannot be distinguished automatically |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
640 from these, and therefore cannot be recognized automatically |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
641 with the present coding system priorities.\n\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
642 |
88655
ea446bb886ad
(print-coding-system-briefly): Fix
Dave Love <fx@gnu.org>
parents:
88648
diff
changeset
|
643 ;; Fixme: should this be replaced or junked? |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
644 (if nil |
18799
6c0d648d2cf8
(describe-current-coding-system): Use coding-category-iso-7-else
Kenichi Handa <handa@m17n.org>
parents:
18696
diff
changeset
|
645 (let ((categories '(coding-category-iso-7 coding-category-iso-7-else)) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
646 coding-system codings) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
647 (while categories |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
648 (setq coding-system (symbol-value (car categories))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
649 (mapcar |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
650 (lambda (x) |
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
651 (if (and (not (eq x coding-system)) |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
652 (let ((flags (coding-system-get :flags))) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
653 (not (or (memq 'use-roman flags) |
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
654 (memq 'use-oldjis flags))))) |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
655 (setq codings (cons x codings)))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
656 (get (car categories) 'coding-systems)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
657 (if codings |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
658 (let ((max-col (frame-width)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
659 pos) |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
660 (princ (format "\ |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
661 The following are decoded correctly but recognized as %s:\n " |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
662 coding-system)) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
663 (while codings |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
664 (setq pos (point)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
665 (insert (format " %s" (car codings))) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
666 (when (> (current-column) max-col) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
667 (goto-char pos) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
668 (insert "\n ") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
669 (goto-char (point-max))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
670 (setq codings (cdr codings))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
671 (insert "\n\n"))) |
88412
524f9b5b2ac5
(print-designation): Arguments changed.
Kenichi Handa <handa@m17n.org>
parents:
43292
diff
changeset
|
672 (setq categories (cdr categories))))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
673 |
19081
f33df9d64fe8
(describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents:
18799
diff
changeset
|
674 (princ "Particular coding systems specified for certain file names:\n") |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
675 (terpri) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
676 (princ " OPERATION\tTARGET PATTERN\t\tCODING SYSTEM(s)\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
677 (princ " ---------\t--------------\t\t----------------\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
678 (let ((func (lambda (operation alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
679 (princ " ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
680 (princ operation) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
681 (if (not alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
682 (princ "\tnothing specified\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
683 (while alist |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
684 (indent-to 16) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
685 (prin1 (car (car alist))) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
686 (if (>= (current-column) 40) |
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
687 (newline)) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
688 (indent-to 40) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
689 (princ (cdr (car alist))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
690 (princ "\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
691 (setq alist (cdr alist))))))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
692 (funcall func "File I/O" file-coding-system-alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
693 (funcall func "Process I/O" process-coding-system-alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
694 (funcall func "Network I/O" network-coding-system-alist)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
695 (help-mode)))) |
17052 | 696 |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
697 (defun print-coding-system (coding-system) |
88534 | 698 "Print detailed information on CODING-SYSTEM." |
17052 | 699 (let ((type (coding-system-type coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
700 (eol-type (coding-system-eol-type coding-system)) |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
701 (flags (coding-system-get coding-system :flags)) |
88655
ea446bb886ad
(print-coding-system-briefly): Fix
Dave Love <fx@gnu.org>
parents:
88648
diff
changeset
|
702 (aliases (coding-system-aliases coding-system))) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
703 (if (not (eq (car aliases) coding-system)) |
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
704 (princ (format "%s (alias of %s)\n" coding-system (car aliases))) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
705 (princ coding-system) |
20114
cbf191888430
(describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents:
20092
diff
changeset
|
706 (setq aliases (cdr aliases)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
707 (while aliases |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
708 (princ ",") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
709 (princ (car aliases)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
710 (setq aliases (cdr aliases))) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
711 (princ (format ":%s:%c:%d:" |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
712 type |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
713 (coding-system-mnemonic coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
714 (if (integerp eol-type) eol-type 3))) |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
715 (cond ((eq type 'iso2022) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
716 (let ((idx 0) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
717 charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
718 (while (< idx 4) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
719 (setq charset (aref flags idx)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
720 (cond ((null charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
721 (princ -1)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
722 ((eq charset t) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
723 (princ -2)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
724 ((charsetp charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
725 (princ charset)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
726 ((listp charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
727 (princ "(") |
17052 | 728 (princ (car charset)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
729 (setq charset (cdr charset)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
730 (while charset |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
731 (princ ",") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
732 (princ (car charset)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
733 (setq charset (cdr charset))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
734 (princ ")"))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
735 (princ ",") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
736 (setq idx (1+ idx))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
737 (while (< idx 12) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
738 (princ (if (aref flags idx) 1 0)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
739 (princ ",") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
740 (setq idx (1+ idx))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
741 (princ (if (aref flags idx) 1 0)))) |
88637
10c911c19787
(print-coding-system): (Incomplete)
Dave Love <fx@gnu.org>
parents:
88566
diff
changeset
|
742 ((eq type 'ccl) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
743 (let (i len) |
21967 | 744 (if (symbolp (car flags)) |
745 (princ (format " %s" (car flags))) | |
746 (setq i 0 len (length (car flags))) | |
747 (while (< i len) | |
748 (princ (format " %x" (aref (car flags) i))) | |
749 (setq i (1+ i)))) | |
17052 | 750 (princ ",") |
21967 | 751 (if (symbolp (cdr flags)) |
752 (princ (format "%s" (cdr flags))) | |
753 (setq i 0 len (length (cdr flags))) | |
754 (while (< i len) | |
755 (princ (format " %x" (aref (cdr flags) i))) | |
756 (setq i (1+ i)))))) | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
757 (t (princ 0))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
758 (princ ":") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
759 (princ (coding-system-doc-string coding-system)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
760 (princ "\n")))) |
17052 | 761 |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
762 ;;;###autoload |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
763 (defun list-coding-systems (&optional arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
764 "Display a list of all coding systems. |
22306 | 765 This shows the mnemonic letter, name, and description of each coding system. |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
766 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
767 With prefix arg, the output format gets more cryptic, |
22306 | 768 but still contains full information about each coding system." |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
769 (interactive "P") |
17052 | 770 (with-output-to-temp-buffer "*Help*" |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
771 (list-coding-systems-1 arg))) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
772 |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
773 (defun list-coding-systems-1 (arg) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
774 (if (null arg) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
775 (princ "\ |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
776 ############################################### |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
777 # List of coding systems in the following format: |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
778 # MNEMONIC-LETTER -- CODING-SYSTEM-NAME |
50496
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
779 # DOC-STRING |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
780 ") |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
781 (princ "\ |
17052 | 782 ######################### |
783 ## LIST OF CODING SYSTEMS | |
784 ## Each line corresponds to one coding system | |
785 ## Format of a line is: | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
786 ## NAME[,ALIAS...]:TYPE:MNEMONIC:EOL:FLAGS:POST-READ-CONVERSION |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
787 ## :PRE-WRITE-CONVERSION:DOC-STRING, |
17052 | 788 ## where |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
789 ## NAME = coding system name |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
790 ## ALIAS = alias of the coding system |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
791 ## TYPE = nil (no conversion), t (undecided or automatic detection), |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
792 ## 0 (EMACS-MULE), 1 (SJIS), 2 (ISO2022), 3 (BIG5), or 4 (CCL) |
17052 | 793 ## EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection) |
794 ## FLAGS = | |
795 ## if TYPE = 2 then | |
796 ## comma (`,') separated data of the followings: | |
797 ## G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN, | |
798 ## LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429 | |
799 ## else if TYPE = 4 then | |
800 ## comma (`,') separated CCL programs for read and write | |
801 ## else | |
802 ## 0 | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
803 ## POST-READ-CONVERSION, PRE-WRITE-CONVERSION = function name to be called |
17052 | 804 ## |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
805 ")) |
50496
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
806 (dolist (coding-system (sort-coding-systems (coding-system-list 'base-only))) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
807 (if (null arg) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
808 (print-coding-system-briefly coding-system 'tightly) |
ad2c77c56a81
(print-coding-system-briefly): If
Kenichi Handa <handa@m17n.org>
parents:
49875
diff
changeset
|
809 (print-coding-system coding-system)))) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
810 |
88655
ea446bb886ad
(print-coding-system-briefly): Fix
Dave Love <fx@gnu.org>
parents:
88648
diff
changeset
|
811 ;; Fixme: delete? |
26688
1830bc1903fb
(list-coding-categories): Fix typo;
Gerd Moellmann <gerd@gnu.org>
parents:
26189
diff
changeset
|
812 ;;;###autoload |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
813 (defun list-coding-categories () |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
814 "Display a list of all coding categories." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
815 (with-output-to-temp-buffer "*Help*" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
816 (princ "\ |
17052 | 817 ############################ |
818 ## LIST OF CODING CATEGORIES (ordered by priority) | |
819 ## CATEGORY:CODING-SYSTEM | |
820 ## | |
821 ") | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
822 (let ((l coding-category-list)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
823 (while l |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
824 (princ (format "%s:%s\n" (car l) (symbol-value (car l)))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
825 (setq l (cdr l)))))) |
17052 | 826 |
827 ;;; FONT | |
828 | |
829 (defun describe-font-internal (font-info &optional verbose) | |
88534 | 830 "Print information about a font in FONT-INFO." |
17052 | 831 (print-list "name (opened by):" (aref font-info 0)) |
832 (print-list " full name:" (aref font-info 1)) | |
28899
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
833 (print-list " size:" (format "%2d" (aref font-info 2))) |
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
834 (print-list " height:" (format "%2d" (aref font-info 3))) |
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
835 (print-list " baseline-offset:" (format "%2d" (aref font-info 4))) |
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
836 (print-list "relative-compose:" (format "%2d" (aref font-info 5)))) |
17052 | 837 |
838 ;;;###autoload | |
839 (defun describe-font (fontname) | |
840 "Display information about fonts which partially match FONTNAME." | |
20092 | 841 (interactive "sFontname (default, current choice for ASCII chars): ") |
28216
cad26a9da36b
(describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents:
27973
diff
changeset
|
842 (or (and window-system (fboundp 'fontset-list)) |
21469
ea652c41eec6
(list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents:
20731
diff
changeset
|
843 (error "No fontsets being used")) |
18696
1caf720e4f55
(print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents:
18643
diff
changeset
|
844 (when (or (not fontname) (= (length fontname) 0)) |
1caf720e4f55
(print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents:
18643
diff
changeset
|
845 (setq fontname (cdr (assq 'font (frame-parameters)))) |
1caf720e4f55
(print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents:
18643
diff
changeset
|
846 (if (query-fontset fontname) |
1caf720e4f55
(print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents:
18643
diff
changeset
|
847 (setq fontname |
30126
f5fd9fcdaeb2
(describe-font): Adjusted for the chnage of fontset-info.
Kenichi Handa <handa@m17n.org>
parents:
29454
diff
changeset
|
848 (nth 1 (assq 'ascii (aref (fontset-info fontname) 2)))))) |
17052 | 849 (let ((font-info (font-info fontname))) |
850 (if (null font-info) | |
851 (message "No matching font") | |
852 (with-output-to-temp-buffer "*Help*" | |
853 (describe-font-internal font-info 'verbose))))) | |
854 | |
89355
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
855 (defun print-fontset-element (val) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
856 ;; VAL has this format: |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
857 ;; ((REQUESTED-FONT-NAME OPENED-FONT-NAME ...) ...) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
858 ;; CHAR RANGE is already inserted. Get character codes from |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
859 ;; the current line. |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
860 (beginning-of-line) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
861 (let ((from (following-char)) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
862 (to (if (looking-at "[^.]*[.]* ") |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
863 (char-after (match-end 0))))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
864 (if (re-search-forward "[ \t]*$" nil t) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
865 (delete-region (match-beginning 0) (match-end 0))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
866 |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
867 ;; For non-ASCII characters, insert also CODE RANGE. |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
868 (if (or (>= from 128) (and to (>= to 128))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
869 (if to |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
870 (insert (format " (#x%02X .. #x%02X)" from to)) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
871 (insert (format " (#x%02X)" from)))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
872 |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
873 ;; Insert a requested font name. |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
874 (dolist (elt val) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
875 (let ((requested (car elt))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
876 (if (stringp requested) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
877 (insert "\n " requested) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
878 (let ((family (aref requested 0)) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
879 (registry (aref requested 5))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
880 (if (not family) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
881 (setq family "*-*") |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
882 (or (string-match "-" family) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
883 (setq family (concat "*-" family)))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
884 (or (string-match "-" registry) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
885 (= (aref registry (1- (length registry))) ?*) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
886 (setq registry (concat registry "*"))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
887 (insert "\n -" family |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
888 ?- (or (aref requested 1) ?*) ; weight |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
889 ?- (or (aref requested 2) ?*) ; slant |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
890 "-*-" (or (aref requested 3) ?*) ; width |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
891 "-*-" (or (aref requested 4) ?*) ; adstyle |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
892 "-*-*-*-*-*-*-" registry)))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
893 |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
894 ;; Insert opened font names (if any). |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
895 (if (and (boundp 'print-opened) (symbol-value 'print-opened)) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
896 (dolist (opened (cdr elt)) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
897 (insert "\n\t[" opened "]")))))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
898 |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
899 (defun print-fontset (fontset &optional print-opened) |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
900 "Print information about FONTSET. |
49875
40b0b48205b3
(print-fontset): If FONTSET is nil,
Kenichi Handa <handa@m17n.org>
parents:
49049
diff
changeset
|
901 If FONTSET is nil, print information about the default fontset. |
89355
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
902 If optional arg PRINT-OPENED is non-nil, also print names of all opened |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
903 fonts for FONTSET. This function actually inserts the information in |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
904 the current buffer." |
49875
40b0b48205b3
(print-fontset): If FONTSET is nil,
Kenichi Handa <handa@m17n.org>
parents:
49049
diff
changeset
|
905 (or fontset |
40b0b48205b3
(print-fontset): If FONTSET is nil,
Kenichi Handa <handa@m17n.org>
parents:
49049
diff
changeset
|
906 (setq fontset (query-fontset "fontset-default"))) |
88895
ab54ec5d2b3c
(print-fontset): Use describe-vector
Kenichi Handa <handa@m17n.org>
parents:
88818
diff
changeset
|
907 (beginning-of-line) |
ab54ec5d2b3c
(print-fontset): Use describe-vector
Kenichi Handa <handa@m17n.org>
parents:
88818
diff
changeset
|
908 (insert "Fontset: " fontset "\n") |
89355
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
909 (insert (propertize "CHAR RANGE" 'face 'underline) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
910 " (" (propertize "CODE RANGE" 'face 'underline) ")\n") |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
911 (insert " " (propertize "FONT NAME" 'face 'underline) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
912 " (" (propertize "REQUESTED" 'face 'underline) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
913 " and [" (propertize "OPENED" 'face 'underline) "])") |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
914 (let ((info (fontset-info fontset))) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
915 (describe-vector info 'print-fontset-element) |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
916 (insert "\n ---<fallback to the default fontset>---") |
6f8fa82cac02
(print-fontset-element): New
Kenichi Handa <handa@m17n.org>
parents:
89346
diff
changeset
|
917 (describe-vector (char-table-extra-slot info 0) 'print-fontset-element))) |
17052 | 918 |
919 ;;;###autoload | |
920 (defun describe-fontset (fontset) | |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
921 "Display information about FONTSET. |
28899
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
922 This shows which font is used for which character(s)." |
17052 | 923 (interactive |
28216
cad26a9da36b
(describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents:
27973
diff
changeset
|
924 (if (not (and window-system (fboundp 'fontset-list))) |
21469
ea652c41eec6
(list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents:
20731
diff
changeset
|
925 (error "No fontsets being used") |
35585 | 926 (let ((fontset-list (nconc |
45909
9f98a97f5469
(describe-fontset): Don't cons uselessly.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45871
diff
changeset
|
927 (fontset-list) |
9f98a97f5469
(describe-fontset): Don't cons uselessly.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45871
diff
changeset
|
928 (mapcar 'cdr fontset-alias-alist))) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
929 (completion-ignore-case t)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
930 (list (completing-read |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
931 "Fontset (default, used by the current frame): " |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
932 fontset-list nil t))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
933 (if (= (length fontset) 0) |
49875
40b0b48205b3
(print-fontset): If FONTSET is nil,
Kenichi Handa <handa@m17n.org>
parents:
49049
diff
changeset
|
934 (setq fontset (frame-parameter nil 'font))) |
40b0b48205b3
(print-fontset): If FONTSET is nil,
Kenichi Handa <handa@m17n.org>
parents:
49049
diff
changeset
|
935 (setq fontset (query-fontset fontset)) |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
936 (help-setup-xref (list #'describe-fontset fontset) (interactive-p)) |
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
937 (with-output-to-temp-buffer (help-buffer) |
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
938 (with-current-buffer standard-output |
28899
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
939 (print-fontset fontset t)))) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
940 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
941 ;;;###autoload |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
942 (defun list-fontsets (arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
943 "Display a list of all fontsets. |
22306 | 944 This shows the name, size, and style of each fontset. |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
945 With prefix arg, also list the fonts contained in each fontset; |
22306 | 946 see the function `describe-fontset' for the format of the list." |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
947 (interactive "P") |
28216
cad26a9da36b
(describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents:
27973
diff
changeset
|
948 (if (not (and window-system (fboundp 'fontset-list))) |
21469
ea652c41eec6
(list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents:
20731
diff
changeset
|
949 (error "No fontsets being used") |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
950 (help-setup-xref (list #'list-fontsets arg) (interactive-p)) |
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
951 (with-output-to-temp-buffer (help-buffer) |
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
952 (with-current-buffer standard-output |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
953 ;; This code is duplicated near the end of mule-diag. |
24161
782215de9b98
(list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents:
23582
diff
changeset
|
954 (let ((fontsets |
782215de9b98
(list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents:
23582
diff
changeset
|
955 (sort (fontset-list) |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
956 (lambda (x y) |
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
957 (string< (fontset-plain-name x) |
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
958 (fontset-plain-name y)))))) |
21469
ea652c41eec6
(list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents:
20731
diff
changeset
|
959 (while fontsets |
28899
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
960 (if arg |
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
961 (print-fontset (car fontsets) nil) |
133a92b8094d
(syntax-description-table): New variable.
Kenichi Handa <handa@m17n.org>
parents:
28216
diff
changeset
|
962 (insert "Fontset: " (car fontsets) "\n")) |
21469
ea652c41eec6
(list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents:
20731
diff
changeset
|
963 (setq fontsets (cdr fontsets)))))))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
964 |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
965 ;;;###autoload |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
966 (defun list-input-methods () |
22306 | 967 "Display information about all input methods." |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
968 (interactive) |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
969 (help-setup-xref '(list-input-methods) (interactive-p)) |
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
970 (with-output-to-temp-buffer (help-buffer) |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
971 (list-input-methods-1) |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
972 (with-current-buffer standard-output |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
973 (save-excursion |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
974 (goto-char (point-min)) |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
975 (while (re-search-forward |
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
976 "^ \\([^ ]+\\) (`.*' in mode line)$" nil t) |
43292 | 977 (help-xref-button 1 #'help-input-method |
43231
06e0fbd07e17
Various doc and message fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
42362
diff
changeset
|
978 (match-string 1) |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
979 "mouse-2: describe this method")))))) |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
980 |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
981 (defun list-input-methods-1 () |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
982 (if (not input-method-alist) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
983 (progn |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
984 (princ " |
44746
8f2bf8b392fe
(list-input-methods-1): Doc fix
Pavel Janík <Pavel@Janik.cz>
parents:
43977
diff
changeset
|
985 No input method is available, perhaps because you have not |
8f2bf8b392fe
(list-input-methods-1): Doc fix
Pavel Janík <Pavel@Janik.cz>
parents:
43977
diff
changeset
|
986 installed LEIM (Libraries of Emacs Input Methods).")) |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
987 (princ "LANGUAGE\n NAME (`TITLE' in mode line)\n") |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
988 (princ " SHORT-DESCRIPTION\n------------------------------\n") |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
989 (setq input-method-alist |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
990 (sort input-method-alist |
47548
698b4a4bb562
(describe-coding-system): Remove unused `coding-spec' variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46490
diff
changeset
|
991 (lambda (x y) (string< (nth 1 x) (nth 1 y))))) |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
992 (let ((l input-method-alist) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
993 language elt) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
994 (while l |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
995 (setq elt (car l) l (cdr l)) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
996 (when (not (equal language (nth 1 elt))) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
997 (setq language (nth 1 elt)) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
998 (princ language) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
999 (terpri)) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1000 (princ (format " %s (`%s' in mode line)\n %s\n" |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1001 (car elt) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1002 (let ((title (nth 3 elt))) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1003 (if (and (consp title) (stringp (car title))) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1004 (car title) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1005 title)) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1006 (let ((description (nth 4 elt))) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1007 (string-match ".*" description) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1008 (match-string 0 description)))))))) |
17052 | 1009 |
1010 ;;; DIAGNOSIS | |
1011 | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1012 ;; Insert a header of a section with SECTION-NUMBER and TITLE. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1013 (defun insert-section (section-number title) |
17052 | 1014 (insert "########################################\n" |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1015 "# Section " (format "%d" section-number) ". " title "\n" |
17052 | 1016 "########################################\n\n")) |
1017 | |
1018 ;;;###autoload | |
1019 (defun mule-diag () | |
24724
df2a95fa1429
(mule-diag): Change MULE to Mule in docstring.
Kenichi Handa <handa@m17n.org>
parents:
24691
diff
changeset
|
1020 "Display diagnosis of the multilingual environment (Mule). |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1021 |
22306 | 1022 This shows various information related to the current multilingual |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1023 environment, including lists of input methods, coding systems, |
22306 | 1024 character sets, and fontsets (if Emacs is running under a window |
21469
ea652c41eec6
(list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents:
20731
diff
changeset
|
1025 system which uses fontsets)." |
17052 | 1026 (interactive) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1027 (with-output-to-temp-buffer "*Mule-Diagnosis*" |
40664
4e5f8e42b8d1
(list-character-sets, sort-listed-character-sets, describe-character-set)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40639
diff
changeset
|
1028 (with-current-buffer standard-output |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1029 (insert "###############################################\n" |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1030 "### Current Status of Multilingual Features ###\n" |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1031 "###############################################\n\n" |
17052 | 1032 "CONTENTS: Section 1. General Information\n" |
1033 " Section 2. Display\n" | |
1034 " Section 3. Input methods\n" | |
1035 " Section 4. Coding systems\n" | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1036 " Section 5. Character sets\n") |
28216
cad26a9da36b
(describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents:
27973
diff
changeset
|
1037 (if (and window-system (fboundp 'fontset-list)) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1038 (insert " Section 6. Fontsets\n")) |
17052 | 1039 (insert "\n") |
1040 | |
1041 (insert-section 1 "General Information") | |
19425
572165bfff3e
(mule-diag): Don't print primary-language.
Richard M. Stallman <rms@gnu.org>
parents:
19265
diff
changeset
|
1042 (insert "Version of this emacs:\n " (emacs-version) "\n\n") |
34631
aeb6db8df2b9
(mule-diag): Insert information about
Kenichi Handa <handa@m17n.org>
parents:
34078
diff
changeset
|
1043 (insert "Configuration options:\n " system-configuration-options "\n\n") |
aeb6db8df2b9
(mule-diag): Insert information about
Kenichi Handa <handa@m17n.org>
parents:
34078
diff
changeset
|
1044 (insert "Multibyte characters awareness:\n" |
aeb6db8df2b9
(mule-diag): Insert information about
Kenichi Handa <handa@m17n.org>
parents:
34078
diff
changeset
|
1045 (format " default: %S\n" default-enable-multibyte-characters) |
aeb6db8df2b9
(mule-diag): Insert information about
Kenichi Handa <handa@m17n.org>
parents:
34078
diff
changeset
|
1046 (format " current-buffer: %S\n\n" enable-multibyte-characters)) |
aeb6db8df2b9
(mule-diag): Insert information about
Kenichi Handa <handa@m17n.org>
parents:
34078
diff
changeset
|
1047 (insert "Current language environment: " current-language-environment |
aeb6db8df2b9
(mule-diag): Insert information about
Kenichi Handa <handa@m17n.org>
parents:
34078
diff
changeset
|
1048 "\n\n") |
17052 | 1049 |
1050 (insert-section 2 "Display") | |
1051 (if window-system | |
1052 (insert "Window-system: " | |
1053 (symbol-name window-system) | |
1054 (format "%s" window-system-version)) | |
1055 (insert "Terminal: " (getenv "TERM"))) | |
1056 (insert "\n\n") | |
1057 | |
1058 (if (eq window-system 'x) | |
1059 (let ((font (cdr (assq 'font (frame-parameters))))) | |
1060 (insert "The selected frame is using the " | |
1061 (if (query-fontset font) "fontset" "font") | |
1062 ":\n\t" font)) | |
1063 (insert "Coding system of the terminal: " | |
1064 (symbol-name (terminal-coding-system)))) | |
1065 (insert "\n\n") | |
1066 | |
1067 (insert-section 3 "Input methods") | |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1068 (list-input-methods-1) |
17052 | 1069 (insert "\n") |
1070 (if default-input-method | |
26189
88faf40281cd
(mule-diag): Handle the case that
Kenichi Handa <handa@m17n.org>
parents:
24865
diff
changeset
|
1071 (insert (format "Default input method: %s\n" default-input-method)) |
19657
940d50684d68
(describe-current-coding-system): Add missing newline in output.
Richard M. Stallman <rms@gnu.org>
parents:
19557
diff
changeset
|
1072 (insert "No default input method is specified\n")) |
17052 | 1073 |
1074 (insert-section 4 "Coding systems") | |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1075 (list-coding-systems-1 t) |
17052 | 1076 (insert "\n") |
1077 | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1078 (insert-section 5 "Character sets") |
27912
ed26ed5b0afc
(list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents:
26688
diff
changeset
|
1079 (list-character-sets-2) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1080 (insert "\n") |
17052 | 1081 |
28216
cad26a9da36b
(describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents:
27973
diff
changeset
|
1082 (when (and window-system (fboundp 'fontset-list)) |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1083 ;; This code duplicates most of list-fontsets. |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
1084 (insert-section 6 "Fontsets") |
22339
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1085 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n") |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1086 (insert "------------\t\t\t\t\t\t ----- -----\n") |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1087 (let ((fontsets (fontset-list))) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1088 (while fontsets |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1089 (print-fontset (car fontsets) t) |
69de59462e22
(list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents:
22306
diff
changeset
|
1090 (setq fontsets (cdr fontsets))))) |
22290
31291d62195e
(mule-diag): Don't call help-mode.
Karl Heuer <kwzh@gnu.org>
parents:
21979
diff
changeset
|
1091 (print-help-return-message)))) |
17052 | 1092 |
89483 | 1093 ;;;###autoload |
88818
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1094 (defcustom unicodedata-file nil |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1095 "Location of UnicodeData file. |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1096 This is the UnicodeData.txt file from the Unicode consortium, used for |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1097 diagnostics. If it is non-nil `describe-char-after' will print data |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1098 looked up from it." |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1099 :group 'mule |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1100 :type '(choice (const :tag "None" nil) |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1101 file)) |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1102 |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1103 ;; We could convert the unidata file into a Lispy form once-for-all |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1104 ;; and distribute it for loading on demand. It might be made more |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1105 ;; space-efficient by splitting strings word-wise and replacing them |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1106 ;; with lists of symbols interned in a private obarray, e.g. |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1107 ;; "LATIN SMALL LETTER A" => '(LATIN SMALL LETTER A). |
89483 | 1108 |
1109 ;;;###autoload | |
88818
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1110 (defun unicode-data (char) |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1111 "Return a list of Unicode data for unicode CHAR. |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1112 Each element is a list of a property description and the property value. |
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1113 The list is null if CHAR isn't found in `unicodedata-file'." |
89147 | 1114 (when unicodedata-file |
1115 (unless (file-exists-p unicodedata-file) | |
1116 (error "`unicodedata-file' %s not found" unicodedata-file)) | |
1117 (save-excursion | |
89276
500483434aa3
(unicode-data): Find unicodedata-file
Dave Love <fx@gnu.org>
parents:
89147
diff
changeset
|
1118 (set-buffer (find-file-noselect unicodedata-file nil t)) |
89147 | 1119 (goto-char (point-min)) |
1120 (let ((hex (format "%04X" char)) | |
1121 found first last) | |
1122 (if (re-search-forward (concat "^" hex) nil t) | |
1123 (setq found t) | |
1124 ;; It's not listed explicitly. Look for ranges, e.g. CJK | |
1125 ;; ideographs, and check whether it's in one of them. | |
1126 (while (and (re-search-forward "^\\([^;]+\\);[^;]+First>;" nil t) | |
1127 (>= char (setq first | |
1128 (string-to-number (match-string 1) 16))) | |
1129 (progn | |
1130 (forward-line 1) | |
1131 (looking-at "^\\([^;]+\\);[^;]+Last>;") | |
1132 (> char | |
1133 (setq last | |
1134 (string-to-number (match-string 1) 16)))))) | |
1135 (if (and (>= char first) | |
1136 (<= char last)) | |
1137 (setq found t))) | |
1138 (if found | |
1139 (let ((fields (mapcar (lambda (elt) | |
1140 (if (> (length elt) 0) | |
1141 elt)) | |
1142 (cdr (split-string | |
1143 (buffer-substring | |
1144 (line-beginning-position) | |
1145 (line-end-position)) | |
1146 ";"))))) | |
1147 ;; The length depends on whether the last field was empty. | |
1148 (unless (or (= 13 (length fields)) | |
1149 (= 14 (length fields))) | |
1150 (error "Invalid contents in %s" unicodedata-file)) | |
1151 ;; The field names and values lists are slightly | |
1152 ;; modified from Mule-UCS unidata.el. | |
1153 (list | |
1154 (list "Name" (let ((name (nth 0 fields))) | |
1155 ;; Check for <..., First>, <..., Last> | |
1156 (if (string-match "\\`\\(<[^,]+\\)," name) | |
1157 (concat (match-string 1 name) ">") | |
1158 name))) | |
1159 (list "Category" | |
1160 (cdr (assoc | |
1161 (nth 1 fields) | |
1162 '(("Lu" . "uppercase letter") | |
1163 ("Ll" . "lowercase letter") | |
1164 ("Lt" . "titlecase letter") | |
1165 ("Mn" . "non-spacing mark") | |
1166 ("Mc" . "spacing-combining mark") | |
1167 ("Me" . "enclosing mark") | |
1168 ("Nd" . "decimal digit") | |
1169 ("Nl" . "letter number") | |
1170 ("No" . "other number") | |
1171 ("Zs" . "space separator") | |
1172 ("Zl" . "line separator") | |
1173 ("Zp" . "paragraph separator") | |
1174 ("Cc" . "other control") | |
1175 ("Cf" . "other format") | |
1176 ("Cs" . "surrogate") | |
1177 ("Co" . "private use") | |
1178 ("Cn" . "not assigned") | |
1179 ("Lm" . "modifier letter") | |
1180 ("Lo" . "other letter") | |
1181 ("Pc" . "connector punctuation") | |
1182 ("Pd" . "dash punctuation") | |
1183 ("Ps" . "open punctuation") | |
1184 ("Pe" . "close punctuation") | |
1185 ("Pi" . "initial-quotation punctuation") | |
1186 ("Pf" . "final-quotation punctuation") | |
1187 ("Po" . "other punctuation") | |
1188 ("Sm" . "math symbol") | |
1189 ("Sc" . "currency symbol") | |
1190 ("Sk" . "modifier symbol") | |
1191 ("So" . "other symbol"))))) | |
1192 (list "Combining class" | |
1193 (cdr (assoc | |
1194 (string-to-number (nth 2 fields)) | |
1195 '((0 . "Spacing") | |
1196 (1 . "Overlays and interior") | |
1197 (7 . "Nuktas") | |
1198 (8 . "Hiragana/Katakana voicing marks") | |
1199 (9 . "Viramas") | |
1200 (10 . "Start of fixed position classes") | |
1201 (199 . "End of fixed position classes") | |
1202 (200 . "Below left attached") | |
1203 (202 . "Below attached") | |
1204 (204 . "Below right attached") | |
1205 (208 . "Left attached (reordrant around \ | |
88818
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1206 single base character)") |
89147 | 1207 (210 . "Right attached") |
1208 (212 . "Above left attached") | |
1209 (214 . "Above attached") | |
1210 (216 . "Above right attached") | |
1211 (218 . "Below left") | |
1212 (220 . "Below") | |
1213 (222 . "Below right") | |
1214 (224 . "Left (reordrant around single base \ | |
88818
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1215 character)") |
89147 | 1216 (226 . "Right") |
1217 (228 . "Above left") | |
1218 (230 . "Above") | |
1219 (232 . "Above right") | |
1220 (233 . "Double below") | |
1221 (234 . "Double above") | |
1222 (240 . "Below (iota subscript)"))))) | |
1223 (list "Bidi category" | |
1224 (cdr (assoc | |
1225 (nth 3 fields) | |
1226 '(("L" . "Left-to-Right") | |
1227 ("LRE" . "Left-to-Right Embedding") | |
1228 ("LRO" . "Left-to-Right Override") | |
1229 ("R" . "Right-to-Left") | |
1230 ("AL" . "Right-to-Left Arabic") | |
1231 ("RLE" . "Right-to-Left Embedding") | |
1232 ("RLO" . "Right-to-Left Override") | |
1233 ("PDF" . "Pop Directional Format") | |
1234 ("EN" . "European Number") | |
1235 ("ES" . "European Number Separator") | |
1236 ("ET" . "European Number Terminator") | |
1237 ("AN" . "Arabic Number") | |
1238 ("CS" . "Common Number Separator") | |
1239 ("NSM" . "Non-Spacing Mark") | |
1240 ("BN" . "Boundary Neutral") | |
1241 ("B" . "Paragraph Separator") | |
1242 ("S" . "Segment Separator") | |
1243 ("WS" . "Whitespace") | |
1244 ("ON" . "Other Neutrals"))))) | |
1245 (list "Decomposition" | |
1246 (if (nth 4 fields) | |
1247 (let* ((parts (split-string (nth 4 fields))) | |
1248 (info (car parts))) | |
1249 (if (string-match "\\`<\\(.+\\)>\\'" info) | |
1250 (setq info (match-string 1 info)) | |
1251 (setq info nil)) | |
1252 (if info (setq parts (cdr parts))) | |
1253 (setq parts (mapconcat | |
1254 (lambda (arg) | |
1255 (string (string-to-number arg 16))) | |
1256 parts " ")) | |
1257 (concat info parts)))) | |
1258 (list "Decimal digit value" | |
89315 | 1259 (nth 5 fields)) |
89147 | 1260 (list "Digit value" |
89315 | 1261 (nth 6 fields)) |
89147 | 1262 (list "Numeric value" |
89315 | 1263 (nth 7 fields)) |
89147 | 1264 (list "Mirrored" |
1265 (if (equal "Y" (nth 8 fields)) | |
1266 "yes")) | |
1267 (list "Old name" (nth 9 fields)) | |
1268 (list "ISO 10646 comment" (nth 10 fields)) | |
1269 (list "Uppercase" (and (nth 11 fields) | |
1270 (string (string-to-number | |
1271 (nth 11 fields) 16)))) | |
1272 (list "Lowercase" (and (nth 12 fields) | |
1273 (string (string-to-number | |
1274 (nth 12 fields) 16)))) | |
1275 (list "Titlecase" (and (nth 13 fields) | |
1276 (string (string-to-number | |
1277 (nth 13 fields) 16))))))))))) | |
88818
9ae3a7ed0b93
(describe-char-after): Modify display
Dave Love <fx@gnu.org>
parents:
88705
diff
changeset
|
1278 |
48050 | 1279 (provide 'mule-diag) |
1280 | |
89412 | 1281 ;; Local Variables: |
1282 ;; coding: utf-8 | |
1283 ;; End: | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
1284 ;;; mule-diag.el ends here |