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