Mercurial > emacs
annotate lisp/international/mule-diag.el @ 18595:14f25d37d137
Some files are in different directories.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 04 Jul 1997 04:59:58 +0000 |
parents | 20369fbd0f91 |
children | c9b94c6ab8f1 |
rev | line source |
---|---|
17315
a3ca5e15c82a
Fix the format of the first line.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1 ;;; mule-diag.el --- Show diagnosis of multilingual environment (MULE) |
17052 | 2 |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
18377
8b4a66c66dd6
Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
18300
diff
changeset
|
4 ;; Licensed to the Free Software Foundation. |
17052 | 5 |
6 ;; Keywords: multilingual, charset, coding system, fontset, diagnosis | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
17071 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
17052 | 24 |
25 ;;; General utility function | |
26 | |
27 ;; Print all arguments with single space separator in one line. | |
28 (defun print-list (&rest args) | |
29 (while (cdr args) | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
30 (when (car args) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
31 (princ (car args)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
32 (princ " ")) |
17052 | 33 (setq args (cdr args))) |
34 (princ (car args)) | |
35 (princ "\n")) | |
36 | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
37 ;; Re-order the elements of charset-list. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
38 (defun sort-charset-list () |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
39 (setq charset-list |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
40 (sort charset-list |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
41 (function (lambda (x y) (< (charset-id x) (charset-id y))))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
42 |
17052 | 43 ;;; CHARSET |
44 | |
45 ;;;###autoload | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
46 (defun list-character-sets (&optional arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
47 "Display a list of all character sets. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
48 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
49 The ID column contains a charset identification number for internal use. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
50 The B column contains a number of bytes occupied in a buffer. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
51 The W column contains a number of columns occupied in a screen. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
52 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
53 With prefix arg, the output format gets more cryptic |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
54 but contains full information about each character sets." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
55 (interactive "P") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
56 (sort-charset-list) |
17052 | 57 (with-output-to-temp-buffer "*Help*" |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
58 (save-excursion |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
59 (set-buffer standard-output) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
60 (let ((l charset-list) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
61 charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
62 (if (null arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
63 (progn |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
64 (insert "ID Name B W Description\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
65 (insert "-- ---- - - -----------\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
66 (while l |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
67 (setq charset (car l) l (cdr l)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
68 (insert (format "%03d %s" (charset-id charset) charset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
69 (indent-to 28) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
70 (insert (format "%d %d %s\n" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
71 (charset-bytes charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
72 (charset-width charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
73 (charset-description charset))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
74 (insert "\ |
17052 | 75 ######################### |
76 ## LIST OF CHARSETS | |
77 ## Each line corresponds to one charset. | |
78 ## The following attributes are listed in this order | |
79 ## separated by a colon `:' in one line. | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
80 ## CHARSET-ID, |
17052 | 81 ## CHARSET-SYMBOL-NAME, |
82 ## DIMENSION (1 or 2) | |
83 ## CHARS (94 or 96) | |
84 ## BYTES (of multibyte form: 1, 2, 3, or 4), | |
85 ## WIDTH (occupied column numbers: 1 or 2), | |
86 ## DIRECTION (0:left-to-right, 1:right-to-left), | |
87 ## ISO-FINAL-CHAR (character code of ISO-2022's final character) | |
88 ## ISO-GRAPHIC-PLANE (ISO-2022's graphic plane, 0:GL, 1:GR) | |
89 ## DESCRIPTION (describing string of the charset) | |
90 ") | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
91 (while l |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
92 (setq charset (car l) l (cdr l)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
93 (princ (format "%03d:%s:%d:%d:%d:%d:%d:%d:%d:%s\n" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
94 (charset-id charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
95 charset |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
96 (charset-dimension charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
97 (charset-chars charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
98 (charset-bytes charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
99 (charset-width charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
100 (charset-direction charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
101 (charset-iso-final-char charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
102 (charset-iso-graphic-plane charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
103 (charset-description charset)))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
104 (help-mode) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
105 (setq truncate-lines t)))) |
17052 | 106 |
107 ;;; CODING-SYSTEM | |
108 | |
109 ;; Print information of designation of each graphic register in FLAGS | |
110 ;; in human readable format. See the documentation of | |
111 ;; `make-coding-system' for the meaning of FLAGS. | |
112 (defun print-designation (flags) | |
113 (let ((graphic-register 0) | |
114 charset) | |
115 (while (< graphic-register 4) | |
116 (setq charset (aref flags graphic-register)) | |
117 (princ (format | |
118 " G%d -- %s\n" | |
119 graphic-register | |
120 (cond ((null charset) | |
121 "never used") | |
122 ((eq charset t) | |
123 "no initial designation, and used by any charsets") | |
124 ((symbolp charset) | |
125 (format "%s:%s" | |
126 charset (charset-description charset))) | |
127 ((listp charset) | |
128 (if (charsetp (car charset)) | |
129 (format "%s:%s, and also used by the followings:" | |
130 (car charset) | |
131 (charset-description (car charset))) | |
132 "no initial designation, and used by the followings:")) | |
133 (t | |
134 "invalid designation information")))) | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
135 (when (listp charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
136 (setq charset (cdr charset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
137 (while charset |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
138 (cond ((eq (car charset) t) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
139 (princ "\tany other charsets\n")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
140 ((charsetp (car charset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
141 (princ (format "\t%s:%s\n" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
142 (car charset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
143 (charset-description (car charset))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
144 (t |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
145 "invalid designation information")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
146 (setq charset (cdr charset)))) |
17052 | 147 (setq graphic-register (1+ graphic-register))))) |
148 | |
149 ;;;###autoload | |
150 (defun describe-coding-system (coding-system) | |
151 "Display information of CODING-SYSTEM." | |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
152 (interactive "zDescribe coding system (default, current choices): ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
153 (if (null coding-system) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
154 (describe-current-coding-system) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
155 (with-output-to-temp-buffer "*Help*" |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
156 (print-coding-system-briefly coding-system 'doc-string) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
157 (let ((coding-spec (coding-system-spec coding-system))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
158 (princ "Type: ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
159 (let ((type (coding-system-type coding-system)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
160 (flags (coding-system-flags coding-system))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
161 (princ type) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
162 (cond ((eq type nil) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
163 (princ " (do no conversion)")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
164 ((eq type t) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
165 (princ " (do automatic conversion)")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
166 ((eq type 0) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
167 (princ " (Emacs internal multibyte form)")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
168 ((eq type 1) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
169 (princ " (Shift-JIS, MS-KANJI)")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
170 ((eq type 2) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
171 (princ " (variant of ISO-2022)\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
172 (princ "Initial designations:\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
173 (print-designation flags) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
174 (princ "Other Form: \n ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
175 (princ (if (aref flags 4) "short-form" "long-form")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
176 (if (aref flags 5) (princ ", ASCII@EOL")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
177 (if (aref flags 6) (princ ", ASCII@CNTL")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
178 (princ (if (aref flags 7) ", 7-bit" ", 8-bit")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
179 (if (aref flags 8) (princ ", use-locking-shift")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
180 (if (aref flags 9) (princ ", use-single-shift")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
181 (if (aref flags 10) (princ ", use-roman")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
182 (if (aref flags 10) (princ ", use-old-jis")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
183 (if (aref flags 11) (princ ", no-ISO6429")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
184 (princ ".")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
185 ((eq type 3) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
186 (princ " (Big5)")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
187 ((eq type 4) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
188 (princ " (do conversion by CCL program)")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
189 (t (princ "invalid coding-system.")))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
190 (princ "\nEOL type:\n ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
191 (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
|
192 (cond ((vectorp eol-type) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
193 (princ "Automatic selection from:\n\t") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
194 (princ eol-type) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
195 (princ "\n")) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
196 ((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
|
197 ((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
|
198 ((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
|
199 (t (princ "invalid\n"))))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
200 (save-excursion |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
201 (set-buffer standard-output) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
202 (help-mode))))) |
17052 | 203 |
204 ;;;###autoload | |
205 (defun describe-current-coding-system-briefly () | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
206 "Display coding systems currently used in a brief format in echo area. |
17052 | 207 |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
208 The format is \"F[..],K[..],T[..],P>[..],P<[..], default F[..],P<[..],P<[..]\", |
17052 | 209 where mnemonics of the following coding systems come in this order |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
210 at the place of `..': |
17052 | 211 buffer-file-coding-system (of the current buffer) |
212 eol-type of buffer-file-coding-system (of the current buffer) | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
213 (keyboard-coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
214 eol-type of (keyboard-coding-system) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
215 (terminal-coding-system) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
216 eol-type of (terminal-coding-system) |
17052 | 217 process-coding-system for read (of the current buffer, if any) |
218 eol-type of process-coding-system for read (of the current buffer, if any) | |
219 process-coding-system for write (of the current buffer, if any) | |
220 eol-type of process-coding-system for write (of the current buffer, if any) | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
221 default-buffer-file-coding-system |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
222 eol-type of default-buffer-file-coding-system |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
223 default-process-coding-system for read |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
224 eol-type of default-process-coding-system for read |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
225 default-process-coding-system for write |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
226 eol-type of default-process-coding-system" |
17052 | 227 (interactive) |
228 (let* ((proc (get-buffer-process (current-buffer))) | |
229 (process-coding-systems (if proc (process-coding-system proc)))) | |
230 (message | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
231 "F[%c%c],K[%c%c],T[%c%c],P>[%c%c],P<[%c%c], default F[%c%c],P>[%c%c],P<[%c%c]" |
17052 | 232 (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
|
233 (coding-system-eol-type-mnemonic buffer-file-coding-system) |
17052 | 234 (coding-system-mnemonic (keyboard-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
235 (coding-system-eol-type-mnemonic (keyboard-coding-system)) |
17052 | 236 (coding-system-mnemonic (terminal-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
237 (coding-system-eol-type-mnemonic (terminal-coding-system)) |
17052 | 238 (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
|
239 (coding-system-eol-type-mnemonic (car process-coding-systems)) |
17052 | 240 (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
|
241 (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
|
242 (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
|
243 (coding-system-eol-type-mnemonic default-buffer-file-coding-system) |
17052 | 244 (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
|
245 (coding-system-eol-type-mnemonic (car default-process-coding-system)) |
17052 | 246 (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
|
247 (coding-system-eol-type-mnemonic (cdr default-process-coding-system)) |
17052 | 248 ))) |
249 | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
250 ;; Print symbol name and mnemonic letter of CODING-SYSTEM by `princ'. |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
251 (defun print-coding-system-briefly (coding-system &optional doc-string) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
252 (if (not coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
253 (princ "nil\n") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
254 (princ (format "%c -- %s" |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
255 (coding-system-mnemonic coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
256 coding-system)) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
257 (let ((parent (coding-system-parent coding-system))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
258 (if parent |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
259 (princ (format " (alias of %s)" parent)))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
260 (let ((aliases (get coding-system 'alias-coding-systems))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
261 (if aliases |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
262 (princ (format " %S" (cons 'alias: aliases))))) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
263 (princ "\n") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
264 (if (and doc-string |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
265 (setq doc-string (coding-system-doc-string coding-system))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
266 (princ (format " %s\n" doc-string))))) |
17052 | 267 |
268 ;;;###autoload | |
269 (defun describe-current-coding-system () | |
270 "Display coding systems currently used in a detailed format." | |
271 (interactive) | |
272 (with-output-to-temp-buffer "*Help*" | |
273 (let* ((proc (get-buffer-process (current-buffer))) | |
274 (process-coding-systems (if proc (process-coding-system proc)))) | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
275 (princ "Current buffer file: buffer-file-coding-system\n ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
276 (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
|
277 (print-coding-system-briefly buffer-file-coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
278 (princ "Not set locally, use the following default.\n")) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
279 (princ "Default buffer file: default-buffer-file-coding-system\n ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
280 (print-coding-system-briefly default-buffer-file-coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
281 (princ "Keyboard: (keyboard-coding-system)\n ") |
17052 | 282 (print-coding-system-briefly (keyboard-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
283 (princ "Terminal: (display-coding-system)\n ") |
17052 | 284 (print-coding-system-briefly (terminal-coding-system)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
285 (princ "Current buffer process: (process-coding-system)\n") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
286 (if (not process-coding-systems) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
287 (princ " No process.\n") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
288 (princ " decoding: ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
289 (print-coding-system-briefly (car process-coding-systems)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
290 (princ " encoding: ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
291 (print-coding-system-briefly (cdr process-coding-systems))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
292 (princ "Default process: default-process-coding-system\n") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
293 (princ " decoding: ") |
17052 | 294 (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
|
295 (princ " encoding: ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
296 (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
|
297 |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
298 (save-excursion |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
299 (set-buffer standard-output) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
300 |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
301 (princ "\nPriority order of coding systems:\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
302 (let ((l coding-category-list) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
303 (i 1) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
304 coding aliases) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
305 (while l |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
306 (setq coding (symbol-value (car l))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
307 (princ (format " %d. %s" i coding)) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
308 (when (setq aliases (get coding 'alias-coding-systems)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
309 (princ " ") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
310 (princ (cons 'alias: aliases))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
311 (terpri) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
312 (setq l (cdr l) i (1+ i)))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
313 (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
|
314 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
|
315 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
|
316 |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
317 (let ((categories '(coding-category-iso-7 coding-category-iso-else)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
318 coding-system codings) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
319 (while categories |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
320 (setq coding-system (symbol-value (car categories))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
321 (mapcar |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
322 (function |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
323 (lambda (x) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
324 (if (and (not (eq x coding-system)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
325 (get x 'no-initial-designation) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
326 (let ((flags (coding-system-flags x))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
327 (not (or (aref flags 10) (aref flags 11))))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
328 (setq codings (cons x codings))))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
329 (get (car categories) 'coding-systems)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
330 (if codings |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
331 (let ((max-col (frame-width)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
332 pos) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
333 (princ (format " The followings are decoded correctly but recognized as %s:\n " coding-system)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
334 (while codings |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
335 (setq pos (point)) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
336 (insert (format " %s" (car codings))) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
337 (when (> (current-column) max-col) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
338 (goto-char pos) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
339 (insert "\n ") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
340 (goto-char (point-max))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
341 (setq codings (cdr codings))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
342 (insert "\n\n"))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
343 (setq categories (cdr categories)))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
344 |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
345 (princ "Look up tables for finding a coding system on I/O operations:\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
346 (terpri) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
347 (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
|
348 (princ " ---------\t--------------\t\t----------------\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
349 (let ((func (lambda (operation alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
350 (princ " ") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
351 (princ operation) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
352 (if (not alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
353 (princ "\tnothing specified\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
354 (while alist |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
355 (indent-to 16) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
356 (prin1 (car (car alist))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
357 (indent-to 40) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
358 (princ (cdr (car alist))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
359 (princ "\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
360 (setq alist (cdr alist))))))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
361 (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
|
362 (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
|
363 (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
|
364 (help-mode)))) |
17052 | 365 |
366 ;; Print detailed information on CODING-SYSTEM. | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
367 (defun print-coding-system (coding-system &optional aliases) |
17052 | 368 (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
|
369 (eol-type (coding-system-eol-type coding-system)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
370 (flags (coding-system-flags coding-system)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
371 (base (coding-system-base coding-system))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
372 (if (not (eq base coding-system)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
373 (princ (format "%s (alias of %s)\n" coding-system base)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
374 (princ coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
375 (while aliases |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
376 (princ ",") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
377 (princ (car aliases)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
378 (setq aliases (cdr aliases))) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
379 (princ (format ":%s:%c:%d:" |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
380 type |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
381 (coding-system-mnemonic coding-system) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
382 (if (integerp eol-type) eol-type 3))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
383 (cond ((eq type 2) ; ISO-2022 |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
384 (let ((idx 0) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
385 charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
386 (while (< idx 4) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
387 (setq charset (aref flags idx)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
388 (cond ((null charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
389 (princ -1)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
390 ((eq charset t) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
391 (princ -2)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
392 ((charsetp charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
393 (princ charset)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
394 ((listp charset) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
395 (princ "(") |
17052 | 396 (princ (car charset)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
397 (setq charset (cdr charset)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
398 (while charset |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
399 (princ ",") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
400 (princ (car charset)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
401 (setq charset (cdr charset))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
402 (princ ")"))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
403 (princ ",") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
404 (setq idx (1+ idx))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
405 (while (< idx 12) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
406 (princ (if (aref flags idx) 1 0)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
407 (princ ",") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
408 (setq idx (1+ idx))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
409 (princ (if (aref flags idx) 1 0)))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
410 ((eq type 4) ; CCL |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
411 (let (i len) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
412 (setq i 0 len (length (car flags))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
413 (while (< i len) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
414 (princ (format " %x" (aref (car flags) i))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
415 (setq i (1+ i))) |
17052 | 416 (princ ",") |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
417 (setq i 0 len (length (cdr flags))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
418 (while (< i len) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
419 (princ (format " %x" (aref (cdr flags) i))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
420 (setq i (1+ i))))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
421 (t (princ 0))) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
422 (princ ":") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
423 (princ (coding-system-doc-string coding-system)) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
424 (princ "\n")))) |
17052 | 425 |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
426 ;;;###autoload |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
427 (defun list-coding-systems (&optional arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
428 "Display a list of all coding systems. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
429 It prints mnemonic letter, name, and description of each coding systems. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
430 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
431 With prefix arg, the output format gets more cryptic, |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
432 but contains full information about each coding systems." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
433 (interactive "P") |
17052 | 434 (with-output-to-temp-buffer "*Help*" |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
435 (if (null arg) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
436 (princ "\ |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
437 ############################################### |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
438 # 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
|
439 # MNEMONIC-LETTER -- CODING-SYSTEM-NAME |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
440 # DOC-STRING |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
441 ") |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
442 (princ "\ |
17052 | 443 ######################### |
444 ## LIST OF CODING SYSTEMS | |
445 ## Each line corresponds to one coding system | |
446 ## Format of a line is: | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
447 ## 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
|
448 ## :PRE-WRITE-CONVERSION:DOC-STRING, |
17052 | 449 ## where |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
450 ## NAME = coding system name |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
451 ## ALIAS = alias of the coding system |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
452 ## 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
|
453 ## 0 (EMACS-MULE), 1 (SJIS), 2 (ISO2022), 3 (BIG5), or 4 (CCL) |
17052 | 454 ## EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection) |
455 ## FLAGS = | |
456 ## if TYPE = 2 then | |
457 ## comma (`,') separated data of the followings: | |
458 ## G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN, | |
459 ## LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429 | |
460 ## else if TYPE = 4 then | |
461 ## comma (`,') separated CCL programs for read and write | |
462 ## else | |
463 ## 0 | |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
464 ## POST-READ-CONVERSION, PRE-WRITE-CONVERSION = function name to be called |
17052 | 465 ## |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
466 ")) |
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
467 (let ((bases (coding-system-list 'base-only)) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
468 coding-system) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
469 (while bases |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
470 (setq coding-system (car bases)) |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
471 (if (interactive-p) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
472 (print-coding-system-briefly coding-system 'doc-string) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
473 (print-coding-system coding-system)) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
474 (setq bases (cdr bases)))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
475 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
476 ;;;###automatic |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
477 (defun list-coding-categories () |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
478 "Display a list of all coding categories." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
479 (with-output-to-temp-buffer "*Help*" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
480 (princ "\ |
17052 | 481 ############################ |
482 ## LIST OF CODING CATEGORIES (ordered by priority) | |
483 ## CATEGORY:CODING-SYSTEM | |
484 ## | |
485 ") | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
486 (let ((l coding-category-list)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
487 (while l |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
488 (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
|
489 (setq l (cdr l)))))) |
17052 | 490 |
491 ;;; FONT | |
492 | |
493 ;; Print information of a font in FONTINFO. | |
494 (defun describe-font-internal (font-info &optional verbose) | |
495 (print-list "name (opened by):" (aref font-info 0)) | |
496 (print-list " full name:" (aref font-info 1)) | |
497 (let ((charset (aref font-info 2))) | |
498 (print-list " charset:" | |
499 (format "%s (%s)" charset (charset-description charset)))) | |
500 (print-list " size:" (format "%d" (aref font-info 3))) | |
501 (print-list " height:" (format "%d" (aref font-info 4))) | |
502 (print-list " baseline-offset:" (format "%d" (aref font-info 5))) | |
503 (print-list "relative-compose:" (format "%d" (aref font-info 6)))) | |
504 | |
505 ;;;###autoload | |
506 (defun describe-font (fontname) | |
507 "Display information about fonts which partially match FONTNAME." | |
508 (interactive "sFontname: ") | |
509 (or window-system | |
510 (error "No window system being used")) | |
511 (let ((font-info (font-info fontname))) | |
512 (if (null font-info) | |
513 (message "No matching font") | |
514 (with-output-to-temp-buffer "*Help*" | |
515 (describe-font-internal font-info 'verbose))))) | |
516 | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
517 ;; Print information of FONTSET. If optional arg PRINT-FONTS is |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
518 ;; non-nil, print also names of all fonts in FONTSET. This function |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
519 ;; actually INSERT such information in the current buffer. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
520 (defun print-fontset (fontset &optional print-fonts) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
521 (let* ((fontset-info (fontset-info fontset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
522 (size (aref fontset-info 0)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
523 (height (aref fontset-info 1)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
524 (fonts (and print-fonts (aref fontset-info 2))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
525 (xlfd-fields (x-decompose-font-name fontset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
526 (weight (aref xlfd-fields xlfd-regexp-weight-subnum)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
527 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
528 style) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
529 (if (string-match "^bold$\\|^demibold$" weight) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
530 (setq style (concat weight " ")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
531 (setq style "medium ")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
532 (cond ((string-match "^i$" slant) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
533 (setq style (concat style "italic"))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
534 ((string-match "^o$" slant) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
535 (setq style (concat style "slant"))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
536 ((string-match "^ri$" slant) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
537 (setq style (concat style "reverse italic"))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
538 ((string-match "^ro$" slant) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
539 (setq style (concat style "reverse slant")))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
540 (beginning-of-line) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
541 (insert fontset) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
542 (indent-to 56) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
543 (insert (if (> size 0) (format "%dx%d" size height) " ?")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
544 (indent-to 62) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
545 (insert style "\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
546 (when print-fonts |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
547 (insert " O Charset / Fontname\n" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
548 " - -------\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
549 (sort-charset-list) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
550 (let ((l charset-list) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
551 charset font-info opened fontname) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
552 (while l |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
553 (setq charset (car l) l (cdr l)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
554 (setq font-info (assq charset fonts)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
555 (if (null font-info) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
556 (setq opened ?? fontname "not specified") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
557 (if (nth 2 font-info) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
558 (if (stringp (nth 2 font-info)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
559 (setq opened ?o fontname (nth 2 font-info)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
560 (setq opened ?- fontname (nth 1 font-info))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
561 (setq opened ?x fontname (nth 1 font-info)))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
562 (insert (format " %c %s\n %s\n" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
563 opened charset fontname))))))) |
17052 | 564 |
565 ;;;###autoload | |
566 (defun describe-fontset (fontset) | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
567 "Display information of FONTSET. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
568 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
569 It prints name, size, and style of FONTSET, and lists up fonts |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
570 contained in FONTSET. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
571 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
572 The format of Size column is WIDTHxHEIGHT, where WIDTH and HEIGHT is |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
573 the character sizes (pixels) of each fontset (i.e. those of ASCII font |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
574 in the fontset). The letter `?' in this column means that the |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
575 corresponding fontset is not yet used in any frame. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
576 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
577 The O column of each font contains one of the following letters. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
578 o -- the font already opened |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
579 - -- the font not yet opened |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
580 x -- the font can't be opened |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
581 ? -- no font specified in FONTSET |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
582 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
583 The Charset column of each font contains a name of character set |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
584 displayed by the font." |
17052 | 585 (interactive |
586 (if (not window-system) | |
587 (error "No window system being used") | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
588 (let ((fontset-list (mapcar '(lambda (x) (list x)) (fontset-list))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
589 (completion-ignore-case t)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
590 (list (completing-read |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
591 "Fontset (default, used by the current frame): " |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
592 fontset-list nil t))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
593 (if (= (length fontset) 0) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
594 (setq fontset (cdr (assq 'font (frame-parameters))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
595 (if (not (query-fontset fontset)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
596 (error "Current frame is using font, not fontset")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
597 (let ((fontset-info (fontset-info fontset))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
598 (with-output-to-temp-buffer "*Help*" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
599 (save-excursion |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
600 (set-buffer standard-output) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
601 (insert "Fontset-Name\t\t\t\t\t\tSize Style\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
602 (insert "------------\t\t\t\t\t\t---- -----\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
603 (print-fontset fontset t))))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
604 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
605 ;;;###autoload |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
606 (defun list-fontsets (arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
607 "Display a list of all fontsets. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
608 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
609 It prints name, size, and style of each fontset. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
610 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
611 The format of Size column is WIDTHxHEIGHT, where WIDHT and HEIGHT is |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
612 the character sizes (pixels) of each fontset (i.e. those of ASCII font |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
613 in the fontset). The letter `?' in this column means that the |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
614 corresponding fontset is not yet used in any frame. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
615 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
616 With prefix arg, it also lists up fonts contained in each fontset. |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
617 See the function `describe-fontset' for the format of the list." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
618 (interactive "P") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
619 (with-output-to-temp-buffer "*Help*" |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
620 (save-excursion |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
621 (set-buffer standard-output) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
622 (insert "Fontset-Name\t\t\t\t\t\tSize Style\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
623 (insert "------------\t\t\t\t\t\t---- -----\n") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
624 (let ((fontsets (fontset-list))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
625 (while fontsets |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
626 (print-fontset (car fontsets) arg) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
627 (setq fontsets (cdr fontsets))))))) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
628 |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
629 ;;;###autoload |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
630 (defun list-input-methods () |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
631 "Print information of all input methods." |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
632 (interactive) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
633 (with-output-to-temp-buffer "*Help*" |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
634 (princ "LANGUAGE\n NAME (`TITLE' in mode line)\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
635 (princ " SHORT-DESCRIPTION\n------------------------------\n") |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
636 (setq input-method-alist |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
637 (sort input-method-alist |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
638 (function (lambda (x y) (string< (nth 1 x) (nth 1 y)))))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
639 (let ((l input-method-alist) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
640 language elt) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
641 (while l |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
642 (setq elt (car l) l (cdr l)) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
643 (when (not (equal language (nth 1 elt))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
644 (setq language (nth 1 elt)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
645 (princ language) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
646 (terpri)) |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
647 (princ (format " %s (`%s' in mode line)\n %s\n" |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
648 (car elt) (nth 3 elt) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
649 (let ((title (nth 4 elt))) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
650 (string-match ".*" title) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
651 (match-string 0 title)))))))) |
17052 | 652 |
653 ;;; DIAGNOSIS | |
654 | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
655 ;; 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
|
656 (defun insert-section (section-number title) |
17052 | 657 (insert "########################################\n" |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
658 "# Section " (format "%d" section-number) ". " title "\n" |
17052 | 659 "########################################\n\n")) |
660 | |
661 ;;;###autoload | |
662 (defun mule-diag () | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
663 "Display diagnosis of the multilingual environment (MULE). |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
664 |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
665 It prints various information related to the current multilingual |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
666 environment, including lists of input methods, coding systems, |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
667 character sets, and fontsets (if Emacs running under some window |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
668 system)." |
17052 | 669 (interactive) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
670 (with-output-to-temp-buffer "*Mule-Diagnosis*" |
17052 | 671 (save-excursion |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
672 (set-buffer standard-output) |
17052 | 673 (insert "\t###############################\n" |
674 "\t### Diagnosis of your Emacs ###\n" | |
675 "\t###############################\n\n" | |
676 "CONTENTS: Section 1. General Information\n" | |
677 " Section 2. Display\n" | |
678 " Section 3. Input methods\n" | |
679 " Section 4. Coding systems\n" | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
680 " Section 5. Character sets\n") |
17052 | 681 (if window-system |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
682 (insert " Section 6. Fontsets\n")) |
17052 | 683 (insert "\n") |
684 | |
685 (insert-section 1 "General Information") | |
686 (insert "Version of this emacs:\n " (emacs-version) "\n" | |
687 "Primary language:\n " primary-language "\n\n") | |
688 | |
689 (insert-section 2 "Display") | |
690 (if window-system | |
691 (insert "Window-system: " | |
692 (symbol-name window-system) | |
693 (format "%s" window-system-version)) | |
694 (insert "Terminal: " (getenv "TERM"))) | |
695 (insert "\n\n") | |
696 | |
697 (if (eq window-system 'x) | |
698 (let ((font (cdr (assq 'font (frame-parameters))))) | |
699 (insert "The selected frame is using the " | |
700 (if (query-fontset font) "fontset" "font") | |
701 ":\n\t" font)) | |
702 (insert "Coding system of the terminal: " | |
703 (symbol-name (terminal-coding-system)))) | |
704 (insert "\n\n") | |
705 | |
706 (insert-section 3 "Input methods") | |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
707 (save-excursion (list-input-methods)) |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
708 (insert-buffer-substring "*Help*") |
17052 | 709 (insert "\n") |
710 (if default-input-method | |
18300
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
711 (insert "Default input method: %s\n" default-input-method) |
0436624abece
(list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents:
18199
diff
changeset
|
712 (insert "No default input method is specified.\n")) |
17052 | 713 |
714 (insert-section 4 "Coding systems") | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
715 (save-excursion (list-coding-systems t)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
716 (insert-buffer-substring "*Help*") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
717 (list-coding-categories) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
718 (insert-buffer-substring "*Help*") |
17052 | 719 (insert "\n") |
720 | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
721 (insert-section 5 "Character sets") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
722 (list-character-sets t) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
723 (insert-buffer-substring "*Help*") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
724 (insert "\n") |
17052 | 725 |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
726 (when window-system |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
727 (insert-section 6 "Fontsets") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
728 (list-fontsets t) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
729 (insert-buffer-substring "*Help*")) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
730 (help-mode)))) |
17052 | 731 |
732 | |
733 ;;; DUMP DATA FILE | |
734 | |
735 ;;;###autoload | |
736 (defun dump-charsets () | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
737 "Dump information of all charsets into the file \"CHARSETS\". |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
738 The file is saved in the directory `data-directory'." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
739 (let ((file (expand-file-name "CHARSETS" data-directory)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
740 buf) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
741 (or (file-writable-p file) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
742 (error "Can't write to file %s" file)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
743 (setq buf (find-file-noselect file)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
744 (save-window-excursion |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
745 (save-excursion |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
746 (set-buffer buf) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
747 (setq buffer-read-only nil) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
748 (erase-buffer) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
749 (list-character-sets t) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
750 (insert-buffer-substring "*Help*") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
751 (let (make-backup-files |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
752 coding-system-for-write) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
753 (save-buffer)))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
754 (kill-buffer buf)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
755 (if noninteractive |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
756 (kill-emacs))) |
17052 | 757 |
758 ;;;###autoload | |
759 (defun dump-codings () | |
18559
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
760 "Dump information of all coding systems into the file \"CODINGS\". |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
761 The file is saved in the directory `data-directory'." |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
762 (let ((file (expand-file-name "CODINGS" data-directory)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
763 buf) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
764 (or (file-writable-p file) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
765 (error "Can't write to file %s" file)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
766 (setq buf (find-file-noselect file)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
767 (save-window-excursion |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
768 (save-excursion |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
769 (set-buffer buf) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
770 (setq buffer-read-only nil) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
771 (erase-buffer) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
772 (list-coding-systems t) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
773 (insert-buffer-substring "*Help*") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
774 (list-coding-categories) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
775 (insert-buffer-substring "*Help*") |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
776 (let (make-backup-files |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
777 coding-system-for-write) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
778 (save-buffer)))) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
779 (kill-buffer buf)) |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
780 (if noninteractive |
20369fbd0f91
(print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
781 (kill-emacs))) |
17052 | 782 |
18199
15177bdb2fcf
(describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
783 ;;; mule-diag.el ends here |