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