XEmacs 21.2.14.
[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 ;; Romanian support originally from romanian.el
233
234 (defun setup-romanian-environment ()
235   "Setup multilingual environment (MULE) for Romanian."
236   (interactive)
237   (setup-8-bit-environment "Romanian" 'latin-iso8859-2 'iso-8859-2
238                            "romanian"))
239
240 (set-language-info-alist
241  "Romanian" '((setup-function . (setup-romanian-environment
242                                  . setup-european-environment-map))
243               (charset . (ascii latin-iso8859-2))
244               (tutorial . "TUTORIAL.ro")
245               (coding-system . (iso-8859-2))
246               (documentation . ("\
247 These languages are supported with the Latin-2 (ISO-8859-2) character set:
248  Albanian, Czech, English, German, Hungarian, Polish, Romanian,
249  Serbian, Croatian, Slovak, Slovene, and Swedish.
250 " . describe-european-environment-map))
251               ))
252
253 ;; Czech support originally from czech.el
254 ;; Author: Milan Zamazal <pdm@fi.muni.cz>
255 ;; Maintainer(for XEmacs): David Sauer <davids@penguin.cz>
256
257 (defun setup-czech-environment ()
258   "Set up multilingual environment (MULE) for czech users."
259   (interactive)
260   (setup-8-bit-environment "Czech" 'latin-iso8859-2 'iso-8859-2
261                            "czech"))
262
263
264 (set-language-info-alist
265  "Czech" 
266  '((setup-function . (setup-czech-environment
267                       . setup-european-environment-map))
268    (charset . (ascii latin-iso8859-2))
269    (coding-system . (iso-8859-2))
270    (tutorial . "TUTORIAL.cs")
271    (documentation . ("\
272 These languages are supported with the Latin-2 (ISO-8859-2) character set:
273 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
274 Serbian, Croatian, Slovak, Slovene, and Swedish.
275 " . describe-european-environment-map))
276 ))
277
278
279 \f
280 ;; Latin-3 (ISO-8859-3)
281
282 ;; (make-coding-system
283 ;;  'iso-latin-3 2 ?3
284 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-3)"
285 ;;  '((ascii t) (latin-iso8859-3 t) nil nil
286 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
287
288 ;; (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
289 ;; (define-coding-system-alias 'latin-3 'iso-latin-3)
290
291 (make-coding-system
292  'iso-8859-3 'iso2022 "MIME ISO-8859-3"
293  '(charset-g0 ascii
294    charset-g1 latin-iso8859-3
295    charset-g2 t
296    charset-g3 t
297    mnemonic "MIME/Ltn-3"
298    ))
299
300 (defun setup-latin3-environment ()
301   "Set up multilingual environment (MULE) for European Latin-3 users."
302   (interactive)
303   (setup-8-bit-environment "Latin-3" 'latin-iso8859-3 'iso-8859-3
304                            "latin-3-prefix"))
305
306 (set-language-info-alist
307  "Latin-3" '((setup-function . (setup-latin3-environment
308                                 . setup-european-environment-map))
309              (charset . (ascii latin-iso8859-3))
310              (coding-system . (iso-8859-3))
311              (documentation . ("\
312 These languages are supported with the Latin-3 (ISO-8859-3) character set:
313  Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
314  German, Italian, Maltese, Spanish, and Turkish.
315 " . describe-european-environment-map))
316              ))
317 \f
318 ;; Latin-4 (ISO-8859-4)
319
320 ;; (make-coding-system
321 ;;  'iso-latin-4 2 ?4
322 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-4)"
323 ;;  '((ascii t) (latin-iso8859-4 t) nil nil
324 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
325
326 ;; (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
327 ;; (define-coding-system-alias 'latin-4 'iso-latin-4)
328
329 (make-coding-system
330  'iso-8859-4 'iso2022 "MIME ISO-8859-4"
331  '(charset-g0 ascii
332    charset-g1 latin-iso8859-4
333    charset-g2 t
334    charset-g3 t
335    mnemonic "MIME/Ltn-4"
336    ))
337
338 (defun setup-latin4-environment ()
339   "Set up multilingual environment (MULE) for European Latin-4 users."
340   (interactive)
341   (setup-8-bit-environment "Latin-4" 'latin-iso8859-4 'iso-8859-4
342                            "latin-4-prefix"))
343
344 (set-language-info-alist
345  "Latin-4" '((setup-function . (setup-latin4-environment
346                                 . setup-european-environment-map))
347              (charset . (ascii latin-iso8859-4))
348              (coding-system . (iso-8859-4))
349              (documentation . ("\
350 These languages are supported with the Latin-4 (ISO-8859-4) character set:
351  Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
352  Latvian, Lithuanian, and Norwegian.
353 " . describe-european-environment-map))
354              ))
355 \f
356 ;; Latin-5 (ISO-8859-9)
357
358 ;; (make-coding-system
359 ;;  'iso-latin-5 2 ?9
360 ;;  "ISO 2022 based 8-bit encoding (MIME:ISO-8859-9)"
361 ;;  '((ascii t) (latin-iso8859-9 t) nil nil
362 ;;    nil ascii-eol ascii-cntl nil nil nil nil))
363
364 ;; (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
365 ;; (define-coding-system-alias 'latin-5 'iso-latin-5)
366
367 (make-coding-system
368  'iso-8859-9 'iso2022 "MIME ISO-8859-9"
369  '(charset-g0 ascii
370    charset-g1 latin-iso8859-9
371    charset-g2 t
372    charset-g3 t
373    mnemonic "MIME/Ltn-5"
374    ))
375
376 (defun setup-latin5-environment ()
377   "Set up multilingual environment (MULE) for European Latin-5 users."
378   (interactive)
379   (setup-8-bit-environment "Latin-5" 'latin-iso8859-9 'iso-8859-5
380                            "latin-5-prefix"))
381
382 (set-language-info-alist
383  "Latin-5" '((setup-function . (setup-latin5-environment
384                                 . setup-european-environment-map))
385              (charset . (ascii latin-iso8859-9))
386              (coding-system . (iso-8859-5))
387              (documentation . ("\
388 These languages are supported with the Latin-5 (ISO-8859-9) character set.
389 " . describe-european-environment-map))
390              ))
391
392 ;; (defun setup-european-environment ()
393 ;;   "Setup multilingual environment (MULE) for European languages users.
394 ;; It actually reset MULE to the default status, and
395 ;; set quail-latin-1 as the default input method to be selected.
396 ;; See also the documentation of setup-english-environment."
397 ;;   (setup-english-environment)
398 ;;   (setq default-input-method '("European" . "quail-latin-1")))
399
400 ;; (defun describe-european-support ()
401 ;;   "Describe how Emacs support European languages."
402 ;;   (interactive)
403 ;;   (describe-language-support-internal "European"))
404
405 ;; (set-language-info-alist
406 ;;  "European" '((setup-function . setup-european-environment)
407 ;;               (describe-function . describe-european-support)
408 ;;               (charset . (ascii latin-iso8859-1 latin-iso8859-2
409 ;;                           latin-iso8859-3 latin-iso8859-4 latin-iso8859-9))
410 ;;               (coding-system . (iso-8859-1 iso-8859-2 iso-8859-3
411 ;;                                 iso-8859-4 iso-8859-9))
412 ;;               (sample-text
413 ;;                . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
414 ;;               (documentation . "\
415 ;; Almost all of European languages are supported by the character sets and
416 ;; coding systems listed below.
417 ;; To input them, LEIM (Libraries for Emacs Input Methods) should have been
418 ;; installed.")
419 ;;               ))
420
421 ;;; european.el ends here