annotate lisp/international/mule-diag.el @ 28735:2a88fcce2568

(locate-library): Use mapc. (help-manyarg-func-alist): Add call-process-region.
author Dave Love <fx@gnu.org>
date Thu, 27 Apr 2000 17:01:28 +0000
parents cad26a9da36b
children 133a92b8094d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24724
df2a95fa1429 (mule-diag): Change MULE to Mule in docstring.
Kenichi Handa <handa@m17n.org>
parents: 24691
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
27953
8b485e43ac51 (list-character-sets): Call
Dave Love <fx@gnu.org>
parents: 27912
diff changeset
6 ;; Keywords: multilingual, charset, coding system, fontset, diagnosis, i18n
17052
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
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
46 (defun list-character-sets (arg)
18559
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
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
49 The ID-NUM column contains a charset identification number
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
50 for internal Emacs use.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
51
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
52 The MULTIBYTE-FORM column contains a format of multibyte sequence
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
53 of characters in the charset for buffer and string
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
54 by one to four hexadecimal digits.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
55 `xx' stands for any byte in the range 0..127.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
56 `XX' stands for any byte in the range 160..255.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
57
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
58 The D column contains a dimension of this character set.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
59 The CH column contains a number of characters in a block of this character set.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
60 The FINAL-CHAR column contains an ISO-2022's <final-char> to use for
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
61 designating this character set in ISO-2022-based coding systems.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
62
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
63 With prefix arg, the output format gets more cryptic,
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
64 but still shows the full information."
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
65 (interactive "P")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
66 (with-output-to-temp-buffer "*Help*"
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
67 (with-current-buffer standard-output
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
68 (if arg
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
69 (list-character-sets-2)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
70 ;; Insert header.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
71 (insert
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
72 (substitute-command-keys
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
73 (concat "Use "
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
74 (if (display-mouse-p) "\\[help-follow-mouse] or ")
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
75 "\\[help-follow]:\n")))
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
76 (insert " on a column title to sort by that title,")
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
77 (indent-to 56)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
78 (insert "+----DIMENSION\n")
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
79 (insert " on a charset name to list characters.")
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
80 (indent-to 56)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
81 (insert "| +--CHARS\n")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
82 (let ((columns '(("ID-NUM" . id) "\t"
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
83 ("CHARSET-NAME" . name) "\t\t\t"
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
84 ("MULTIBYTE-FORM" . id) "\t"
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
85 ("D CH FINAL-CHAR" . iso-spec)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
86 (help-highlight-face 'region)
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
87 (help-echo
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
88 (substitute-command-keys
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
89 (concat (if (display-mouse-p) "\\[help-follow-mouse], ")
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
90 "\\[help-follow]: sort on this column")))
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
91 pos)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
92 (while columns
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
93 (if (stringp (car columns))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
94 (insert (car columns))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
95 (insert (car (car columns)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
96 (search-backward (car (car columns)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
97 (help-xref-button 0 'sort-listed-character-sets
27953
8b485e43ac51 (list-character-sets): Call
Dave Love <fx@gnu.org>
parents: 27912
diff changeset
98 (cdr (car columns))
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
99 help-echo)
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
100 (goto-char (point-max)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
101 (setq columns (cdr columns)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
102 (insert "\n"))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
103 (insert "------\t------------\t\t\t--------------\t- -- ----------\n")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
104
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
105 ;; Insert body sorted by charset IDs.
27953
8b485e43ac51 (list-character-sets): Call
Dave Love <fx@gnu.org>
parents: 27912
diff changeset
106 (list-character-sets-1 'id)
8b485e43ac51 (list-character-sets): Call
Dave Love <fx@gnu.org>
parents: 27912
diff changeset
107 (help-setup-xref (list #'list-character-sets arg) (interactive-p))))))
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
108
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
109
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
110 ;; Sort character set list by SORT-KEY.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
111
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
112 (defun sort-listed-character-sets (sort-key)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
113 (if sort-key
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
114 (save-excursion
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
115 (let ((buffer-read-only nil))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
116 (goto-char (point-min))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
117 (re-search-forward "[0-9][0-9][0-9]")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
118 (beginning-of-line)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
119 (delete-region (point) (point-max))
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
120 (list-character-sets-1 sort-key)
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
121 (help-setup-xref (list #'list-character-sets nil) t)))))
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
122
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
123 ;; Insert a list of character sets sorted by SORT-KEY. SORT-KEY
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
124 ;; should be one of `id', `name', and `iso-spec'. If SORT-KEY is nil,
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
125 ;; it defaults to `id'.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
126
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
127 (defun list-character-sets-1 (sort-key)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
128 (or sort-key
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
129 (setq sort-key 'id))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
130 (let ((tail (charset-list))
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
131 (help-echo
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
132 (substitute-command-keys
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
133 (concat (if (display-mouse-p) "\\[help-follow-mouse], ")
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
134 "\\[help-follow]: show table of this character set")))
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
135 charset-info-list elt charset info sort-func)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
136 (while tail
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
137 (setq charset (car tail) tail (cdr tail)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
138 info (charset-info charset))
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
139
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
140 ;; Generate a list that contains all information to display.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
141 (setq charset-info-list
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
142 (cons (list (charset-id charset) ; ID-NUM
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
143 charset ; CHARSET-NAME
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
144 (if (eq charset 'ascii) ; MULTIBYTE-FORM
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
145 "xx"
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
146 (let ((str (format "%2X" (aref info 6))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
147 (if (> (aref info 7) 0)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
148 (setq str (format "%s %2X" str (aref info 7))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
149 (setq str (concat str " XX"))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
150 (if (> (aref info 2) 1)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
151 (setq str (concat str " XX")))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
152 str))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
153 (aref info 2) ; DIMENSION
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
154 (aref info 3) ; CHARS
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
155 (aref info 8) ; FINAL-CHAR
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
156 )
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
157 charset-info-list)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
158
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
159 ;; Determine a predicate for `sort' by SORT-KEY.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
160 (setq sort-func
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
161 (cond ((eq sort-key 'id)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
162 (function (lambda (x y) (< (car x) (car y)))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
163
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
164 ((eq sort-key 'name)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
165 (function (lambda (x y) (string< (nth 1 x) (nth 1 y)))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
166
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
167 ((eq sort-key 'iso-spec)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
168 ;; Sort by DIMENSION CHARS FINAL-CHAR
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
169 (function
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
170 (lambda (x y)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
171 (or (< (nth 3 x) (nth 3 y))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
172 (and (= (nth 3 x) (nth 3 y))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
173 (or (< (nth 4 x) (nth 4 y))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
174 (and (= (nth 4 x) (nth 4 y))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
175 (< (nth 5 x) (nth 5 y)))))))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
176 (t
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
177 (error "Invalid charset sort key: %s" sort-key))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
178
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
179 (setq charset-info-list (sort charset-info-list sort-func))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
180
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
181 ;; Insert information of character sets.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
182 (while charset-info-list
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
183 (setq elt (car charset-info-list)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
184 charset-info-list (cdr charset-info-list))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
185 (insert (format "%03d(%02X)" (car elt) (car elt))) ; ID-NUM
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
186 (indent-to 8)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
187 (insert (symbol-name (nth 1 elt))) ; CHARSET-NAME
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
188 (search-backward (symbol-name (nth 1 elt)))
27973
cf535f97695d (list-character-sets): Make help-echo
Kenichi Handa <handa@m17n.org>
parents: 27953
diff changeset
189 (help-xref-button 0 'list-charset-chars (nth 1 elt) help-echo)
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
190 (goto-char (point-max))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
191 (insert "\t")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
192 (indent-to 40)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
193 (insert (nth 2 elt)) ; MULTIBYTE-FORM
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
194 (indent-to 56)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
195 (insert (format "%d %2d %c" ; ISO specs
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
196 (nth 3 elt) (nth 4 elt) (nth 5 elt)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
197 (insert "\n"))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
198
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
199
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
200 ;; List all character sets in a form that a program can easily parse.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
201
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
202 (defun list-character-sets-2 ()
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
203 (insert "#########################
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 ## LIST OF CHARSETS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205 ## Each line corresponds to one charset.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206 ## The following attributes are listed in this order
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 ## separated by a colon `:' in one line.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
208 ## CHARSET-ID,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 ## CHARSET-SYMBOL-NAME,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210 ## DIMENSION (1 or 2)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 ## CHARS (94 or 96)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212 ## BYTES (of multibyte form: 1, 2, 3, or 4),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 ## WIDTH (occupied column numbers: 1 or 2),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 ## DIRECTION (0:left-to-right, 1:right-to-left),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 ## ISO-FINAL-CHAR (character code of ISO-2022's final character)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216 ## ISO-GRAPHIC-PLANE (ISO-2022's graphic plane, 0:GL, 1:GR)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217 ## DESCRIPTION (describing string of the charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218 ")
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
219 (let ((l charset-list)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
220 charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
221 (while l
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
222 (setq charset (car l) l (cdr l))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
223 (princ (format "%03d:%s:%d:%d:%d:%d:%d:%d:%d:%s\n"
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
224 (charset-id charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
225 charset
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
226 (charset-dimension charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
227 (charset-chars charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
228 (charset-bytes charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
229 (charset-width charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
230 (charset-direction charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
231 (charset-iso-final-char charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
232 (charset-iso-graphic-plane charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
233 (charset-description charset))))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
234
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
235 (defvar non-iso-charset-alist
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
236 `((viscii
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
237 (ascii vietnamese-viscii-lower vietnamese-viscii-upper)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
238 ,viet-viscii-nonascii-translation-table
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
239 ((0 255)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
240 (koi8-r
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
241 (ascii cyrillic-iso8859-5)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
242 ,cyrillic-koi8-r-nonascii-translation-table
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
243 ((32 255)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
244 (alternativnyj
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
245 (ascii cyrillic-iso8859-5)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
246 ,cyrillic-alternativnyj-nonascii-translation-table
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
247 ((32 255)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
248 (big5
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
249 (ascii chinese-big5-1 chinese-big5-2)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
250 decode-big5-char
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
251 ((32 127)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
252 ((?\xA1 ?\xFE) . (?\x40 ?\x7E ?\xA1 ?\xFE))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
253 (sjis
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
254 (ascii katakana-jisx0201 japanese-jisx0208)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
255 decode-sjis-char
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
256 ((32 127 ?\xA1 ?\xDF)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
257 ((?\x81 ?\x9F ?\xE0 ?\xEF) . (?\x40 ?\x7E ?\x80 ?\xFC)))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
258 "Alist of non-ISO charset names vs the corresponding information.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
259
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
260 Non-ISO charsets are what Emacs can read (or write) by mapping to (or
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
261 from) some Emacs' charsets that correspond to ISO charsets.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
262
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
263 Each element has the following format:
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
264 (NON-ISO-CHARSET CHARSET-LIST TRANSLATION-METHOD [ CODE-RANGE ])
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
265
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
266 NON-ISO-CHARSET is a name (symbol) of the non-ISO charset.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
267
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
268 CHARSET-LIST is a list of Emacs' charsets into which characters of
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
269 NON-ISO-CHARSET are mapped.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
270
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
271 TRANSLATION-METHOD is a char-table to translate a character code of
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
272 NON-ISO-CHARSET to the corresponding Emacs character code. It can
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
273 also be a function to call with one argument, a character code in
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
274 NON-ISO-CHARSET.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
275
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
276 CODE-RANGE specifies the valid code ranges of NON-ISO-CHARSET.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
277 It is a list of RANGEs, where each RANGE is of the form:
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
278 (FROM1 TO1 FROM2 TO2 ...)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
279 or
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
280 ((FROM1-1 TO1-1 FROM1-2 TO1-2 ...) . (FROM2-1 TO2-1 FROM2-2 TO2-2 ...))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
281 In the first form, valid codes are between FROM1 and TO1, or FROM2 and
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
282 TO2, or...
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
283 The second form is used for 2-byte codes. The car part is the ranges
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
284 of the first byte, and the cdr part is the ranges of the second byte.")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
285
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
286
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
287 ;; Decode a character that has code CODE in CODEPAGE. Value is a
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
288 ;; string of decoded character.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
289
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
290 (defun decode-codepage-char (codepage code)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
291 ;; Each CODEPAGE corresponds to a coding system cpCODEPAGE.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
292 (let ((coding-system (intern (format "cp%d" codepage))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
293 (or (coding-system-p coding-system)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
294 (codepage-setup codepage))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
295 (string-to-char
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
296 (decode-coding-string (char-to-string code) coding-system))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
297
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
298
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
299 ;; Add DOS codepages to `non-iso-charset-alist'.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
300
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
301 (let ((tail (cp-supported-codepages))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
302 elt)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
303 (while tail
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
304 (setq elt (car tail) tail (cdr tail))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
305 ;; Now ELT is (CODEPAGE . CHARSET), where CODEPAGE is a string
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
306 ;; (e.g. "850"), CHARSET is a charset that characters in CODEPAGE
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
307 ;; are mapped to.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
308 (setq non-iso-charset-alist
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
309 (cons (list (intern (concat "cp" (car elt)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
310 (list 'ascii (cdr elt))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
311 `(lambda (code)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
312 (decode-codepage-char ,(string-to-int (car elt))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
313 code))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
314 (list (list 0 255)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
315 non-iso-charset-alist))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
316
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
317
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
318 ;; A variable to hold charset input history.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
319 (defvar charset-history nil)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
320
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
321
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
322 ;;;###autoload
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
323 (defun read-charset (prompt &optional default-value initial-input)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
324 "Read a character set from the minibuffer, prompting with string PROMPT.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
325 It reads an Emacs' character set listed in the variable `charset-list'
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
326 or a non-ISO character set listed in the variable
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
327 `non-iso-charset-alist'.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
328
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
329 Optional arguments are DEFAULT-VALUE and INITIAL-INPUT.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
330 DEFAULT-VALUE, if non-nil, is the default value.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
331 INITIAL-INPUT, if non-nil, is a string inserted in the minibuffer initially.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
332 See the documentation of the function `completing-read' for the
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
333 detailed meanings of these arguments."
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
334 (let* ((table (append (mapcar (function (lambda (x) (list (symbol-name x))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
335 charset-list)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
336 (mapcar (function (lambda (x)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
337 (list (symbol-name (car x)))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
338 non-iso-charset-alist)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
339 (charset (completing-read prompt table
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
340 nil t initial-input 'charset-history
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
341 default-value)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
342 (if (> (length charset) 0)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
343 (intern charset))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
344
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
345
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
346 ;; List characters of the range MIN and MAX of CHARSET. If dimension
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
347 ;; of CHARSET is two (i.e. 2-byte charset), ROW is the first byte
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
348 ;; (block index) of the characters, and MIN and MAX are the second
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
349 ;; bytes of the characters. If the dimension is one, ROW should be 0.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
350 ;; For a non-ISO charset, CHARSET is a char-table or a function to get
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
351 ;; Emacs' character codes that corresponds to the characters to list.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
352
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
353 (defun list-block-of-chars (charset row min max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
354 (let (i ch)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
355 (insert-char ?- (+ 4 (* 3 16)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
356 (insert "\n ")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
357 (setq i 0)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
358 (while (< i 16)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
359 (insert (format "%3X" i))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
360 (setq i (1+ i)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
361 (setq i (* (/ min 16) 16))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
362 (while (<= i max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
363 (if (= (% i 16) 0)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
364 (insert (format "\n%3Xx" (/ (+ (* row 256) i) 16))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
365 (setq ch (cond ((< i min)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
366 32)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
367 ((charsetp charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
368 (if (= row 0)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
369 (make-char charset i)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
370 (make-char charset row i)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
371 ((char-table-p charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
372 (aref charset i))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
373 (t (funcall charset (+ (* row 256) i)))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
374 (if (or (< ch 32) (and (>= ch 127) (<= ch 255)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
375 ;; Don't insert a control code.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
376 (setq ch 32))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
377 (insert (format "%3c" ch))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
378 (setq i (1+ i))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
379 (insert "\n"))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
380
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
381
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
382 ;; List all characters in ISO charset CHARSET.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
383
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
384 (defun list-iso-charset-chars (charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
385 (let ((dim (charset-dimension charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
386 (chars (charset-chars charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
387 (plane (charset-iso-graphic-plane charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
388 min max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
389 (insert (format "Characters in the charset %s.\n" charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
390
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
391 (if (= chars 94)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
392 (setq min 33 max 126)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
393 (setq min 32 max 127))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
394 (or (= plane 0)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
395 (setq min (+ min 128) max (+ max 128)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
396
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
397 (if (= dim 1)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
398 (list-block-of-chars charset 0 min max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
399 (let ((i min))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
400 (while (< i max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
401 (list-block-of-chars charset i min max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
402 (setq i (1+ i)))))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
403
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
404
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
405 ;; List all characters in non-ISO charset CHARSET.
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
406
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
407 (defun list-non-iso-charset-chars (charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
408 (let* ((slot (assq charset non-iso-charset-alist))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
409 (charsets (nth 1 slot))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
410 (translate-method (nth 2 slot))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
411 (ranges (nth 3 slot))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
412 range)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
413 (or slot
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
414 (error "Unknown external charset: %s" charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
415 (insert (format "Characters in non-ISO charset %s.\n" charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
416 (insert "They are mapped to: "
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
417 (mapconcat (lambda (x) (symbol-name x)) charsets ", ")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
418 "\n")
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
419 (while ranges
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
420 (setq range (car ranges) ranges (cdr ranges))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
421 (if (integerp (car range))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
422 ;; The form of RANGES is (FROM1 TO1 FROM2 TO2 ...).
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
423 (while range
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
424 (list-block-of-chars translate-method
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
425 0 (car range) (nth 1 range))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
426 (setq range (nthcdr 2 range)))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
427 ;; The form of RANGES is ((FROM1-1 TO1-1 ...) . (FROM2-1 TO2-1 ...)).
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
428 (let ((row-range (car range))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
429 row row-max
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
430 col-range col col-max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
431 (while row-range
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
432 (setq row (car row-range) row-max (nth 1 row-range)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
433 row-range (nthcdr 2 row-range))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
434 (while (< row row-max)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
435 (setq col-range (cdr range))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
436 (while col-range
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
437 (setq col (car col-range) col-max (nth 1 col-range)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
438 col-range (nthcdr 2 col-range))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
439 (list-block-of-chars translate-method row col col-max))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
440 (setq row (1+ row)))))))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
441
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
442
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
443 ;;;###autoload
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
444 (defun list-charset-chars (charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
445 "Display a list of characters in the specified character set."
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
446 (interactive (list (read-charset "Character set: ")))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
447 (with-output-to-temp-buffer "*Help*"
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
448 (with-current-buffer standard-output
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
449 (set-buffer-multibyte t)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
450 (cond ((charsetp charset)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
451 (list-iso-charset-chars charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
452 ((assq charset non-iso-charset-alist)
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
453 (list-non-iso-charset-chars charset))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
454 (t
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
455 (error "Invalid charset %s" charset))))))
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
456
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458 ;;; CODING-SYSTEM
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
459
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
460 ;; Print information of designation of each graphic register in FLAGS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
461 ;; in human readable format. See the documentation of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462 ;; `make-coding-system' for the meaning of FLAGS.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
463 (defun print-designation (flags)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
464 (let ((graphic-register 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465 charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
466 (while (< graphic-register 4)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
467 (setq charset (aref flags graphic-register))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
468 (princ (format
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
469 " G%d -- %s\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
470 graphic-register
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471 (cond ((null charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
472 "never used")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
473 ((eq charset t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
474 "no initial designation, and used by any charsets")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
475 ((symbolp charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
476 (format "%s:%s"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
477 charset (charset-description charset)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478 ((listp charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
479 (if (charsetp (car charset))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 (format "%s:%s, and also used by the followings:"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481 (car charset)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482 (charset-description (car charset)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483 "no initial designation, and used by the followings:"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 (t
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485 "invalid designation information"))))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
486 (when (listp charset)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
487 (setq charset (cdr charset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
488 (while charset
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
489 (cond ((eq (car charset) t)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
490 (princ "\tany other charsets\n"))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
491 ((charsetp (car charset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
492 (princ (format "\t%s:%s\n"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
493 (car charset)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
494 (charset-description (car charset)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
495 (t
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
496 "invalid designation information"))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
497 (setq charset (cdr charset))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498 (setq graphic-register (1+ graphic-register)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
501 (defun describe-coding-system (coding-system)
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
502 "Display information about CODING-SYSTEM."
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
503 (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
504 (if (null coding-system)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
505 (describe-current-coding-system)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
506 (with-output-to-temp-buffer "*Help*"
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
507 (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
508 (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
509 (princ "Type: ")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
510 (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
511 (flags (coding-system-flags coding-system)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
512 (princ type)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
513 (cond ((eq type nil)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
514 (princ " (do no conversion)"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
515 ((eq type t)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
516 (princ " (do automatic conversion)"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
517 ((eq type 0)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
518 (princ " (Emacs internal multibyte form)"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
519 ((eq type 1)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
520 (princ " (Shift-JIS, MS-KANJI)"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
521 ((eq type 2)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
522 (princ " (variant of ISO-2022)\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
523 (princ "Initial designations:\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
524 (print-designation flags)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
525 (princ "Other Form: \n ")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
526 (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
527 (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
528 (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
529 (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
530 (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
531 (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
532 (if (aref flags 10) (princ ", use-roman"))
23582
a96404fd053a (describe-coding-system): Describe
Andreas Schwab <schwab@suse.de>
parents: 22885
diff changeset
533 (if (aref flags 11) (princ ", use-old-jis"))
a96404fd053a (describe-coding-system): Describe
Andreas Schwab <schwab@suse.de>
parents: 22885
diff changeset
534 (if (aref flags 12) (princ ", no-ISO6429"))
a96404fd053a (describe-coding-system): Describe
Andreas Schwab <schwab@suse.de>
parents: 22885
diff changeset
535 (if (aref flags 13) (princ ", init-bol"))
a96404fd053a (describe-coding-system): Describe
Andreas Schwab <schwab@suse.de>
parents: 22885
diff changeset
536 (if (aref flags 14) (princ ", designation-bol"))
a96404fd053a (describe-coding-system): Describe
Andreas Schwab <schwab@suse.de>
parents: 22885
diff changeset
537 (if (aref flags 15) (princ ", convert-unsafe"))
a96404fd053a (describe-coding-system): Describe
Andreas Schwab <schwab@suse.de>
parents: 22885
diff changeset
538 (if (aref flags 16) (princ ", accept-latin-extra-code"))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
539 (princ "."))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
540 ((eq type 3)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
541 (princ " (Big5)"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
542 ((eq type 4)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
543 (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
544 ((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
545 (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
546 (t (princ ": invalid coding-system."))))
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
547 (princ "\nEOL type: ")
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
548 (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
549 (cond ((vectorp eol-type)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
550 (princ "Automatic selection from:\n\t")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
551 (princ eol-type)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
552 (princ "\n"))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
553 ((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
554 ((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
555 ((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
556 (t (princ "invalid\n")))))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
557 (let ((postread (coding-system-get coding-system 'post-read-conversion)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
558 (when postread
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
559 (princ "After decoding a text normally,")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
560 (princ " perform post-conversion by the function: ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
561 (princ "\n ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
562 (princ postread)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
563 (princ "\n")))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
564 (let ((prewrite (coding-system-get coding-system 'pre-write-conversion)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
565 (when prewrite
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
566 (princ "Before encoding a text normally,")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
567 (princ " perform pre-conversion by the function: ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
568 (princ "\n ")
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
569 (princ prewrite)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
570 (princ "\n")))
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
571 (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
572 (when charsets
20731
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
573 (if (eq charsets t)
24691
0f6ca131ad9c (describe-coding-system): Fix English message.
Kenichi Handa <handa@m17n.org>
parents: 24161
diff changeset
574 (princ "This coding system can encode all charsets.\n")
20731
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
575 (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
576 (princ " ")
20731
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
577 (while charsets
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
578 (princ " ")
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
579 (princ (car charsets))
9fba656001e8 (describe-coding-system): Change the
Kenichi Handa <handa@m17n.org>
parents: 20170
diff changeset
580 (setq charsets (cdr charsets))))))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
581 (save-excursion
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
582 (set-buffer standard-output)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
583 (help-mode)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586 (defun describe-current-coding-system-briefly ()
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
587 "Display coding systems currently used in a brief format in echo area.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
589 The format is \"F[..],K[..],T[..],P>[..],P<[..], default F[..],P<[..],P<[..]\",
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
590 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
591 at the place of `..':
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
592 `buffer-file-coding-system` (of the current buffer)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
593 eol-type of buffer-file-coding-system (of the current buffer)
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
594 Value returned by `keyboard-coding-system'
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
595 eol-type of (keyboard-coding-system)
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
596 Value returned by `terminal-coding-system.
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
597 eol-type of (terminal-coding-system)
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
598 `process-coding-system' for read (of the current buffer, if any)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
599 eol-type of process-coding-system for read (of the current buffer, if any)
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
600 `process-coding-system' for write (of the current buffer, if any)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
601 eol-type of process-coding-system for write (of the current buffer, if any)
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
602 `default-buffer-file-coding-system'
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
603 eol-type of default-buffer-file-coding-system
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
604 `default-process-coding-system' for read
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
605 eol-type of default-process-coding-system for read
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
606 `default-process-coding-system' for write
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
607 eol-type of default-process-coding-system"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
608 (interactive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 (let* ((proc (get-buffer-process (current-buffer)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
610 (process-coding-systems (if proc (process-coding-system proc))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
611 (message
24865
a4b8bb7bed21 (describe-current-coding-system-briefly): Fix format string.
Kenichi Handa <handa@m17n.org>
parents: 24724
diff changeset
612 "F[%c%s],K[%c%s],T[%c%s],P>[%c%s],P<[%c%s], default F[%c%s],P>[%c%s],P<[%c%s]"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
613 (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
614 (coding-system-eol-type-mnemonic buffer-file-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
615 (coding-system-mnemonic (keyboard-coding-system))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
616 (coding-system-eol-type-mnemonic (keyboard-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
617 (coding-system-mnemonic (terminal-coding-system))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
618 (coding-system-eol-type-mnemonic (terminal-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
619 (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
620 (coding-system-eol-type-mnemonic (car process-coding-systems))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
621 (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
622 (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
623 (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
624 (coding-system-eol-type-mnemonic default-buffer-file-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
625 (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
626 (coding-system-eol-type-mnemonic (car default-process-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 (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
628 (coding-system-eol-type-mnemonic (cdr default-process-coding-system))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629 )))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
631 ;; Print symbol name and mnemonic letter of CODING-SYSTEM with `princ'.
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
632 (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
633 (if (not coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
634 (princ "nil\n")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
635 (princ (format "%c -- %s"
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
636 (coding-system-mnemonic coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
637 coding-system))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
638 (let ((aliases (coding-system-get coding-system 'alias-coding-systems)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
639 (if (eq coding-system (car aliases))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
640 (if (cdr aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
641 (princ (format " %S" (cons 'alias: (cdr aliases)))))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
642 (if (memq coding-system aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
643 (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
644 (princ "\n")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
645 (if (and doc-string
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
646 (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
647 (princ (format " %s\n" doc-string)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
648
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
649 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
650 (defun describe-current-coding-system ()
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
651 "Display coding systems currently used, in detail."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
652 (interactive)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
653 (with-output-to-temp-buffer "*Help*"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
654 (let* ((proc (get-buffer-process (current-buffer)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
655 (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
656 (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
657 (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
658 (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
659 (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
660 (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
661 (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
662 (princ "Coding system for keyboard input:\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
663 (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
664 (princ "Coding system for terminal output:\n ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
665 (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
666 (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
667 (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
668 (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
669 (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
670 (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
671 (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
672 (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
673 (princ " decoding: ")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
674 (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
675 (princ " encoding: ")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
676 (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
677
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
678 (save-excursion
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
679 (set-buffer standard-output)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
680
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
681 (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
682 (let ((l coding-category-list)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
683 (i 1)
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
684 (coding-list nil)
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
685 coding aliases)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
686 (while l
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
687 (setq coding (symbol-value (car l)))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
688 ;; Do not list up the same coding system twice.
22885
5effd15f2a18 (describe-current-coding-system):
Kenichi Handa <handa@m17n.org>
parents: 22339
diff changeset
689 (when (and coding (not (memq coding coding-list)))
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
690 (setq coding-list (cons coding coding-list))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
691 (princ (format " %d. %s " i coding))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
692 (setq aliases (coding-system-get coding 'alias-coding-systems))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
693 (if (eq coding (car aliases))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
694 (if (cdr aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
695 (princ (cons 'alias: (cdr aliases))))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
696 (if (memq coding aliases)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
697 (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
698 (terpri)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
699 (setq i (1+ i)))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
700 (setq l (cdr l))))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
701
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
702 (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
703 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
704 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
705
18799
6c0d648d2cf8 (describe-current-coding-system): Use coding-category-iso-7-else
Kenichi Handa <handa@m17n.org>
parents: 18696
diff changeset
706 (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
707 coding-system codings)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
708 (while categories
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
709 (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
710 (mapcar
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
711 (function
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
712 (lambda (x)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
713 (if (and (not (eq x coding-system))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
714 (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
715 (let ((flags (coding-system-flags x)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
716 (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
717 (setq codings (cons x codings)))))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
718 (get (car categories) 'coding-systems))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
719 (if codings
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
720 (let ((max-col (frame-width))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
721 pos)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
722 (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
723 (while codings
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
724 (setq pos (point))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
725 (insert (format " %s" (car codings)))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
726 (when (> (current-column) max-col)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
727 (goto-char pos)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
728 (insert "\n ")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
729 (goto-char (point-max)))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
730 (setq codings (cdr codings)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
731 (insert "\n\n")))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
732 (setq categories (cdr categories))))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
733
19081
f33df9d64fe8 (describe-current-coding-system): Clean up output format.
Richard M. Stallman <rms@gnu.org>
parents: 18799
diff changeset
734 (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
735 (terpri)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
736 (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
737 (princ " ---------\t--------------\t\t----------------\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
738 (let ((func (lambda (operation alist)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
739 (princ " ")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
740 (princ operation)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
741 (if (not alist)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
742 (princ "\tnothing specified\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
743 (while alist
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
744 (indent-to 16)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
745 (prin1 (car (car alist)))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
746 (if (>= (current-column) 40)
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
747 (newline))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
748 (indent-to 40)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
749 (princ (cdr (car alist)))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
750 (princ "\n")
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
751 (setq alist (cdr alist)))))))
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
752 (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
753 (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
754 (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
755 (help-mode))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
756
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
757 ;; Print detailed information on CODING-SYSTEM.
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
758 (defun print-coding-system (coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
759 (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
760 (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
761 (flags (coding-system-flags coding-system))
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
762 (aliases (coding-system-get coding-system 'alias-coding-systems)))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
763 (if (not (eq (car aliases) coding-system))
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
764 (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
765 (princ coding-system)
20114
cbf191888430 (describe-coding-system): Print
Kenichi Handa <handa@m17n.org>
parents: 20092
diff changeset
766 (setq aliases (cdr aliases))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
767 (while aliases
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
768 (princ ",")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
769 (princ (car aliases))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
770 (setq aliases (cdr aliases)))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
771 (princ (format ":%s:%c:%d:"
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
772 type
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
773 (coding-system-mnemonic coding-system)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
774 (if (integerp eol-type) eol-type 3)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
775 (cond ((eq type 2) ; ISO-2022
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
776 (let ((idx 0)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
777 charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
778 (while (< idx 4)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
779 (setq charset (aref flags idx))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
780 (cond ((null charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
781 (princ -1))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
782 ((eq charset t)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
783 (princ -2))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
784 ((charsetp charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
785 (princ charset))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
786 ((listp charset)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
787 (princ "(")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
788 (princ (car charset))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
789 (setq charset (cdr charset))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
790 (while charset
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
791 (princ ",")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
792 (princ (car charset))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
793 (setq charset (cdr charset)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
794 (princ ")")))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
795 (princ ",")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
796 (setq idx (1+ idx)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
797 (while (< idx 12)
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
798 (princ (if (aref flags idx) 1 0))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
799 (princ ",")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
800 (setq idx (1+ idx)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
801 (princ (if (aref flags idx) 1 0))))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
802 ((eq type 4) ; CCL
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
803 (let (i len)
21967
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
804 (if (symbolp (car flags))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
805 (princ (format " %s" (car flags)))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
806 (setq i 0 len (length (car flags)))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
807 (while (< i len)
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
808 (princ (format " %x" (aref (car flags) i)))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
809 (setq i (1+ i))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
810 (princ ",")
21967
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
811 (if (symbolp (cdr flags))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
812 (princ (format "%s" (cdr flags)))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
813 (setq i 0 len (length (cdr flags)))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
814 (while (< i len)
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
815 (princ (format " %x" (aref (cdr flags) i)))
9f92d6a5254f (print-coding-system):
Richard M. Stallman <rms@gnu.org>
parents: 21469
diff changeset
816 (setq i (1+ i))))))
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
817 (t (princ 0)))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
818 (princ ":")
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
819 (princ (coding-system-doc-string coding-system))
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
820 (princ "\n"))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
821
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
822 ;;;###autoload
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
823 (defun list-coding-systems (&optional arg)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
824 "Display a list of all coding systems.
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
825 This shows the mnemonic letter, name, and description of each coding system.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
826
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
827 With prefix arg, the output format gets more cryptic,
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
828 but still contains full information about each coding system."
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
829 (interactive "P")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
830 (with-output-to-temp-buffer "*Help*"
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
831 (list-coding-systems-1 arg)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
832
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
833 (defun list-coding-systems-1 (arg)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
834 (if (null arg)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
835 (princ "\
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
836 ###############################################
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
837 # 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
838 # MNEMONIC-LETTER -- CODING-SYSTEM-NAME
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
839 # DOC-STRING
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
840 ")
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
841 (princ "\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
842 #########################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
843 ## LIST OF CODING SYSTEMS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
844 ## Each line corresponds to one coding system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
845 ## Format of a line is:
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
846 ## 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
847 ## :PRE-WRITE-CONVERSION:DOC-STRING,
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
848 ## where
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
849 ## NAME = coding system name
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
850 ## ALIAS = alias of the coding system
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
851 ## 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
852 ## 0 (EMACS-MULE), 1 (SJIS), 2 (ISO2022), 3 (BIG5), or 4 (CCL)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
853 ## EOL = 0 (LF), 1 (CRLF), 2 (CR), or 3 (Automatic detection)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
854 ## FLAGS =
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
855 ## if TYPE = 2 then
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
856 ## comma (`,') separated data of the followings:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
857 ## G0, G1, G2, G3, SHORT-FORM, ASCII-EOL, ASCII-CNTL, SEVEN,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
858 ## LOCKING-SHIFT, SINGLE-SHIFT, USE-ROMAN, USE-OLDJIS, NO-ISO6429
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
859 ## else if TYPE = 4 then
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
860 ## comma (`,') separated CCL programs for read and write
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
861 ## else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
862 ## 0
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
863 ## POST-READ-CONVERSION, PRE-WRITE-CONVERSION = function name to be called
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
864 ##
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
865 "))
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
866 (let ((bases (coding-system-list 'base-only))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
867 coding-system)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
868 (while bases
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
869 (setq coding-system (car bases))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
870 (if (null arg)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
871 (print-coding-system-briefly coding-system 'doc-string)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
872 (print-coding-system coding-system))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
873 (setq bases (cdr bases)))))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
874
26688
1830bc1903fb (list-coding-categories): Fix typo;
Gerd Moellmann <gerd@gnu.org>
parents: 26189
diff changeset
875 ;;;###autoload
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
876 (defun list-coding-categories ()
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
877 "Display a list of all coding categories."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
878 (with-output-to-temp-buffer "*Help*"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
879 (princ "\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
880 ############################
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
881 ## LIST OF CODING CATEGORIES (ordered by priority)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
882 ## CATEGORY:CODING-SYSTEM
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
883 ##
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
884 ")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
885 (let ((l coding-category-list))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
886 (while l
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
887 (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
888 (setq l (cdr l))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
889
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
890 ;;; FONT
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
891
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
892 ;; Print information of a font in FONTINFO.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
893 (defun describe-font-internal (font-info &optional verbose)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
894 (print-list "name (opened by):" (aref font-info 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
895 (print-list " full name:" (aref font-info 1))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
896 (let ((charset (aref font-info 2)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
897 (print-list " charset:"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
898 (format "%s (%s)" charset (charset-description charset))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
899 (print-list " size:" (format "%d" (aref font-info 3)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
900 (print-list " height:" (format "%d" (aref font-info 4)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
901 (print-list " baseline-offset:" (format "%d" (aref font-info 5)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
902 (print-list "relative-compose:" (format "%d" (aref font-info 6))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
903
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
904 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
905 (defun describe-font (fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
906 "Display information about fonts which partially match FONTNAME."
20092
2b49d1c59b83 (describe-font): Fix prompt.
Karl Heuer <kwzh@gnu.org>
parents: 19876
diff changeset
907 (interactive "sFontname (default, current choice for ASCII chars): ")
28216
cad26a9da36b (describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents: 27973
diff changeset
908 (or (and window-system (fboundp 'fontset-list))
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
909 (error "No fontsets being used"))
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
910 (when (or (not fontname) (= (length fontname) 0))
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
911 (setq fontname (cdr (assq 'font (frame-parameters))))
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
912 (if (query-fontset fontname)
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
913 (setq fontname
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
914 (nth 2 (assq 'ascii (aref (fontset-info fontname) 2))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
915 (let ((font-info (font-info fontname)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
916 (if (null font-info)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
917 (message "No matching font")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
918 (with-output-to-temp-buffer "*Help*"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
919 (describe-font-internal font-info 'verbose)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
920
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
921 ;; 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
922 ;; 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
923 ;; actually INSERT such information in the current buffer.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
924 (defun print-fontset (fontset &optional print-fonts)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
925 (let* ((fontset-info (fontset-info fontset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
926 (size (aref fontset-info 0))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
927 (height (aref fontset-info 1))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
928 (fonts (and print-fonts (aref fontset-info 2)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
929 (xlfd-fields (x-decompose-font-name fontset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
930 style)
19265
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
931 (if xlfd-fields
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
932 (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
933 (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
934 (if (string-match "^bold$\\|^demibold$" weight)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
935 (setq style (concat weight " "))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
936 (setq style "medium "))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
937 (cond ((string-match "^i$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
938 (setq style (concat style "italic")))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
939 ((string-match "^o$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
940 (setq style (concat style "slant")))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
941 ((string-match "^ri$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
942 (setq style (concat style "reverse italic")))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
943 ((string-match "^ro$" slant)
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
944 (setq style (concat style "reverse slant")))))
6b31dac7f72b (print-fontset): Don't hang even if a
Kenichi Handa <handa@m17n.org>
parents: 19081
diff changeset
945 (setq style " ? "))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
946 (beginning-of-line)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
947 (insert fontset)
18643
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
948 (indent-to 58)
28216
cad26a9da36b (describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents: 27973
diff changeset
949 (insert (if (and size (> size 0)) (format "%2dx%d" size height) " -"))
18643
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
950 (indent-to 64)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
951 (insert style "\n")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
952 (when print-fonts
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
953 (insert " O Charset / Fontname\n"
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
954 " - ------------------\n")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
955 (sort-charset-list)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
956 (let ((l charset-list)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
957 charset font-info opened fontname)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
958 (while l
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
959 (setq charset (car l) l (cdr l))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
960 (setq font-info (assq charset fonts))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
961 (if (null font-info)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
962 (setq opened ?? fontname "not specified")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
963 (if (nth 2 font-info)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
964 (if (stringp (nth 2 font-info))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
965 (setq opened ?o fontname (nth 2 font-info))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
966 (setq opened ?- fontname (nth 1 font-info)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
967 (setq opened ?x fontname (nth 1 font-info))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
968 (insert (format " %c %s\n %s\n"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
969 opened charset fontname)))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
970
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
971 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
972 (defun describe-fontset (fontset)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
973 "Display information of FONTSET.
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
974 This shows the name, size, and style of FONTSET, and the list of fonts
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
975 contained in FONTSET.
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
976
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
977 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
978 \(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
979 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
980 frame.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
981
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
982 The O column for each font contains one of the following letters:
18643
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
983 o -- font already opened
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
984 - -- font not yet opened
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
985 x -- font can't be opened
c9b94c6ab8f1 (print-fontset): Output format tuned.
Kenichi Handa <handa@m17n.org>
parents: 18559
diff changeset
986 ? -- no font specified
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
987
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
988 The Charset column for each font contains a name of character set
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
989 displayed (for this fontset) using that font."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
990 (interactive
28216
cad26a9da36b (describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents: 27973
diff changeset
991 (if (not (and window-system (fboundp 'fontset-list)))
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
992 (error "No fontsets being used")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
993 (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
994 (completion-ignore-case t))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
995 (list (completing-read
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
996 "Fontset (default, used by the current frame): "
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
997 fontset-list nil t)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
998 (if (= (length fontset) 0)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
999 (setq fontset (cdr (assq 'font (frame-parameters)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1000 (if (not (query-fontset fontset))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1001 (error "Current frame is using font, not fontset"))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1002 (let ((fontset-info (fontset-info fontset)))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1003 (with-output-to-temp-buffer "*Help*"
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1004 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1005 (set-buffer standard-output)
18696
1caf720e4f55 (print-fontset): Output format improved.
Kenichi Handa <handa@m17n.org>
parents: 18643
diff changeset
1006 (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
1007 (insert "------------\t\t\t\t\t\t ----- -----\n")
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1008 (print-fontset fontset t)))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1009
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1010 ;;;###autoload
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1011 (defun list-fontsets (arg)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1012 "Display a list of all fontsets.
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1013 This shows the name, size, and style of each fontset.
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1014 With prefix arg, it also list the fonts contained in each fontset;
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1015 see the function `describe-fontset' for the format of the list."
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1016 (interactive "P")
28216
cad26a9da36b (describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents: 27973
diff changeset
1017 (if (not (and window-system (fboundp 'fontset-list)))
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1018 (error "No fontsets being used")
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1019 (with-output-to-temp-buffer "*Help*"
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1020 (save-excursion
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1021 ;; This code is duplicated near the end of mule-diag.
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1022 (set-buffer standard-output)
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1023 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n")
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1024 (insert "------------\t\t\t\t\t\t ----- -----\n")
24161
782215de9b98 (list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents: 23582
diff changeset
1025 (let ((fontsets
782215de9b98 (list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents: 23582
diff changeset
1026 (sort (fontset-list)
782215de9b98 (list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents: 23582
diff changeset
1027 (function (lambda (x y)
782215de9b98 (list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents: 23582
diff changeset
1028 (string< (fontset-plain-name x)
782215de9b98 (list-fontsets): Sort fontsets by plain names.
Kenichi Handa <handa@m17n.org>
parents: 23582
diff changeset
1029 (fontset-plain-name y)))))))
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1030 (while fontsets
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1031 (print-fontset (car fontsets) arg)
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1032 (setq fontsets (cdr fontsets))))))))
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
1033
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
1034 ;;;###autoload
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
1035 (defun list-input-methods ()
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1036 "Display information about all input methods."
18300
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
1037 (interactive)
0436624abece (list-character-sets): Set major mode of *Help*
Kenichi Handa <handa@m17n.org>
parents: 18199
diff changeset
1038 (with-output-to-temp-buffer "*Help*"
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1039 (list-input-methods-1)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1040
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1041 (defun list-input-methods-1 ()
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1042 (if (not input-method-alist)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1043 (progn
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1044 (princ "
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1045 No input method is available, perhaps because you have not yet
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
1046 installed LEIM (Libraries of Emacs Input Method).
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
1047
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1048 LEIM is available from the same ftp directory as Emacs. For instance,
21979
ce6e1fa2fefc (list-input-methods): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21967
diff changeset
1049 if there exists an archive file `emacs-20.N.tar.gz', there should also
ce6e1fa2fefc (list-input-methods): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21967
diff changeset
1050 be a file `leim-20.N.tar.gz'. When you extract this file, LEIM files
ce6e1fa2fefc (list-input-methods): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 21967
diff changeset
1051 are put under the subdirectory `emacs-20.N/leim'. When you install
20163
5ff1329561b4 (list-input-methods): Handle the case
Kenichi Handa <handa@m17n.org>
parents: 20114
diff changeset
1052 Emacs again, you should be able to use various input methods."))
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1053 (princ "LANGUAGE\n NAME (`TITLE' in mode line)\n")
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1054 (princ " SHORT-DESCRIPTION\n------------------------------\n")
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1055 (setq input-method-alist
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1056 (sort input-method-alist
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1057 (function (lambda (x y) (string< (nth 1 x) (nth 1 y))))))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1058 (let ((l input-method-alist)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1059 language elt)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1060 (while l
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1061 (setq elt (car l) l (cdr l))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1062 (when (not (equal language (nth 1 elt)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1063 (setq language (nth 1 elt))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1064 (princ language)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1065 (terpri))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1066 (princ (format " %s (`%s' in mode line)\n %s\n"
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1067 (car elt)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1068 (let ((title (nth 3 elt)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1069 (if (and (consp title) (stringp (car title)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1070 (car title)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1071 title))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1072 (let ((description (nth 4 elt)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1073 (string-match ".*" description)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1074 (match-string 0 description))))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1075
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1076 ;;; DIAGNOSIS
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1077
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1078 ;; 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
1079 (defun insert-section (section-number title)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1080 (insert "########################################\n"
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1081 "# Section " (format "%d" section-number) ". " title "\n"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1082 "########################################\n\n"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1083
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1084 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1085 (defun mule-diag ()
24724
df2a95fa1429 (mule-diag): Change MULE to Mule in docstring.
Kenichi Handa <handa@m17n.org>
parents: 24691
diff changeset
1086 "Display diagnosis of the multilingual environment (Mule).
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1087
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1088 This shows various information related to the current multilingual
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1089 environment, including lists of input methods, coding systems,
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1090 character sets, and fontsets (if Emacs is running under a window
21469
ea652c41eec6 (list-input-methods): Fix doc string.
Karl Heuer <kwzh@gnu.org>
parents: 20731
diff changeset
1091 system which uses fontsets)."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1092 (interactive)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1093 (with-output-to-temp-buffer "*Mule-Diagnosis*"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1094 (save-excursion
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1095 (set-buffer standard-output)
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1096 (insert "###############################################\n"
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1097 "### Current Status of Multilingual Features ###\n"
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1098 "###############################################\n\n"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1099 "CONTENTS: Section 1. General Information\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1100 " Section 2. Display\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1101 " Section 3. Input methods\n"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1102 " Section 4. Coding systems\n"
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1103 " Section 5. Character sets\n")
28216
cad26a9da36b (describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents: 27973
diff changeset
1104 (if (and window-system (fboundp 'fontset-list))
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1105 (insert " Section 6. Fontsets\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1106 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1107
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1108 (insert-section 1 "General Information")
19425
572165bfff3e (mule-diag): Don't print primary-language.
Richard M. Stallman <rms@gnu.org>
parents: 19265
diff changeset
1109 (insert "Version of this emacs:\n " (emacs-version) "\n\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1110
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1111 (insert-section 2 "Display")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1112 (if window-system
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1113 (insert "Window-system: "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1114 (symbol-name window-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1115 (format "%s" window-system-version))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1116 (insert "Terminal: " (getenv "TERM")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1117 (insert "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1118
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1119 (if (eq window-system 'x)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1120 (let ((font (cdr (assq 'font (frame-parameters)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1121 (insert "The selected frame is using the "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1122 (if (query-fontset font) "fontset" "font")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1123 ":\n\t" font))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1124 (insert "Coding system of the terminal: "
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1125 (symbol-name (terminal-coding-system))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1126 (insert "\n\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1127
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1128 (insert-section 3 "Input methods")
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1129 (list-input-methods-1)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1130 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1131 (if default-input-method
26189
88faf40281cd (mule-diag): Handle the case that
Kenichi Handa <handa@m17n.org>
parents: 24865
diff changeset
1132 (insert (format "Default input method: %s\n" default-input-method))
19657
940d50684d68 (describe-current-coding-system): Add missing newline in output.
Richard M. Stallman <rms@gnu.org>
parents: 19557
diff changeset
1133 (insert "No default input method is specified\n"))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1134
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1135 (insert-section 4 "Coding systems")
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1136 (list-coding-systems-1 t)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1137 (princ "\
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1138 ############################
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1139 ## LIST OF CODING CATEGORIES (ordered by priority)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1140 ## CATEGORY:CODING-SYSTEM
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1141 ##
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1142 ")
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1143 (let ((l coding-category-list))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1144 (while l
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1145 (princ (format "%s:%s\n" (car l) (symbol-value (car l))))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1146 (setq l (cdr l))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1147 (insert "\n")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1148
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1149 (insert-section 5 "Character sets")
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
1150 (list-character-sets-2)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1151 (insert "\n")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1152
28216
cad26a9da36b (describe-font): Don't refer to
Kenichi Handa <handa@m17n.org>
parents: 27973
diff changeset
1153 (when (and window-system (fboundp 'fontset-list))
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1154 ;; This code duplicates most of list-fontsets.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1155 (insert-section 6 "Fontsets")
22339
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1156 (insert "Fontset-Name\t\t\t\t\t\t WDxHT Style\n")
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1157 (insert "------------\t\t\t\t\t\t ----- -----\n")
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1158 (let ((fontsets (fontset-list)))
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1159 (while fontsets
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1160 (print-fontset (car fontsets) t)
69de59462e22 (list-character-sets-1): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 22306
diff changeset
1161 (setq fontsets (cdr fontsets)))))
22290
31291d62195e (mule-diag): Don't call help-mode.
Karl Heuer <kwzh@gnu.org>
parents: 21979
diff changeset
1162 (print-help-return-message))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1163
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1164
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1165 ;;; DUMP DATA FILE
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1166
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1167 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1168 (defun dump-charsets ()
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1169 "Dump information about all charsets into the file `CHARSETS'.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1170 The file is saved in the directory `data-directory'."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1171 (let ((file (expand-file-name "CHARSETS" data-directory))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1172 buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1173 (or (file-writable-p file)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1174 (error "Can't write to file %s" file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1175 (setq buf (find-file-noselect file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1176 (save-window-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1177 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1178 (set-buffer buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1179 (setq buffer-read-only nil)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1180 (erase-buffer)
27912
ed26ed5b0afc (list-character-sets): Completely
Kenichi Handa <handa@m17n.org>
parents: 26688
diff changeset
1181 (list-character-sets-2)
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1182 (insert-buffer-substring "*Help*")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1183 (let (make-backup-files
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1184 coding-system-for-write)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1185 (save-buffer))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1186 (kill-buffer buf))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1187 (if noninteractive
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1188 (kill-emacs)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1189
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1190 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1191 (defun dump-codings ()
22306
6819832df39b Many doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22290
diff changeset
1192 "Dump information about all coding systems into the file `CODINGS'.
18559
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1193 The file is saved in the directory `data-directory'."
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1194 (let ((file (expand-file-name "CODINGS" data-directory))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1195 buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1196 (or (file-writable-p file)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1197 (error "Can't write to file %s" file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1198 (setq buf (find-file-noselect file))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1199 (save-window-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1200 (save-excursion
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1201 (set-buffer buf)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1202 (setq buffer-read-only nil)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1203 (erase-buffer)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1204 (list-coding-systems t)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1205 (insert-buffer-substring "*Help*")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1206 (list-coding-categories)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1207 (insert-buffer-substring "*Help*")
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1208 (let (make-backup-files
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1209 coding-system-for-write)
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1210 (save-buffer))))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1211 (kill-buffer buf))
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1212 (if noninteractive
20369fbd0f91 (print-list): Use macro when.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
1213 (kill-emacs)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1214
18199
15177bdb2fcf (describe-coding-system): Change format of output.
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
1215 ;;; mule-diag.el ends here