annotate lisp/international/mule-diag.el @ 20794:13d0a6194de7

(DECODE_SJIS_BIG5_CHARACTER): Don't have to increase coding->produced_char here. (code_convert_region): Initialize LEN_BYTE correctly.
author Kenichi Handa <handa@m17n.org>
date Wed, 28 Jan 1998 12:37:25 +0000
parents 9fba656001e8
children ea652c41eec6
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)"))
19876
d3df40315378 (describe-coding-system): Describe coding systems of type 5, raw-text.
Richard M. Stallman <rms@gnu.org>
parents: 19657
diff changeset
189 ((eq type 5)
d3df40315378 (describe-coding-system): Describe coding systems of type 5, raw-text.
Richard M. Stallman <rms@gnu.org>
parents: 19657
diff changeset
190 (princ " (text with random binary characters)"))
d3df40315378 (describe-coding-system): Describe coding systems of type 5, raw-text.
Richard M. Stallman <rms@gnu.org>
parents: 19657
diff changeset
191 (t (princ ": invalid coding-system."))))
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
192 (princ "\nEOL type: ")
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
193 (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
194 (cond ((vectorp eol-type)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
195 (princ "Automatic selection from:\n\t")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
196 (princ eol-type)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
197 (princ "\n"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
198 ((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
199 ((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
200 ((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
201 (t (princ "invalid\n")))))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
202 (let ((postread (coding-system-get coding-system 'post-read-conversion)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
203 (when postread
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
204 (princ "After decoding a text normally,")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
205 (princ " perform post-conversion by the function: ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
206 (princ "\n ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
207 (princ postread)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
208 (princ "\n")))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
209 (let ((prewrite (coding-system-get coding-system 'pre-write-conversion)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
210 (when prewrite
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
211 (princ "Before encoding a text normally,")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
212 (princ " perform pre-conversion by the function: ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
213 (princ "\n ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
214 (princ prewrite)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
215 (princ "\n")))
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
216 (let ((charsets (coding-system-get coding-system 'safe-charsets)))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
217 (when charsets
20731
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
218 (if (eq charsets t)
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
219 (princ "This coding system can encode charsets:\n")
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
220 (princ "This coding system encode the following charsets:\n")
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
221 (princ " ")
20731
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
222 (while charsets
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
223 (princ " ")
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
224 (princ (car charsets))
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
225 (setq charsets (cdr charsets))))))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
226 (save-excursion
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
227 (set-buffer standard-output)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
228 (help-mode)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 (defun describe-current-coding-system-briefly ()
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
232 "Display coding systems currently used in a brief format in echo area.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
234 The format is \"F[..],K[..],T[..],P>[..],P<[..], default F[..],P<[..],P<[..]\",
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 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
236 at the place of `..':
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 buffer-file-coding-system (of the current buffer)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238 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
239 (keyboard-coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
240 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
241 (terminal-coding-system)
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
242 eol-type of (terminal-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 process-coding-system for read (of the current buffer, if any)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 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
245 process-coding-system for write (of the current buffer, if any)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
246 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
247 default-buffer-file-coding-system
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
248 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
249 default-process-coding-system for read
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
250 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
251 default-process-coding-system for write
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
252 eol-type of default-process-coding-system"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
253 (interactive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
254 (let* ((proc (get-buffer-process (current-buffer)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255 (process-coding-systems (if proc (process-coding-system proc))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
256 (message
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
257 "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
258 (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
259 (coding-system-eol-type-mnemonic buffer-file-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
260 (coding-system-mnemonic (keyboard-coding-system))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
261 (coding-system-eol-type-mnemonic (keyboard-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
262 (coding-system-mnemonic (terminal-coding-system))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
263 (coding-system-eol-type-mnemonic (terminal-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
264 (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
265 (coding-system-eol-type-mnemonic (car process-coding-systems))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 (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
267 (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
268 (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
269 (coding-system-eol-type-mnemonic default-buffer-file-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 (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
271 (coding-system-eol-type-mnemonic (car default-process-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 (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
273 (coding-system-eol-type-mnemonic (cdr default-process-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 )))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
276 ;; 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
277 (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
278 (if (not coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
279 (princ "nil\n")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
280 (princ (format "%c -- %s"
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
281 (coding-system-mnemonic coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
282 coding-system))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
283 (let ((aliases (coding-system-get coding-system 'alias-coding-systems)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
284 (if (eq coding-system (car aliases))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
285 (if (cdr aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
286 (princ (format " %S" (cons 'alias: (cdr aliases)))))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
287 (if (memq coding-system aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
288 (princ (format " (alias of %s)" (car aliases))))))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
289 (princ "\n")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
290 (if (and doc-string
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
291 (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
292 (princ (format " %s\n" doc-string)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 (defun describe-current-coding-system ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296 "Display coding systems currently used in a detailed format."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
297 (interactive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298 (with-output-to-temp-buffer "*Help*"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299 (let* ((proc (get-buffer-process (current-buffer)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300 (process-coding-systems (if proc (process-coding-system proc))))
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
301 (princ "Coding system for saving this buffer:\n ")
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
302 (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
303 (print-coding-system-briefly buffer-file-coding-system)
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
304 (princ "Not set locally, use the default.\n"))
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
305 (princ "Default coding system (for new files):\n ")
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
306 (print-coding-system-briefly default-buffer-file-coding-system)
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
307 (princ "Coding system for keyboard input:\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
308 (print-coding-system-briefly (keyboard-coding-system))
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
309 (princ "Coding system for terminal output:\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
310 (print-coding-system-briefly (terminal-coding-system))
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
311 (when (get-buffer-process (current-buffer))
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
312 (princ "Coding systems for process I/O:\n")
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
313 (princ " encoding input to the process: ")
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
314 (print-coding-system-briefly (cdr process-coding-systems))
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
315 (princ " decoding output from the process: ")
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
316 (print-coding-system-briefly (car process-coding-systems)))
19657
940d50684d68 (describe-current-coding-system): Add missing newline in output.
Richard M. Stallman <rms@gnu.org>
parents: 19557
diff changeset
317 (princ "Defaults for subprocess I/O:\n")
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
318 (princ " decoding: ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
319 (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
320 (princ " encoding: ")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
321 (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
322
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
323 (save-excursion
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
324 (set-buffer standard-output)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
325
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
326 (princ "\nPriority order for recognizing coding systems when reading files:\n")
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
327 (let ((l coding-category-list)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
328 (i 1)
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
329 (coding-list nil)
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
330 coding aliases)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
331 (while l
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
332 (setq coding (symbol-value (car l)))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
333 ;; Do not list up the same coding system twice.
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
334 (when (not (memq coding coding-list))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
335 (setq coding-list (cons coding coding-list))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
336 (princ (format " %d. %s " i coding))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
337 (setq aliases (coding-system-get coding 'alias-coding-systems))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
338 (if (eq coding (car aliases))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
339 (if (cdr aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
340 (princ (cons 'alias: (cdr aliases))))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
341 (if (memq coding aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
342 (princ (list 'alias 'of (car aliases)))))
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
343 (terpri)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
344 (setq i (1+ i)))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
345 (setq l (cdr l))))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
346
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
347 (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
348 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
349 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
350
18799
6c0d648d2cf8 (describe-current-coding-system): Use coding-category-iso-7-else
Kenichi Handa <handa@m17n.org>
parents: 18696
diff changeset
351 (let ((categories '(coding-category-iso-7 coding-category-iso-7-else))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
352 coding-system codings)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
353 (while categories
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
354 (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
355 (mapcar
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
356 (function
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
357 (lambda (x)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
358 (if (and (not (eq x coding-system))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
359 (coding-system-get x 'no-initial-designation)
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
360 (let ((flags (coding-system-flags x)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
361 (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
362 (setq codings (cons x codings)))))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
363 (get (car categories) 'coding-systems))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
364 (if codings
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
365 (let ((max-col (frame-width))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
366 pos)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
367 (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
368 (while codings
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
369 (setq pos (point))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
370 (insert (format " %s" (car codings)))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
371 (when (> (current-column) max-col)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
372 (goto-char pos)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
373 (insert "\n ")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
374 (goto-char (point-max)))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
375 (setq codings (cdr codings)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
376 (insert "\n\n")))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
377 (setq categories (cdr categories))))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
378
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
379 (princ "Particular coding systems specified for certain file names:\n")
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
380 (terpri)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
381 (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
382 (princ " ---------\t--------------\t\t----------------\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
383 (let ((func (lambda (operation alist)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
384 (princ " ")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
385 (princ operation)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
386 (if (not alist)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
387 (princ "\tnothing specified\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
388 (while alist
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
389 (indent-to 16)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
390 (prin1 (car (car alist)))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
391 (if (>= (current-column) 40)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
392 (newline))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
393 (indent-to 40)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
394 (princ (cdr (car alist)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
395 (princ "\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
396 (setq alist (cdr alist)))))))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
397 (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
398 (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
399 (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
400 (help-mode))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
401
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
402 ;; Print detailed information on CODING-SYSTEM.
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
403 (defun print-coding-system (coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
404 (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
405 (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
406 (flags (coding-system-flags coding-system))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
407 (aliases (coding-system-get coding-system 'alias-coding-systems)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
408 (if (not (eq (car aliases) coding-system))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
409 (princ (format "%s (alias of %s)\n" coding-system (car aliases)))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
410 (princ coding-system)
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
411 (setq aliases (cdr aliases))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
412 (while aliases
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
413 (princ ",")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
414 (princ (car aliases))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
415 (setq aliases (cdr aliases)))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
416 (princ (format ":%s:%c:%d:"
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
417 type
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
418 (coding-system-mnemonic coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
419 (if (integerp eol-type) eol-type 3)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
420 (cond ((eq type 2) ; ISO-2022
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
421 (let ((idx 0)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
422 charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
423 (while (< idx 4)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
424 (setq charset (aref flags idx))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
425 (cond ((null charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
426 (princ -1))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
427 ((eq charset t)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
428 (princ -2))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
429 ((charsetp charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
430 (princ charset))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
431 ((listp charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
432 (princ "(")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
433 (princ (car charset))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
434 (setq charset (cdr charset))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
435 (while charset
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 (princ (car charset))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
438 (setq charset (cdr charset)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
439 (princ ")")))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
440 (princ ",")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
441 (setq idx (1+ idx)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
442 (while (< idx 12)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
443 (princ (if (aref flags idx) 1 0))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
444 (princ ",")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
445 (setq idx (1+ idx)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
446 (princ (if (aref flags idx) 1 0))))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
447 ((eq type 4) ; CCL
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
448 (let (i len)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
449 (setq i 0 len (length (car flags)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
450 (while (< i len)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
451 (princ (format " %x" (aref (car flags) i)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
452 (setq i (1+ i)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
453 (princ ",")
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
454 (setq i 0 len (length (cdr flags)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
455 (while (< i len)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
456 (princ (format " %x" (aref (cdr flags) i)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
457 (setq i (1+ i)))))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
458 (t (princ 0)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
459 (princ ":")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
460 (princ (coding-system-doc-string coding-system))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
461 (princ "\n"))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
463 ;;;###autoload
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
464 (defun list-coding-systems (&optional arg)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
465 "Display a list of all coding systems.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
466 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
467
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
468 With prefix arg, the output format gets more cryptic,
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
469 but contains full information about each coding systems."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
470 (interactive "P")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 (with-output-to-temp-buffer "*Help*"
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
472 (if (null arg)
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
473 (princ "\
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
474 ###############################################
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
475 # 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
476 # MNEMONIC-LETTER -- CODING-SYSTEM-NAME
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
477 # DOC-STRING
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
478 ")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
479 (princ "\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 #########################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481 ## LIST OF CODING SYSTEMS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482 ## Each line corresponds to one coding system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483 ## Format of a line is:
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
484 ## 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
485 ## :PRE-WRITE-CONVERSION:DOC-STRING,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
486 ## where
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
487 ## NAME = coding system name
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
488 ## ALIAS = alias of the coding system
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
489 ## 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
490 ## 0 (EMACS-MULE), 1 (SJIS), 2 (ISO2022), 3 (BIG5), or 4 (CCL)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491 ## EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
492 ## FLAGS =
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493 ## if TYPE = 2 then
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
494 ## comma (`,') separated data of the followings:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
495 ## G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
496 ## LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
497 ## else if TYPE = 4 then
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498 ## comma (`,') separated CCL programs for read and write
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499 ## else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 ## 0
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
501 ## POST-READ-CONVERSION, PRE-WRITE-CONVERSION = function name to be called
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
502 ##
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
503 "))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
504 (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
505 coding-system)
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
506 (while bases
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
507 (setq coding-system (car bases))
18799
6c0d648d2cf8 (describe-current-coding-system): Use coding-category-iso-7-else
Kenichi Handa <handa@m17n.org>
parents: 18696
diff changeset
508 (if (null arg)
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
509 (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
510 (print-coding-system coding-system))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
511 (setq bases (cdr bases))))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
512
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
513 ;;;###automatic
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
514 (defun list-coding-categories ()
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
515 "Display a list of all coding categories."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
516 (with-output-to-temp-buffer "*Help*"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
517 (princ "\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518 ############################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519 ## LIST OF CODING CATEGORIES (ordered by priority)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
520 ## CATEGORY:CODING-SYSTEM
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521 ##
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
522 ")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
523 (let ((l coding-category-list))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
524 (while l
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
525 (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
526 (setq l (cdr l))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
527
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528 ;;; FONT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
529
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
530 ;; Print information of a font in FONTINFO.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
531 (defun describe-font-internal (font-info &optional verbose)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
532 (print-list "name (opened by):" (aref font-info 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
533 (print-list " full name:" (aref font-info 1))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
534 (let ((charset (aref font-info 2)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535 (print-list " charset:"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536 (format "%s (%s)" charset (charset-description charset))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
537 (print-list " size:" (format "%d" (aref font-info 3)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
538 (print-list " height:" (format "%d" (aref font-info 4)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
539 (print-list " baseline-offset:" (format "%d" (aref font-info 5)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
540 (print-list "relative-compose:" (format "%d" (aref font-info 6))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
542 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
543 (defun describe-font (fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
544 "Display information about fonts which partially match FONTNAME."
20092
2b49d1c59b83 (describe-font): Fix prompt.
Karl Heuer <kwzh@gnu.org>
parents: 19876
diff changeset
545 (interactive "sFontname (default, current choice for ASCII chars): ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546 (or window-system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547 (error "No window system being used"))
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
548 (when (or (not fontname) (= (length fontname) 0))
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
549 (setq fontname (cdr (assq 'font (frame-parameters))))
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
550 (if (query-fontset fontname)
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
551 (setq fontname
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
552 (nth 2 (assq 'ascii (aref (fontset-info fontname) 2))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
553 (let ((font-info (font-info fontname)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
554 (if (null font-info)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
555 (message "No matching font")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
556 (with-output-to-temp-buffer "*Help*"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
557 (describe-font-internal font-info 'verbose)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
558
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
559 ;; 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
560 ;; 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
561 ;; actually INSERT such information in the current buffer.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
562 (defun print-fontset (fontset &optional print-fonts)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
563 (let* ((fontset-info (fontset-info fontset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
564 (size (aref fontset-info 0))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
565 (height (aref fontset-info 1))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
566 (fonts (and print-fonts (aref fontset-info 2)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
567 (xlfd-fields (x-decompose-font-name fontset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
568 style)
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
569 (if xlfd-fields
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
570 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
571 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
572 (if (string-match "^bold$\\|^demibold$" weight)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
573 (setq style (concat weight " "))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
574 (setq style "medium "))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
575 (cond ((string-match "^i$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
576 (setq style (concat style "italic")))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
577 ((string-match "^o$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
578 (setq style (concat style "slant")))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
579 ((string-match "^ri$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
580 (setq style (concat style "reverse italic")))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
581 ((string-match "^ro$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
582 (setq style (concat style "reverse slant")))))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
583 (setq style " ? "))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
584 (beginning-of-line)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
585 (insert fontset)
18643
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
586 (indent-to 58)
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
587 (insert (if (> size 0) (format "%2dx%d" size height) " -"))
18643
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
588 (indent-to 64)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
589 (insert style "\n")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
590 (when print-fonts
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
591 (insert " O Charset / Fontname\n"
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
592 " - ------------------\n")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
593 (sort-charset-list)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
594 (let ((l charset-list)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
595 charset font-info opened fontname)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
596 (while l
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
597 (setq charset (car l) l (cdr l))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
598 (setq font-info (assq charset fonts))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
599 (if (null font-info)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
600 (setq opened ?? fontname "not specified")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
601 (if (nth 2 font-info)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
602 (if (stringp (nth 2 font-info))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
603 (setq opened ?o fontname (nth 2 font-info))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
604 (setq opened ?- fontname (nth 1 font-info)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
605 (setq opened ?x fontname (nth 1 font-info))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
606 (insert (format " %c %s\n %s\n"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
607 opened charset fontname)))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
608
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
610 (defun describe-fontset (fontset)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
611 "Display information of FONTSET.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
612
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
613 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
614 contained in FONTSET.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
615
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
616 The column WDxHT contains width and height (pixels) of each fontset
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
617 \(i.e. those of ASCII font in the fontset). The letter `-' in this
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
618 column means that the corresponding fontset is not yet used in any
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
619 frame.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
620
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
621 The O column of each font contains one of the following letters.
18643
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
622 o -- font already opened
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
623 - -- font not yet opened
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
624 x -- font can't be opened
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
625 ? -- no font specified
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
626
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
627 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
628 displayed by the font."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629 (interactive
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630 (if (not window-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
631 (error "No window system being used")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
632 (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
633 (completion-ignore-case t))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
634 (list (completing-read
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
635 "Fontset (default, used by the current frame): "
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
636 fontset-list nil t)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
637 (if (= (length fontset) 0)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
638 (setq fontset (cdr (assq 'font (frame-parameters)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
639 (if (not (query-fontset fontset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
640 (error "Current frame is using font, not fontset"))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
641 (let ((fontset-info (fontset-info fontset)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
642 (with-output-to-temp-buffer "*Help*"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
643 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
644 (set-buffer standard-output)
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
645 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n")
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
646 (insert "------------\t\t\t\t\t\t ----- -----\n")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
647 (print-fontset fontset t)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
648
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
649 ;;;###autoload
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
650 (defun list-fontsets (arg)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
651 "Display a list of all fontsets.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
652
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
653 It prints name, size, and style of each fontset.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
654 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
655 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
656 (interactive "P")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
657 (with-output-to-temp-buffer "*Help*"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
658 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
659 (set-buffer standard-output)
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
660 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n")
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
661 (insert "------------\t\t\t\t\t\t ----- -----\n")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
662 (let ((fontsets (fontset-list)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
663 (while fontsets
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
664 (print-fontset (car fontsets) arg)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
665 (setq fontsets (cdr fontsets)))))))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
666
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
667 ;;;###autoload
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
668 (defun list-input-methods ()
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
669 "Print information of all input methods."
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
670 (interactive)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
671 (with-output-to-temp-buffer "*Help*"
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
672 (if (not input-method-alist)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
673 (progn
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
674 (princ "
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
675 No input method is avairable, perhaps because you have not yet
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
676 installed LEIM (Libraries of Emacs Input Method).
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
677
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
678 LEIM is avairable from the same ftp directory as Emacs. For instance,
20170
500c446cd5be (list-input-methods): Improve the
Kenichi Handa <handa@m17n.org>
parents: 20163
diff changeset
679 if there exists an archive file emacs-20.N.tar.gz, there should also
500c446cd5be (list-input-methods): Improve the
Kenichi Handa <handa@m17n.org>
parents: 20163
diff changeset
680 be a file leim-20.N.tar.gz. When you extract this file, LEIM files
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
681 are put under the subdirectory emacs-20.2/leim. When you install
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
682 Emacs again, you should be able to use various input methods."))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
683 (princ "LANGUAGE\n NAME (`TITLE' in mode line)\n")
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
684 (princ " SHORT-DESCRIPTION\n------------------------------\n")
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
685 (setq input-method-alist
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
686 (sort input-method-alist
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
687 (function (lambda (x y) (string< (nth 1 x) (nth 1 y))))))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
688 (let ((l input-method-alist)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
689 language elt)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
690 (while l
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
691 (setq elt (car l) l (cdr l))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
692 (when (not (equal language (nth 1 elt)))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
693 (setq language (nth 1 elt))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
694 (princ language)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
695 (terpri))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
696 (princ (format " %s (`%s' in mode line)\n %s\n"
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
697 (car elt)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
698 (let ((title (nth 3 elt)))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
699 (if (and (consp title) (stringp (car title)))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
700 (car title)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
701 title))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
702 (let ((description (nth 4 elt)))
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
703 (string-match ".*" description)
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
704 (match-string 0 description)))))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
705
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
706 ;;; DIAGNOSIS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
707
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
708 ;; 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
709 (defun insert-section (section-number title)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
710 (insert "########################################\n"
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
711 "# Section " (format "%d" section-number) ". " title "\n"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
712 "########################################\n\n"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
713
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
714 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
715 (defun mule-diag ()
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
716 "Display diagnosis of the multilingual environment (MULE).
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
717
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
718 It prints various information related to the current multilingual
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
719 environment, including lists of input methods, coding systems,
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
720 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
721 system)."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
722 (interactive)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
723 (with-output-to-temp-buffer "*Mule-Diagnosis*"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
724 (save-excursion
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
725 (set-buffer standard-output)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
726 (insert "\t###############################\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
727 "\t### Diagnosis of your Emacs ###\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
728 "\t###############################\n\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
729 "CONTENTS: Section 1. General Information\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
730 " Section 2. Display\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
731 " Section 3. Input methods\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
732 " Section 4. Coding systems\n"
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
733 " Section 5. Character sets\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
734 (if window-system
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
735 (insert " Section 6. Fontsets\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
736 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
737
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
738 (insert-section 1 "General Information")
19425
572165bfff3e (mule-diag): Don't print primary-language.
Richard M. Stallman <rms@gnu.org>
parents: 19265
diff changeset
739 (insert "Version of this emacs:\n " (emacs-version) "\n\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
740
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
741 (insert-section 2 "Display")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
742 (if window-system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
743 (insert "Window-system: "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
744 (symbol-name window-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
745 (format "%s" window-system-version))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
746 (insert "Terminal: " (getenv "TERM")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
747 (insert "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
748
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
749 (if (eq window-system 'x)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
750 (let ((font (cdr (assq 'font (frame-parameters)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
751 (insert "The selected frame is using the "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
752 (if (query-fontset font) "fontset" "font")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
753 ":\n\t" font))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
754 (insert "Coding system of the terminal: "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
755 (symbol-name (terminal-coding-system))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
756 (insert "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
757
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
758 (insert-section 3 "Input methods")
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
759 (save-excursion (list-input-methods))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
760 (insert-buffer-substring "*Help*")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
761 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
762 (if default-input-method
19557
f0f3ffd3b852 (mule-diag): Add save-excursion calls.
Richard M. Stallman <rms@gnu.org>
parents: 19425
diff changeset
763 (insert "Default input method: " default-input-method "\n")
19657
940d50684d68 (describe-current-coding-system): Add missing newline in output.
Richard M. Stallman <rms@gnu.org>
parents: 19557
diff changeset
764 (insert "No default input method is specified\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
765
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
766 (insert-section 4 "Coding systems")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
767 (save-excursion (list-coding-systems t))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
768 (insert-buffer-substring "*Help*")
19557
f0f3ffd3b852 (mule-diag): Add save-excursion calls.
Richard M. Stallman <rms@gnu.org>
parents: 19425
diff changeset
769 (save-excursion (list-coding-categories))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
770 (insert-buffer-substring "*Help*")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
771 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
772
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
773 (insert-section 5 "Character sets")
19557
f0f3ffd3b852 (mule-diag): Add save-excursion calls.
Richard M. Stallman <rms@gnu.org>
parents: 19425
diff changeset
774 (save-excursion (list-character-sets t))
18559
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 (insert "\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
777
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
778 (when window-system
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
779 (insert-section 6 "Fontsets")
19557
f0f3ffd3b852 (mule-diag): Add save-excursion calls.
Richard M. Stallman <rms@gnu.org>
parents: 19425
diff changeset
780 (save-excursion (list-fontsets t))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
781 (insert-buffer-substring "*Help*"))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
782 (help-mode))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
783
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
784
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
785 ;;; DUMP DATA FILE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
786
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
787 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
788 (defun dump-charsets ()
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
789 "Dump information of all charsets into the file \"CHARSETS\".
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
790 The file is saved in the directory `data-directory'."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
791 (let ((file (expand-file-name "CHARSETS" data-directory))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
792 buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
793 (or (file-writable-p file)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
794 (error "Can't write to file %s" file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
795 (setq buf (find-file-noselect file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
796 (save-window-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
797 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
798 (set-buffer buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
799 (setq buffer-read-only nil)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
800 (erase-buffer)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
801 (list-character-sets t)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
802 (insert-buffer-substring "*Help*")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
803 (let (make-backup-files
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
804 coding-system-for-write)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
805 (save-buffer))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
806 (kill-buffer buf))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
807 (if noninteractive
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
808 (kill-emacs)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
809
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
810 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
811 (defun dump-codings ()
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
812 "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
813 The file is saved in the directory `data-directory'."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
814 (let ((file (expand-file-name "CODINGS" data-directory))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
815 buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
816 (or (file-writable-p file)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
817 (error "Can't write to file %s" file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
818 (setq buf (find-file-noselect file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
819 (save-window-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
820 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
821 (set-buffer buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
822 (setq buffer-read-only nil)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
823 (erase-buffer)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
824 (list-coding-systems t)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
825 (insert-buffer-substring "*Help*")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
826 (list-coding-categories)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
827 (insert-buffer-substring "*Help*")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
828 (let (make-backup-files
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
829 coding-system-for-write)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
830 (save-buffer))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
831 (kill-buffer buf))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
832 (if noninteractive
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
833 (kill-emacs)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
834
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
835 ;;; mule-diag.el ends here