]> code.delx.au - gnu-emacs/blob - lisp/international/mule-conf.el
Add more information in descriptions of character sets.
[gnu-emacs] / lisp / international / mule-conf.el
1 ;;; mule-conf.el --- configure multilingual environment
2
3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5
6 ;; Keywords: mule, multilingual, character set, coding system
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; Don't byte-compile this file.
28
29 ;;; Code:
30
31 ;;; Definitions of character sets.
32
33 ;; Basic (official) character sets. These character sets are treated
34 ;; efficiently with respect to buffer memory.
35
36 ;; Syntax:
37 ;; (define-charset CHARSET-ID CHARSET
38 ;; [ DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE
39 ;; SHORT-NAME LONG-NAME DESCRIPTION ])
40 ;; ASCII charset is defined in src/charset.c as below.
41 ;; (define-charset 0 ascii
42 ;; [1 94 1 0 ?B 0 "ASCII" "ASCII" "ASCII (ISO646 IRV)"])
43
44 (define-charset 129 'latin-iso8859-1
45 [1 96 1 0 ?A 1 "RHP of Latin-1" "RHP of Latin-1 (ISO 8859-1): ISO-IR-100"
46 "Right-Hand Part of Latin Alphabet 1 (ISO/IEC 8859-1): ISO-IR-100"])
47 (define-charset 130 'latin-iso8859-2
48 [1 96 1 0 ?B 1 "RHP of Latin-2" "RHP of Latin-2 (ISO 8859-2): ISO-IR-101"
49 "Right-Hand Part of Latin Alphabet 2 (ISO/IEC 8859-2): ISO-IR-101"])
50 (define-charset 131 'latin-iso8859-3
51 [1 96 1 0 ?C 1 "RHP of Latin-3" "RHP of Latin-3 (ISO 8859-3): ISO-IR-109"
52 "Right-Hand Part of Latin Alphabet 3 (ISO/IEC 8859-3): ISO-IR-109"])
53 (define-charset 132 'latin-iso8859-4
54 [1 96 1 0 ?D 1 "RHP of Latin-4" "RHP of Latin-4 (ISO 8859-4): ISO-IR-110"
55 "Right-Hand Part of Latin Alphabet 4 (ISO/IEC 8859-4): ISO-IR-110"])
56 (define-charset 133 'thai-tis620
57 [1 96 1 0 ?T 1 "RHP of TIS620" "RHP of Thai (TIS620): ISO-IR-166"
58 "Right-Hand Part of TIS620.2533 (Thai): ISO-IR-166"])
59 (define-charset 134 'greek-iso8859-7
60 [1 96 1 0 ?F 1 "RHP of ISO8859/7" "RHP of Greek (ISO 8859-7): ISO-IR-126"
61 "Right-Hand Part of Latin/Greek Alphabet (ISO/IEC 8859-7): ISO-IR-126"])
62 (define-charset 135 'arabic-iso8859-6
63 [1 96 1 1 ?G 1 "RHP of ISO8859/6" "RHP of Arabic (ISO 8859-6): ISO-IR-127"
64 "Right-Hand Part of Latin/Alabic Alphabet (ISO/IEC 8859-6): ISO-IR-127"])
65 (define-charset 136 'hebrew-iso8859-8
66 [1 96 1 1 ?H 1 "RHP of ISO8859/8" "RHP of Hebrew (ISO 8859-8): ISO-IR-138"
67 "Right-Hand Part of Latin/Hebrew Alphabet (ISO/IEC 8859-8): ISO-IR-138"])
68 (define-charset 137 'katakana-jisx0201
69 [1 94 1 0 ?I 1 "JISX0201 Katakana" "Japanese Katakana (JISX0201.1976)"
70 "Katakana Part of JISX0201.1976"])
71 (define-charset 138 'latin-jisx0201
72 [1 94 1 0 ?J 0 "JISX0201 Roman" "Japanese Roman (JISX0201.1976)"
73 "Roman Part of JISX0201.1976"])
74 (define-charset 140 'cyrillic-iso8859-5
75 [1 96 1 0 ?L 1 "RHP of ISO8859/5" "RHP of Cyrillic (ISO 8859-5): ISO-IR-144"
76 "Right-Hand Part of Latin/Cyrillic Alphabet (ISO/IEC 8859-5): ISO-IR-144"])
77 (define-charset 141 'latin-iso8859-9
78 [1 96 1 0 ?M 1 "RHP of Latin-5" "RHP of Latin-5 (ISO 8859-9): ISO-IR-148"
79 "Right-Hand Part of Latin Alphabet 5 (ISO/IEC 8859-9): ISO-IR-148"])
80 (define-charset 142 'latin-iso8859-15
81 [1 96 1 0 ?b 1 "RHP of Latin-9" "RHP of Latin-9 (ISO 8859-15): ISO-IR-203"
82 "Right-Hand Part of Latin Alphabet 9 (ISO/IEC 8859-15): ISO-IR-203"])
83 (define-charset 143 'latin-iso8859-14
84 [1 96 1 0 ?_ 1 "RHP of Latin-8" "RHP of Latin-8 (ISO 8859-14)"
85 "Right-Hand Part of Latin Alphabet 8 (ISO/IEC 8859-14)"])
86 (define-charset 144 'japanese-jisx0208-1978
87 [2 94 2 0 ?@ 0 "JISX0208.1978" "JISX0208.1978 (Japanese): ISO-IR-42"
88 "JISX0208.1978 Japanese Kanji (so called \"old JIS\"): ISO-IR-42"])
89 (define-charset 145 'chinese-gb2312
90 [2 94 2 0 ?A 0 "GB2312" "GB2312: ISO-IR-58"
91 "GB2312 Chinese simplified: ISO-IR-58"])
92 (define-charset 146 'japanese-jisx0208
93 [2 94 2 0 ?B 0 "JISX0208" "JISX0208.1983/1990 (Japanese): ISO-IR-87"
94 "JISX0208.1983/1990 Japanese Kanji: ISO-IR-87"])
95 (define-charset 147 'korean-ksc5601
96 [2 94 2 0 ?C 0 "KSC5601" "KSC5601 (Korean): ISO-IR-149"
97 "KSC5601 Korean Hangul and Hanja: ISO-IR-149"])
98 (define-charset 148 'japanese-jisx0212
99 [2 94 2 0 ?D 0 "JISX0212" "JISX0212 (Japanese): ISO-IR-159"
100 "JISX0212 Japanese supplement: ISO-IR-159"])
101 (define-charset 149 'chinese-cns11643-1
102 [2 94 2 0 ?G 0 "CNS11643-1" "CNS11643-1 (Chinese traditional): ISO-IR-171"
103 "CNS11643 Plane 1 Chinese traditional: ISO-IR-171"])
104 (define-charset 150 'chinese-cns11643-2
105 [2 94 2 0 ?H 0 "CNS11643-2" "CNS11643-2 (Chinese traditional): ISO-IR-172"
106 "CNS11643 Plane 2 Chinese traditional: ISO-IR-172"])
107 (define-charset 152 'chinese-big5-1
108 [2 94 2 0 ?0 0 "Big5 (Level-1)" "Big5 (Level-1) A141-C67F"
109 "Frequentry used part (A141-C67F) of Big5 (Chinese traditional)"])
110 (define-charset 153 'chinese-big5-2
111 [2 94 2 0 ?1 0 "Big5 (Level-2)" "Big5 (Level-2) C940-FEFE"
112 "Less frequentry used part (C940-FEFE) of Big5 (Chinese traditional)"])
113
114 ;; Additional (private) character sets. These character sets are
115 ;; treated less space-efficiently in the buffer.
116
117 ;; Syntax:
118 ;; (define-charset nil CHARSET
119 ;; [ DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE
120 ;; SHORT-NAME LONG-NAME DESCRIPTION ])
121
122 ;; ISO-2022 allows a use of character sets not registered in ISO with
123 ;; final characters `0' (0x30) through `?' (0x3F). Among them, Emacs
124 ;; reserves `0' through `9' to support several private character sets.
125 ;; The remaining final characters `:' through `?' are for users.
126
127 (define-charset nil 'chinese-sisheng
128 [1 94 1 0 ?0 0 "SiSheng" "SiSheng (PinYin/ZhuYin)"
129 "SiSheng characters for PinYin/ZhuYin"])
130
131 ;; IPA characters for phonetic symbols.
132 (define-charset nil 'ipa
133 [1 96 1 0 ?0 1 "IPA" "IPA" "IPA (International Phonetic Association)"])
134
135 ;; Vietnamese VISCII. VISCII is 1-byte character set which contains
136 ;; more than 96 characters. Since Emacs can't handle it as one
137 ;; character set, it is divided into two: lower case letters and upper
138 ;; case letters.
139 (define-charset nil 'vietnamese-viscii-lower
140 [1 96 1 0 ?1 1 "VISCII lower" "VISCII lower-case" "VISCII1.1 lower-case"])
141 (define-charset nil 'vietnamese-viscii-upper
142 [1 96 1 0 ?2 1 "VISCII upper" "VISCII upper-case" "VISCII1.1 upper-case"])
143
144 ;; For Arabic, we need three different types of character sets.
145 ;; Digits are of direction left-to-right and of width 1-column.
146 ;; Others are of direction right-to-left and of width 1-column or
147 ;; 2-column.
148 (define-charset nil 'arabic-digit
149 [1 94 1 0 ?2 0 "Arabic digit" "Arabic digit" "Arabic digit"])
150 (define-charset nil 'arabic-1-column
151 [1 94 1 1 ?3 0 "Arabic 1-col" "Arabic 1-column" "Arabic 1-column"])
152 (define-charset nil 'arabic-2-column
153 [1 94 2 1 ?4 0 "Arabic 2-col" "Arabic 2-column" "Arabic 2-column"])
154
155 ;; Ethiopic characters (Amahric and Tigrigna).
156 (define-charset nil 'ethiopic
157 [2 94 2 0 ?3 0 "Ethiopic" "Ethiopic characters" "Ethiopic characters"])
158
159 ;; Chinese CNS11643 Plane3 thru Plane7. Although these are official
160 ;; character sets, the use is rare and don't have to be treated
161 ;; space-efficiently in the buffer.
162 (define-charset nil 'chinese-cns11643-3
163 [2 94 2 0 ?I 0 "CNS11643-3" "CNS11643-3 (Chinese traditional): ISO-IR-183"
164 "CNS11643 Plane 3 Chinese Traditional: ISO-IR-183"])
165 (define-charset nil 'chinese-cns11643-4
166 [2 94 2 0 ?J 0 "CNS11643-4" "CNS11643-4 (Chinese traditional): ISO-IR-184"
167 "CNS11643 Plane 4 Chinese Traditional: ISO-IR-184"])
168 (define-charset nil 'chinese-cns11643-5
169 [2 94 2 0 ?K 0 "CNS11643-5" "CNS11643-5 (Chinese traditional): ISO-IR-185"
170 "CNS11643 Plane 5 Chinese Traditional: ISO-IR-185"])
171 (define-charset nil 'chinese-cns11643-6
172 [2 94 2 0 ?L 0 "CNS11643-6" "CNS11643-6 (Chinese traditional): ISO-IR-186"
173 "CNS11643 Plane 6 Chinese Traditional: ISO-IR-186"])
174 (define-charset nil 'chinese-cns11643-7
175 [2 94 2 0 ?M 0 "CNS11643-7" "CNS11643-7 (Chinese traditional): ISO-IR-187"
176 "CNS11643 Plane 7 Chinese Traditional: ISO-IR-187"])
177
178 ;; ASCII with right-to-left direction.
179 (define-charset nil 'ascii-right-to-left
180 [1 94 1 1 ?B 0 "rev ASCII" "ASCII with right-to-left direction"
181 "ASCII (left half of ISO 8859-1) with right-to-left direction"])
182
183 ;; Indian scripts. Symbolic charset for data exchange. Glyphs are
184 ;; not assigned. They are automatically converted to each Indian
185 ;; script which IS-13194 supports.
186
187 (define-charset nil 'indian-is13194
188 [1 94 2 0 ?5 1 "IS 13194" "Indian IS 13194"
189 "Generic Indian charset for data exchange with IS 13194"])
190 ;; Actual Glyph for 2-column width.
191 (define-charset nil 'indian-2-column
192 [2 94 2 0 ?5 0 "Indian 2-col" "Indian 2 Column"
193 "Indian charset for 2-column width glyphs"])
194 ;; Actual Glyph for 1-column width.
195 (define-charset nil 'indian-1-column
196 [2 94 1 0 ?6 0 "Indian 1-col" "Indian 1 Column"
197 "Indian charset for 2-column width glyphs"])
198
199 ;; Lao script.
200 ;; ISO10646's 0x0E80..0x0EDF are mapped to 0x20..0x7F.
201 (define-charset nil 'lao
202 [1 94 1 0 ?1 0 "Lao" "Lao" "Lao characters (ISO10646 0E80..0EDF)"])
203
204 ;; Tibetan script.
205 (define-charset nil 'tibetan
206 [2 94 2 0 ?7 0 "Tibetan 2-col" "Tibetan 2 column" "Tibetan characters"])
207 (define-charset nil 'tibetan-1-column
208 [2 94 1 0 ?8 0 "Tibetan 1-col" "Tibetan 1 column" "Tibetan 1 column glyph"])
209
210 ;; Tell C code charset ID's of several charsets.
211 (setup-special-charsets)
212
213 \f
214 ;; These are tables for translating characters on decoding and
215 ;; encoding.
216 (define-translation-table
217 'oldjis-newjis-jisroman-ascii
218 (list (cons (make-char 'japanese-jisx0208-1978)
219 (make-char 'japanese-jisx0208))
220 (cons (make-char 'latin-jisx0201) (make-char 'ascii))))
221
222 (setq standard-translation-table-for-decode
223 (get 'oldjis-newjis-jisroman-ascii 'translation-table))
224
225 (setq standard-translation-table-for-encode nil)
226
227 \f
228 ;;; Make fundamental coding systems.
229
230 ;; Miscellaneous coding systems which can't be made by
231 ;; `make-coding-system'.
232
233 (put 'no-conversion 'coding-system
234 (vector nil ?= "Do no conversion"
235 (list 'coding-category 'coding-category-binary
236 'alias-coding-systems '(no-conversion))
237 nil))
238 (put 'no-conversion 'eol-type 0)
239 (put 'coding-category-binary 'coding-systems '(no-conversion))
240 (setq coding-system-list '(no-conversion))
241 (setq coding-system-alist '(("no-conversion")))
242
243 (define-coding-system-alias 'binary 'no-conversion)
244
245 (put 'undecided 'coding-system
246 (vector t ?- "No conversion on encoding, automatic conversion on decoding"
247 (list 'alias-coding-systems '(undecided)
248 'safe-charsets '(ascii))
249 nil))
250 (setq coding-system-list (cons 'undecided coding-system-list))
251 (setq coding-system-alist (cons '("undecided") coding-system-alist))
252 (put 'undecided 'eol-type
253 (make-subsidiary-coding-system 'undecided))
254
255 (define-coding-system-alias 'dos 'undecided-dos)
256 (define-coding-system-alias 'mac 'undecided-mac)
257
258 ;; Coding systems not specific to each language environment.
259
260 (make-coding-system
261 'emacs-mule 0 ?=
262 "Emacs internal format used in buffer and string"
263 nil
264 '((safe-charsets . t)))
265
266 (make-coding-system
267 'raw-text 5 ?t
268 "Raw text, which means text contains random 8-bit codes."
269 nil
270 '((safe-charsets . t)))
271
272 (make-coding-system
273 'iso-2022-7bit 2 ?J
274 "ISO 2022 based 7-bit encoding using only G0"
275 '((ascii t) nil nil nil
276 short ascii-eol ascii-cntl seven)
277 '((safe-charsets . t)
278 (composition . t)))
279
280 (make-coding-system
281 'iso-2022-7bit-ss2 2 ?$
282 "ISO 2022 based 7-bit encoding using SS2 for 96-charset"
283 '((ascii t) nil t nil
284 short ascii-eol ascii-cntl seven nil single-shift)
285 '((safe-charsets . t)
286 (composition . t)))
287
288 (make-coding-system
289 'iso-2022-7bit-lock 2 ?&
290 "ISO-2022 coding system using Locking-Shift for 96-charset"
291 '((ascii t) t nil nil
292 nil ascii-eol ascii-cntl seven locking-shift)
293 '((safe-charsets . t)
294 (composition . t)))
295
296 (define-coding-system-alias 'iso-2022-int-1 'iso-2022-7bit-lock)
297
298 (make-coding-system
299 'iso-2022-7bit-lock-ss2 2 ?i
300 "Mixture of ISO-2022-JP, ISO-2022-KR, and ISO-2022-CN"
301 '((ascii t)
302 (nil korean-ksc5601 chinese-gb2312 chinese-cns11643-1 t)
303 (nil chinese-cns11643-2)
304 (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5
305 chinese-cns11643-6 chinese-cns11643-7)
306 short ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil
307 init-bol)
308 '((safe-charsets ascii japanese-jisx0208 japanese-jisx0208-1978 latin-jisx0201
309 korean-ksc5601 chinese-gb2312 chinese-cns11643-1
310 chinese-cns11643-2 chinese-cns11643-3 chinese-cns11643-4
311 chinese-cns11643-5 chinese-cns11643-6 chinese-cns11643-7)
312 (composition . t)))
313
314 (define-coding-system-alias 'iso-2022-cjk 'iso-2022-7bit-lock-ss2)
315
316 (make-coding-system
317 'iso-2022-8bit-ss2 2 ?@
318 "ISO 2022 based 8-bit encoding using SS2 for 96-charset"
319 '((ascii t) nil t nil
320 nil ascii-eol ascii-cntl nil nil single-shift)
321 '((safe-charsets . t)
322 (composition . t)))
323
324 (make-coding-system
325 'x-ctext 2 ?x
326 "Compound text based generic encoding for decoding unknown messages."
327 '((ascii t) (latin-iso8859-1 t) t t
328 nil ascii-eol ascii-cntl nil locking-shift single-shift nil nil nil
329 init-bol nil nil)
330 '((safe-charsets . t)
331 (mime-charset . x-ctext)
332 (composition . t)))
333
334 (make-coding-system
335 'iso-safe 2 ?-
336 "Convert all characters but ASCII to `?'."
337 '(ascii nil nil nil
338 nil ascii-eol ascii-cntl nil nil nil nil nil nil nil nil t)
339 '((safe-charsets ascii)))
340
341 ;; Use iso-safe for terminal output if some other coding system is not
342 ;; specified explicitly.
343 (set-safe-terminal-coding-system-internal 'iso-safe)
344
345 ;; The other coding-systems are defined in each language specific
346 ;; section of languages.el.
347
348 ;; Normally, set coding system to `undecided' before reading a file.
349 ;; Compiled Emacs Lisp files (*.elc) are not decoded at all,
350 ;; but we regard them as containing multibyte characters.
351 ;; Tar files are not decoded at all, but we treat them as raw bytes.
352
353 (setq file-coding-system-alist
354 '(("\\.elc$" . (emacs-mule . emacs-mule))
355 ("\\(\\`\\|/\\)loaddefs.el$" . (no-conversion . no-conversion))
356 ("\\.tar$" . (no-conversion . no-conversion))
357 ("" . (undecided . nil))))
358
359 \f
360 ;;; Setting coding categories and their priorities.
361
362 ;; This setting is just to read an Emacs Lisp source files which
363 ;; contain multilingual text while dumping Emacs. More appropriate
364 ;; values are set by the command `set-language-environment' for each
365 ;; language environment.
366
367 (setq coding-category-emacs-mule 'emacs-mule
368 coding-category-sjis 'japanese-shift-jis
369 coding-category-iso-7 'iso-2022-7bit
370 coding-category-iso-7-tight 'iso-2022-jp
371 coding-category-iso-8-1 'iso-latin-1
372 coding-category-iso-8-2 'iso-latin-1
373 coding-category-iso-7-else 'iso-2022-7bit-lock
374 coding-category-iso-8-else 'iso-2022-8bit-ss2
375 coding-category-ccl nil
376 coding-category-utf-8 nil
377 coding-category-utf-16-be nil
378 coding-category-utf-16-le nil
379 coding-category-big5 'chinese-big5
380 coding-category-raw-text 'raw-text
381 coding-category-binary 'no-conversion)
382
383 (set-coding-priority
384 '(coding-category-iso-8-1
385 coding-category-iso-8-2
386 coding-category-iso-7-tight
387 coding-category-iso-7
388 coding-category-iso-7-else
389 coding-category-iso-8-else
390 coding-category-emacs-mule
391 coding-category-raw-text
392 coding-category-sjis
393 coding-category-big5
394 coding-category-ccl
395 coding-category-binary
396 coding-category-utf-16-be
397 coding-category-utf-16-le
398 coding-category-utf-8))
399
400 \f
401 ;;; Miscellaneous settings.
402 (aset latin-extra-code-table ?\222 t)
403
404 (update-coding-systems-internal)
405
406 ;;; mule-conf.el ends here