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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6 ;; Keywords: multilingual, charset, coding system, fontset, diagnosis
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
23 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;;; General utility function
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27 ;; Print all arguments with single space separator in one line.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 (defun print-list (&rest args)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 (setq args (cdr args)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 (princ (car args))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 (princ "\n"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;;; CHARSET
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
75 #########################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
76 ## LIST OF CHARSETS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
77 ## Each line corresponds to one charset.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78 ## The following attributes are listed in this order
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81 ## CHARSET-SYMBOL-NAME,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82 ## DIMENSION (1 or 2)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83 ## CHARS (94 or 96)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84 ## BYTES (of multibyte form: 1, 2, 3, or 4),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
85 ## WIDTH (occupied column numbers: 1 or 2),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
86 ## DIRECTION (0:left-to-right, 1:right-to-left),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
87 ## ISO-FINAL-CHAR (character code of ISO-2022's final character)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88 ## ISO-GRAPHIC-PLANE (ISO-2022's graphic plane, 0:GL, 1:GR)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
89 ## DESCRIPTION (describing string of the charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
106
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107 ;;; CODING-SYSTEM
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
109 ;; Print information of designation of each graphic register in FLAGS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110 ;; in human readable format. See the documentation of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
111 ;; `make-coding-system' for the meaning of FLAGS.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
112 (defun print-designation (flags)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113 (let ((graphic-register 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115 (while (< graphic-register 4)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
116 (setq charset (aref flags graphic-register))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
117 (princ (format
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
118 " G%d -- %s\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
119 graphic-register
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 (cond ((null charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 "never used")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 ((eq charset t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 "no initial designation, and used by any charsets")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
124 ((symbolp charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 (format "%s:%s"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126 charset (charset-description charset)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127 ((listp charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128 (if (charsetp (car charset))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 (format "%s:%s, and also used by the followings:"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 (car charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131 (charset-description (car charset)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132 "no initial designation, and used by the followings:"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 (t
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147 (setq graphic-register (1+ graphic-register)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150 (defun describe-coding-system (coding-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 buffer-file-coding-system (of the current buffer)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217 process-coding-system for read (of the current buffer, if any)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218 eol-type of process-coding-system for read (of the current buffer, if any)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
219 process-coding-system for write (of the current buffer, if any)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 (interactive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 (let* ((proc (get-buffer-process (current-buffer)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 (process-coding-systems (if proc (process-coding-system proc))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
248 )))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 (defun describe-current-coding-system ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 "Display coding systems currently used in a detailed format."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271 (interactive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 (with-output-to-temp-buffer "*Help*"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
273 (let* ((proc (get-buffer-process (current-buffer)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
443 #########################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
444 ## LIST OF CODING SYSTEMS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
445 ## Each line corresponds to one coding system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
454 ## EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
455 ## FLAGS =
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456 ## if TYPE = 2 then
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457 ## comma (`,') separated data of the followings:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458 ## G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
459 ## LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
460 ## else if TYPE = 4 then
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
461 ## comma (`,') separated CCL programs for read and write
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462 ## else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481 ############################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482 ## LIST OF CODING CATEGORIES (ordered by priority)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483 ## CATEGORY:CODING-SYSTEM
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 ##
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
490
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491 ;;; FONT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
492
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493 ;; Print information of a font in FONTINFO.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
494 (defun describe-font-internal (font-info &optional verbose)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
495 (print-list "name (opened by):" (aref font-info 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
496 (print-list " full name:" (aref font-info 1))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
497 (let ((charset (aref font-info 2)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498 (print-list " charset:"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499 (format "%s (%s)" charset (charset-description charset))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 (print-list " size:" (format "%d" (aref font-info 3)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
501 (print-list " height:" (format "%d" (aref font-info 4)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
502 (print-list " baseline-offset:" (format "%d" (aref font-info 5)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
503 (print-list "relative-compose:" (format "%d" (aref font-info 6))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
504
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
505 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
506 (defun describe-font (fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
507 "Display information about fonts which partially match FONTNAME."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
508 (interactive "sFontname: ")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
509 (or window-system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
510 (error "No window system being used"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
511 (let ((font-info (font-info fontname)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
512 (if (null font-info)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
513 (message "No matching font")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
514 (with-output-to-temp-buffer "*Help*"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
515 (describe-font-internal font-info 'verbose)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
564
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
565 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585 (interactive
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586 (if (not window-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
652
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
653 ;;; DIAGNOSIS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
659 "########################################\n\n"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
660
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
661 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
673 (insert "\t###############################\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
674 "\t### Diagnosis of your Emacs ###\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
675 "\t###############################\n\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
676 "CONTENTS: Section 1. General Information\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
677 " Section 2. Display\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
678 " Section 3. Input methods\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
683 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
684
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
685 (insert-section 1 "General Information")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
686 (insert "Version of this emacs:\n " (emacs-version) "\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
687 "Primary language:\n " primary-language "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
688
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
689 (insert-section 2 "Display")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
690 (if window-system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
691 (insert "Window-system: "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
692 (symbol-name window-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
693 (format "%s" window-system-version))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
694 (insert "Terminal: " (getenv "TERM")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
695 (insert "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
696
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
697 (if (eq window-system 'x)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
698 (let ((font (cdr (assq 'font (frame-parameters)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
699 (insert "The selected frame is using the "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
700 (if (query-fontset font) "fontset" "font")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
701 ":\n\t" font))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
702 (insert "Coding system of the terminal: "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
703 (symbol-name (terminal-coding-system))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
704 (insert "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
705
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
709 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
713
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
731
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
732
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
733 ;;; DUMP DATA FILE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
734
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
735 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
757
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
758 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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