XEmacs 21.2.11
[chise/xemacs-chise.git.1] / lisp / mule / european.el
1 ;;; european.el --- Support for European languages
2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
6
7 ;; Keywords: multilingual, European
8
9 ;; This file is part of XEmacs.
10
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING.  If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ;; 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;; For Europeans, five character sets ISO8859-1,2,3,4,9 are supported.
29
30 ;;; Code:
31
32 ;; For syntax of Latin-1 characters.
33 (loop for c from 64 to 127              ; from '\e,A@\e(B' to '\e,A\7f\e(B'
34       do (modify-syntax-entry (make-char 'latin-iso8859-1 c) "w"))
35
36 (modify-syntax-entry (make-char 'latin-iso8859-1 32) "w") ; no-break space
37 (modify-syntax-entry ?\e,AW\e(B "_")
38 (modify-syntax-entry ?\e,Aw\e(B "_")
39
40 ;; For syntax of Latin-2
41 (loop for c in '(?\e,B!\e(B ?\e,B#\e(B ?\e,B%\e(B ?\e,B&\e(B ?\e,B)\e(B ?\e,B*\e(B ?\e,B+\e(B ?\e,B,\e(B ?\e,B.\e(B ?\e,B/\e(B ?\e,B1\e(B ?\e,B3\e(B ?\e,B5\e(B ?\e,B6\e(B ?\e,B9\e(B ?\e,B:\e(B ?\e,B;\e(B ?\e,B<\e(B)
42       do (modify-syntax-entry c "w"))
43
44 (loop for c from 62 to 126
45       do (modify-syntax-entry (make-char 'latin-iso8859-2 c) "w"))
46
47 (modify-syntax-entry (make-char 'latin-iso8859-2 32) "w") ; no-break space
48 (modify-syntax-entry ?\e,BW\e(B ".")
49 (modify-syntax-entry ?\e,Bw\e(B ".")
50
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52 ;;; EUROPEANS
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54
55 ;; (define-prefix-command 'describe-european-environment-map)
56 ;; (define-key-after describe-language-environment-map [European]
57 ;;   '("European" . describe-european-environment-map)
58 ;;   t)
59
60 ;; (define-prefix-command 'setup-european-environment-map)
61 ;; (define-key-after setup-language-environment-map [European]
62 ;;   '("European" . setup-european-environment-map)
63 ;;   t)
64
65 ;; Setup for LANGAUGE which uses one-byte 8-bit CHARSET, one-byte
66 ;; 8-bit CODING-SYSTEM, and INPUT-METHOD.
67 (defun setup-8-bit-environment (language charset coding-system input-method)
68   (setup-english-environment)
69   (set-default-coding-systems coding-system)
70   ;; (setq coding-category-iso-8-1 coding-system
71   ;;       coding-category-iso-8-2 coding-system)
72   (set-coding-category-system 'iso-8-1 coding-system)
73   (set-coding-category-system 'iso-8-2 coding-system)
74
75   ;; (if charset
76   ;;     (let ((nonascii-offset (- (make-char charset) 128)))
77   ;;       ;; Set up for insertion of characters in this character set
78   ;;       ;; when codes 0200 - 0377 are typed in.
79   ;;       (setq nonascii-insert-offset nonascii-offset)))
80
81   (if input-method
82       (setq default-input-method input-method))
83
84   ;; If this is a Latin-N character set, set up syntax for it in
85   ;; single-byte mode.  We can't use require because the file
86   ;; must be eval'd each time in case we change from one Latin-N to another.
87   ;; (if (string-match "^Latin-\\([1-9]\\)$" language)
88   ;;     (load (downcase language) nil t))
89   )
90 \f
91 ;; Latin-1 (ISO-8859-1)
92
93 ;; (make-coding-system
94 ;;  'iso-latin-1 2 ?1
95 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-1, Compound Text Encoding)"
96 ;;  '((ascii t) (latin-iso8859-1 t) nil nil
97 ;;    nil ascii-eol ascii-cntl nil nil nil nil nil nil nil nil nil t))
98
99 ;; (define-coding-system-alias 'iso-8859-1 'iso-latin-1)
100 ;; (define-coding-system-alias 'latin-1 'iso-latin-1)
101 ;; (define-coding-system-alias 'ctext 'iso-latin-1)
102
103 (defun setup-latin1-environment ()
104   "Set up multilingual environment (MULE) for European Latin-1 users."
105   (interactive)
106   (setup-8-bit-environment "Latin-1" 'latin-iso8859-1 'iso-8859-1
107                            "latin-1-prefix"))
108
109 (set-language-info-alist
110  "Latin-1" '((setup-function . (setup-latin1-environment
111                                 . setup-european-environment-map))
112              (charset . (ascii latin-iso8859-1))
113              (coding-system . (iso-8859-1))
114              (sample-text
115               . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
116              (documentation . ("\
117 These languages are supported with the Latin-1 (ISO-8859-1) character set:
118  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
119  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
120 " . describe-european-environment-map))
121              ))
122
123 (set-language-info-alist
124  "German" '((setup-function . (setup-latin1-environment
125                                 . setup-european-environment-map))
126              (charset . (ascii latin-iso8859-1))
127              (coding-system . (iso-8859-1))
128              (tutorial . "TUTORIAL.de")
129              (sample-text
130               . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
131              (documentation . ("\
132 These languages are supported with the Latin-1 (ISO-8859-1) character set:
133  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
134  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
135 " . describe-european-environment-map))
136              ))
137
138 (set-language-info-alist
139  "French" '((setup-function . (setup-latin1-environment
140                                 . setup-european-environment-map))
141              (charset . (ascii latin-iso8859-1))
142              (coding-system . (iso-8859-1))
143              (tutorial . "TUTORIAL.fr")
144              (sample-text
145               . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
146              (documentation . ("\
147 These languages are supported with the Latin-1 (ISO-8859-1) character set:
148  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
149  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
150 " . describe-european-environment-map))
151              ))
152
153 (set-language-info-alist
154  "Norwegian" '((setup-function . (setup-latin1-environment
155                                 . setup-european-environment-map))
156              (charset . (ascii latin-iso8859-1))
157              (coding-system . (iso-8859-1))
158              (tutorial . "TUTORIAL.no")
159              (sample-text
160               . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
161              (documentation . ("\
162 These languages are supported with the Latin-1 (ISO-8859-1) character set:
163  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
164  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
165 " . describe-european-environment-map))
166              ))
167 \f
168 ;; Latin-2 (ISO-8859-2)
169
170 ;; (make-coding-system
171 ;;  'iso-latin-2 2 ?2
172 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-2)"
173 ;;  '((ascii t) (latin-iso8859-2 t) nil nil
174 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
175
176 ;; (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
177 ;; (define-coding-system-alias 'latin-2 'iso-latin-2)
178
179 (make-coding-system
180  'iso-8859-2 'iso2022 "MIME ISO-8859-2"
181  '(charset-g0 ascii
182    charset-g1 latin-iso8859-2
183    charset-g2 t
184    charset-g3 t
185    mnemonic "MIME/Ltn-2"
186    ))
187
188 (defun setup-latin2-environment ()
189   "Set up multilingual environment (MULE) for European Latin-2 users."
190   (interactive)
191   (setup-8-bit-environment "Latin-2" 'latin-iso8859-2 'iso-8859-2
192                            "latin-2-prefix"))
193
194 (set-language-info-alist
195  "Latin-2" '((setup-function . (setup-latin2-environment
196                                 . setup-european-environment-map))
197              (charset . (ascii latin-iso8859-2))
198              (coding-system . (iso-8859-2))
199              (documentation . ("\
200 These languages are supported with the Latin-2 (ISO-8859-2) character set:
201  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
202  Serbian, Croatian, Slovak, Slovene, and Swedish.
203 " . describe-european-environment-map))
204              ))
205
206 (set-language-info-alist
207  "Croatian" '((setup-function . (setup-latin2-environment
208                                 . setup-european-environment-map))
209               (charset . (ascii latin-iso8859-2))
210               (tutorial . "TUTORIAL.hr")
211               (coding-system . (iso-8859-2))
212               (documentation . ("\
213 These languages are supported with the Latin-2 (ISO-8859-2) character set:
214  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
215  Serbian, Croatian, Slovak, Slovene, and Swedish.
216 " . describe-european-environment-map))
217               ))
218
219 (set-language-info-alist
220  "Polish" '((setup-function . (setup-latin2-environment
221                                 . setup-european-environment-map))
222               (charset . (ascii latin-iso8859-2))
223               (tutorial . "TUTORIAL.pl")
224               (coding-system . (iso-8859-2))
225               (documentation . ("\
226 These languages are supported with the Latin-2 (ISO-8859-2) character set:
227  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
228  Serbian, Croatian, Slovak, Slovene, and Swedish.
229 " . describe-european-environment-map))
230               ))
231
232 (set-language-info-alist
233  "Romanian" '((setup-function . (setup-latin2-environment
234                                  . setup-european-environment-map))
235               (charset . (ascii latin-iso8859-2))
236               (tutorial . "TUTORIAL.ro")
237               (coding-system . (iso-8859-2))
238               (documentation . ("\
239 These languages are supported with the Latin-2 (ISO-8859-2) character set:
240  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
241  Serbian, Croatian, Slovak, Slovene, and Swedish.
242 " . describe-european-environment-map))
243               ))
244 \f
245 ;; Latin-3 (ISO-8859-3)
246
247 ;; (make-coding-system
248 ;;  'iso-latin-3 2 ?3
249 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-3)"
250 ;;  '((ascii t) (latin-iso8859-3 t) nil nil
251 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
252
253 ;; (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
254 ;; (define-coding-system-alias 'latin-3 'iso-latin-3)
255
256 (make-coding-system
257  'iso-8859-3 'iso2022 "MIME ISO-8859-3"
258  '(charset-g0 ascii
259    charset-g1 latin-iso8859-3
260    charset-g2 t
261    charset-g3 t
262    mnemonic "MIME/Ltn-3"
263    ))
264
265 (defun setup-latin3-environment ()
266   "Set up multilingual environment (MULE) for European Latin-3 users."
267   (interactive)
268   (setup-8-bit-environment "Latin-3" 'latin-iso8859-3 'iso-8859-3
269                            "latin-3-prefix"))
270
271 (set-language-info-alist
272  "Latin-3" '((setup-function . (setup-latin3-environment
273                                 . setup-european-environment-map))
274              (charset . (ascii latin-iso8859-3))
275              (coding-system . (iso-8859-3))
276              (documentation . ("\
277 These languages are supported with the Latin-3 (ISO-8859-3) character set:
278  Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
279  German, Italian, Maltese, Spanish, and Turkish.
280 " . describe-european-environment-map))
281              ))
282 \f
283 ;; Latin-4 (ISO-8859-4)
284
285 ;; (make-coding-system
286 ;;  'iso-latin-4 2 ?4
287 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-4)"
288 ;;  '((ascii t) (latin-iso8859-4 t) nil nil
289 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
290
291 ;; (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
292 ;; (define-coding-system-alias 'latin-4 'iso-latin-4)
293
294 (make-coding-system
295  'iso-8859-4 'iso2022 "MIME ISO-8859-4"
296  '(charset-g0 ascii
297    charset-g1 latin-iso8859-4
298    charset-g2 t
299    charset-g3 t
300    mnemonic "MIME/Ltn-4"
301    ))
302
303 (defun setup-latin4-environment ()
304   "Set up multilingual environment (MULE) for European Latin-4 users."
305   (interactive)
306   (setup-8-bit-environment "Latin-4" 'latin-iso8859-4 'iso-8859-4
307                            "latin-4-prefix"))
308
309 (set-language-info-alist
310  "Latin-4" '((setup-function . (setup-latin4-environment
311                                 . setup-european-environment-map))
312              (charset . (ascii latin-iso8859-4))
313              (coding-system . (iso-8859-4))
314              (documentation . ("\
315 These languages are supported with the Latin-4 (ISO-8859-4) character set:
316  Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
317  Latvian, Lithuanian, and Norwegian.
318 " . describe-european-environment-map))
319              ))
320 \f
321 ;; Latin-5 (ISO-8859-9)
322
323 ;; (make-coding-system
324 ;;  'iso-latin-5 2 ?9
325 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-9)"
326 ;;  '((ascii t) (latin-iso8859-9 t) nil nil
327 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
328
329 ;; (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
330 ;; (define-coding-system-alias 'latin-5 'iso-latin-5)
331
332 (make-coding-system
333  'iso-8859-9 'iso2022 "MIME ISO-8859-9"
334  '(charset-g0 ascii
335    charset-g1 latin-iso8859-9
336    charset-g2 t
337    charset-g3 t
338    mnemonic "MIME/Ltn-5"
339    ))
340
341 (defun setup-latin5-environment ()
342   "Set up multilingual environment (MULE) for European Latin-5 users."
343   (interactive)
344   (setup-8-bit-environment "Latin-5" 'latin-iso8859-9 'iso-8859-5
345                            "latin-5-prefix"))
346
347 (set-language-info-alist
348  "Latin-5" '((setup-function . (setup-latin5-environment
349                                 . setup-european-environment-map))
350              (charset . (ascii latin-iso8859-9))
351              (coding-system . (iso-8859-5))
352              (documentation . ("\
353 These languages are supported with the Latin-5 (ISO-8859-9) character set.
354 " . describe-european-environment-map))
355              ))
356
357 ;; (defun setup-european-environment ()
358 ;;   "Setup multilingual environment (MULE) for European languages users.
359 ;; It actually reset MULE to the default status, and
360 ;; set quail-latin-1 as the default input method to be selected.
361 ;; See also the documentation of setup-english-environment."
362 ;;   (setup-english-environment)
363 ;;   (setq default-input-method '("European" . "quail-latin-1")))
364
365 ;; (defun describe-european-support ()
366 ;;   "Describe how Emacs support European languages."
367 ;;   (interactive)
368 ;;   (describe-language-support-internal "European"))
369
370 ;; (set-language-info-alist
371 ;;  "European" '((setup-function . setup-european-environment)
372 ;;               (describe-function . describe-european-support)
373 ;;               (charset . (ascii latin-iso8859-1 latin-iso8859-2
374 ;;                           latin-iso8859-3 latin-iso8859-4 latin-iso8859-9))
375 ;;               (coding-system . (iso-8859-1 iso-8859-2 iso-8859-3
376 ;;                                 iso-8859-4 iso-8859-9))
377 ;;               (sample-text
378 ;;                . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
379 ;;               (documentation . "\
380 ;; Almost all of European languages are supported by the character sets and
381 ;; coding systems listed below.
382 ;; To input them, LEIM (Libraries for Emacs Input Methods) should have been
383 ;; installed.")
384 ;;               ))
385
386 ;;; european.el ends here