annotate lisp/international/mule-diag.el @ 27772:11a8d125f241

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