1 ;;; european.el --- support for European languages -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
7 ;; Keywords: multilingual, European
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 ;; For European scripts, character sets ISO8859-1,2,3,4,9,13,14,15,
29 ;; windows-1250,2,4,7, mac-roman and next are supported.
33 ;; Latin-1 (ISO-8859-1)
35 (set-language-info-alist
36 "Latin-1" '((charset iso-8859-1)
37 (coding-system iso-latin-1)
38 (coding-priority iso-latin-1)
39 (nonascii-translation . iso-8859-1)
40 (unibyte-syntax . "latin-1")
41 (unibyte-display . iso-latin-1)
42 (input-method . "latin-1-prefix")
44 . "Hello, Hej, Tere, Hei, Bonjour, Gr
\e,A|_
\e(B Gott, Ciao,
\e,A!
\e(BHola!")
46 This language environment is a generic one for the Latin-1 (ISO-8859-1)
47 character set which supports the following European languages:
48 Albanian, Basque, Breton, Catalan, Danish, Dutch, English, Faeroese,
49 Finnish, French (with restrictions -- see Latin-9), Frisian, Galician,
50 German, Greenlandic, Icelandic, Irish Gaelic (new orthography),
51 Italian, Latin, Luxemburgish, Norwegian, Portuguese, Rhaeto-Romanic,
52 Scottish Gaelic, Spanish, and Swedish.
53 We also have specific language environments for the following languages:
55 For German, \"German\".
56 For Spanish, \"Spanish\".
57 For French, \"French\".
59 Latin-1 also covers several written languages outside Europe, including
60 Indonesian/Malay, Tagalog (Philippines), Swahili and Afrikaans."))
64 ;; Latin-2 (ISO-8859-2)
66 (define-coding-system 'iso-latin-2
67 "ISO 2022 based 8-bit encoding for Latin-2 (MIME:ISO-8859-2)."
70 :charset-list '(iso-8859-2)
71 :mime-charset 'iso-8859-2)
73 (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
74 (define-coding-system-alias 'latin-2 'iso-latin-2)
76 (set-language-info-alist
77 "Latin-2" '((charset iso-8859-2)
78 (coding-system iso-latin-2)
79 (coding-priority iso-latin-2)
80 (nonascii-translation . iso-8859-2)
81 (unibyte-syntax . "latin-2")
82 (unibyte-display . iso-latin-2)
83 (input-method . "latin-2-prefix")
85 This language environment is a generic one for the Latin-2 (ISO-8859-2)
86 character set which supports the following languages:
87 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
88 Serbo-Croatian or Croatian, Slovak, Slovene, Sorbian (upper and lower),
90 We also have specific language environments for the following languages:
92 For Romanian, \"Romanian\".
93 For Slovak, \"Slovak\"."))
97 ;; Latin-3 (ISO-8859-3)
99 (define-coding-system 'iso-latin-3
100 "ISO 2022 based 8-bit encoding for Latin-3 (MIME:ISO-8859-3)."
101 :coding-type 'charset
103 :charset-list '(iso-8859-3)
104 :mime-charset 'iso-8859-3)
106 (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
107 (define-coding-system-alias 'latin-3 'iso-latin-3)
109 (set-language-info-alist
110 "Latin-3" '((charset iso-8859-3)
111 (coding-system iso-latin-3)
112 (coding-priority iso-latin-3)
113 (nonascii-translation . iso-8859-3)
114 (unibyte-syntax . "latin-3")
115 (unibyte-display . iso-latin-3)
116 (input-method . "latin-3-prefix")
118 These languages are supported with the Latin-3 (ISO-8859-3) character set:
119 Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
120 German, Italian, Maltese, Spanish, and Turkish."))
124 ;; Latin-4 (ISO-8859-4)
126 (define-coding-system 'iso-latin-4
127 "ISO 2022 based 8-bit encoding for Latin-4 (MIME:ISO-8859-4)."
128 :coding-type 'charset
130 :charset-list '(iso-8859-4)
131 :mime-charset 'iso-8859-4)
133 (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
134 (define-coding-system-alias 'latin-4 'iso-latin-4)
136 (set-language-info-alist
137 "Latin-4" '((charset iso-8859-4)
138 (coding-system iso-8859-4)
139 (coding-priority iso-8859-4)
140 (nonascii-translation . iso-8859-4)
141 (unibyte-syntax . "latin-4")
142 (unibyte-display . iso-8859-4)
143 (input-method . "latin-4-postfix")
145 These languages are supported with the Latin-4 (ISO-8859-4) character set:
146 Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
147 Latvian, Lithuanian, and Norwegian."))
151 ;; Latin-5 (ISO-8859-9)
153 (define-coding-system 'iso-latin-5
154 "ISO 2022 based 8-bit encoding for Latin-5 (MIME:ISO-8859-9)."
155 :coding-type 'charset
157 :charset-list '(iso-8859-9)
158 :mime-charset 'iso-8859-9)
160 (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
161 (define-coding-system-alias 'latin-5 'iso-latin-5)
163 (set-language-info-alist
164 "Latin-5" '((charset iso-8859-9)
165 (coding-system iso-latin-5)
166 (coding-priority iso-latin-5)
167 (nonascii-translation . iso-8859-9)
168 (unibyte-syntax . "latin-5")
169 (unibyte-display . iso-latin-5)
170 (input-method . "latin-5-postfix")
171 (documentation . "Support for Turkish language."))
175 ;; Latin-8 (ISO-8859-14)
177 (define-coding-system 'iso-latin-8
178 "ISO 2022 based 8-bit encoding for Latin-8 (MIME:ISO-8859-14)."
179 :coding-type 'charset
180 ;; `W' for `Welsh', since `C' for `Celtic' is taken.
182 :charset-list '(iso-8859-14)
183 :mime-charset 'iso-8859-14)
185 (define-coding-system-alias 'iso-8859-14 'iso-latin-8)
186 (define-coding-system-alias 'latin-8 'iso-latin-8)
188 (set-language-info-alist
189 "Latin-8" '((charset iso-8859-14)
190 (coding-system iso-latin-8)
191 (coding-priority iso-latin-8)
192 (nonascii-translation . iso-8859-14)
193 (unibyte-syntax . "latin-8")
194 (unibyte-display . iso-latin-8)
195 (input-method . "latin-8-prefix")
196 ;; Fixme: Welsh/Ga{e}lic greetings
197 (sample-text . "
\e,_"
\e(B
\e,_p
\e(B
\e,_^
\e(B")
199 This language environment is a generic one for the Latin-8 (ISO-8859-14)
200 character set which supports the Celtic languages, including those not
201 covered by other ISO-8859 character sets:
202 Welsh, Manx Gaelic and Irish Gaelic (old orthography)."))
205 ;; Latin-9 (ISO-8859-15)
207 (define-coding-system 'iso-latin-9
208 "ISO 2022 based 8-bit encoding for Latin-9 (MIME:ISO-8859-15)."
209 :coding-type 'charset
212 :charset-list '(iso-8859-15)
213 :mime-charset 'iso-8859-15)
215 (define-coding-system-alias 'iso-8859-15 'iso-latin-9)
216 (define-coding-system-alias 'latin-9 'iso-latin-9)
217 (define-coding-system-alias 'latin-0 'iso-latin-9)
219 (set-language-info-alist
220 "Latin-9" '((charset iso-8859-15)
221 (coding-system iso-latin-9)
222 (coding-priority iso-latin-9)
223 (nonascii-translation . iso-8859-15)
224 (unibyte-syntax . "latin-9")
225 (unibyte-display . iso-latin-9)
226 (input-method . "latin-9-prefix")
228 . "AVE.
\e,B)9.>
\e,b<=
\e,_/
\e(B
\e,b$
\e(B")
230 This language environment is a generic one for the Latin-9 (ISO-8859-15)
231 character set which supports the same languages as Latin-1 with the
232 addition of the Euro sign and some additional French and Finnish letters.
233 Latin-9 is sometimes nicknamed `Latin-0'."))
236 (define-coding-system 'iso-latin-7
237 "ISO 2022 based 8-bit encoding for Latin-7 (MIME:ISO-8859-13)."
238 :coding-type 'charset
241 :charset-list '(iso-8859-13)
242 :mime-charset 'iso-8859-13)
244 (define-coding-system-alias 'iso-8859-13 'iso-latin-7)
245 (define-coding-system-alias 'latin-7 'iso-latin-7)
247 (define-coding-system 'windows-1250
248 "windows-1250 (Central European) encoding (MIME: WINDOWS-1250)"
249 :coding-type 'charset
251 :charset-list '(windows-1250)
252 :mime-charset 'windows-1250)
253 (define-coding-system-alias 'cp1250 'windows-1250)
255 (define-coding-system 'windows-1252
256 "windows-1252 (Western European) encoding (MIME: WINDOWS-1252)"
257 :coding-type 'charset
259 :charset-list '(windows-1252)
260 :mime-charset 'windows-1252)
261 (define-coding-system-alias 'cp1252 'windows-1252)
263 (define-coding-system 'windows-1254
264 "windows-1254 (Turkish) encoding (MIME: WINDOWS-1254)"
265 :coding-type 'charset
267 :charset-list '(windows-1254)
268 :mime-charset 'windows-1254)
269 (define-coding-system-alias 'cp1254 'windows-1254)
271 (define-coding-system 'windows-1257
272 "windows-1257 (Baltic) encoding (MIME: WINDOWS-1257)"
273 :coding-type 'charset
275 :charset-list '(windows-1257)
276 :mime-charset 'windows-1257)
277 (define-coding-system-alias 'cp1257 'windows-1257)
279 (set-language-info-alist
280 "German" '((tutorial . "TUTORIAL.de")
282 (coding-system iso-latin-1)
283 (coding-priority iso-latin-1)
284 (nonascii-translation . iso-8859-1)
285 (input-method . "german-postfix")
286 (unibyte-syntax . "latin-1")
287 (unibyte-display . iso-latin-1)
289 German (Deutsch Nord) Guten Tag
290 German (Deutsch S
\e,A|
\e(Bd) Gr
\e,A|_
\e(B Gott")
292 This language environment is almost the same as Latin-1,
293 but sets the default input method to \"german-postfix\".
294 Additionally, it selects the German tutorial."))
297 (set-language-info-alist
298 "French" '((tutorial . "TUTORIAL.fr")
300 (coding-system iso-latin-1)
301 (coding-priority iso-latin-1)
302 (nonascii-translation . iso-8859-1)
303 (unibyte-syntax . "latin-1")
304 (unibyte-display . iso-latin-1)
305 (input-method . "latin-1-prefix")
306 (sample-text . "French (Fran
\e,Ag
\e(Bais) Bonjour, Salut")
308 This language environment is almost the same as Latin-1,
309 but it selects the French tutorial."))
312 (set-language-info-alist
313 "Slovenian" '((charset iso-8859-2)
314 (coding-system . (iso-8859-2))
315 (coding-priority . (iso-8859-2))
316 (nonascii-translation . iso-8859-2)
317 (input-method . "latin-2-postfix")
318 (unibyte-syntax . "latin-2")
319 (unibyte-display . iso-8859-2)
320 (tutorial . "TUTORIAL.sl")
321 (sample-text . "
\e,B.
\e(Belimo vam uspe
\e,B9
\e(Ben dan!")
325 (set-language-info-alist
326 "Spanish" '((tutorial . "TUTORIAL.es")
328 (coding-system iso-latin-1)
329 (coding-priority iso-latin-1)
330 (nonascii-translation . iso-8859-1)
331 (input-method . "spanish-postfix")
332 (unibyte-syntax . "latin-1")
333 (unibyte-display . iso-latin-1)
334 (sample-text . "Spanish (Espa
\e,Aq
\e(Bol)
\e,A!
\e(BHola!")
336 This language environment is almost the same as Latin-1,
337 but it sets the default input method to \"spanish-postfix\",
338 and it selects the Spanish tutorial."))
341 (set-language-info-alist
342 "Dutch" '((tutorial . "TUTORIAL.nl")
344 (coding-system iso-latin-1)
345 (coding-priority iso-latin-1)
346 (nonascii-translation . iso-8859-1)
347 (unibyte-syntax . "latin-1")
348 (unibyte-display . iso-latin-1)
349 (sample-text . "Er is een aantal manieren waarop je dit kan doen")
351 This language environment is almost the same as Latin-1,
352 but it selects the Dutch tutorial."))
355 ;; For Turkish, the character set ISO-8859-9 (Latin-5) is used. But,
356 ;; before the introduction of ISO-8859-9 in 1988, ISO-8859-3 (Latin-3)
357 ;; was used for Turkish. Those who use Latin-3 for Turkish should use
358 ;; "Latin-3" language environment.
360 (set-language-info-alist
361 "Turkish" '((charset iso-8859-9)
362 (coding-system iso-latin-5)
363 (coding-priority iso-latin-5)
364 (nonascii-translation . iso-8859-9)
365 (unibyte-syntax . "latin-5")
366 (unibyte-display . iso-latin-5)
367 (input-method . "turkish-postfix")
368 (sample-text . "Turkish (T
\e,A|
\e(Brk
\e,Ag
\e(Be) Merhaba")
369 (documentation . t)))
371 ;; Polish ISO 8859-2 environment.
372 ;; Maintainer: Wlodek Bzyl <matwb@univ.gda.pl>
373 ;; Keywords: multilingual, Polish
375 (set-language-info-alist
376 "Polish" '((charset . (iso-8859-2))
377 (coding-system . (iso-8859-2))
378 (coding-priority . (iso-8859-2))
379 (nonascii-translation . iso-8859-2)
380 (input-method . "polish-slash")
381 (unibyte-syntax . "latin-2")
382 (unibyte-display . iso-8859-2)
383 (tutorial . "TUTORIAL.pl")
384 (sample-text . "P
\e,As
\e(Bjd
\e,B<
\e(B, ki
\e,Bq
\e(B-
\e,B?
\e(Be t
\e,Bj
\e(B chmurno
\e,B6f
\e(B w g
\e,B31
\e(Bb flaszy")
388 (set-language-info-alist
389 "Welsh" `((coding-system utf-8 latin-8) ; the input method is Unicode-based
390 (coding-priority utf-8 latin-8)
391 (nonascii-translation . iso-8859-14)
392 (input-method . "welsh")
393 (documentation . "Support for Welsh, using Unicode."))
396 (set-language-info-alist
397 "Latin-7" `((coding-system latin-7)
398 (coding-priority latin-7)
399 (nonascii-translation . iso-8859-13)
400 ;; Fixme: input-method
401 (documentation . "Support for Latin-7, e.g. Latvian, Lithuanian."))
404 (set-language-info-alist
405 "Lithuanian" `((coding-system latin-7)
406 (coding-priority latin-7)
407 (nonascii-translation . iso-8859-13)
408 (input-method . "lithuanian-keyboard")
409 (documentation . "Support for Lithuanian."))
412 (set-language-info-alist
413 "Latvian" `((coding-system latin-7)
414 (coding-priority latin-7)
415 (nonascii-translation . iso-8859-13)
416 (input-method . "latvian-keyboard")
417 (documentation . "Support for Latvian."))
421 (define-coding-system 'mac-roman
422 "Mac Roman Encoding (MIME:MACINTOSH)."
423 :coding-type 'charset
425 :charset-list '(mac-roman)
427 :mime-charset 'macintosh)
429 (define-coding-system 'next
431 :coding-type 'charset
433 :charset-list '(next)
436 (defconst diacritic-composition-pattern "\\C^\\c^+")
438 (defun diacritic-compose-region (beg end)
439 "Compose diacritic characters in the region.
440 When called from a program, expects two arguments,
441 positions (integers or markers) specifying the region."
444 (narrow-to-region beg end)
445 (goto-char (point-min))
446 (while (re-search-forward diacritic-composition-pattern nil t)
447 (compose-region (match-beginning 0) (match-end 0)))))
449 (defun diacritic-compose-string (string)
450 "Compose diacritic characters in STRING and return the resulting string."
452 (while (setq idx (string-match diacritic-composition-pattern string idx))
453 (compose-string string idx (match-end 0))
454 (setq idx (match-end 0))))
457 (defun diacritic-compose-buffer ()
458 "Compose diacritic characters in the current buffer."
460 (diacritic-compose-region (point-min) (point-max)))
462 (defun diacritic-post-read-conversion (len)
463 (diacritic-compose-region (point) (+ (point) len))
466 (defun diacritic-composition-function (from to pattern &optional string)
467 "Compose diacritic text in the region FROM and TO.
468 The text matches the regular expression PATTERN.
469 Optional 4th argument STRING, if non-nil, is a string containing text
472 The return value is number of composed characters."
476 (compose-string string from to)
477 (compose-region from to))
480 ;; Register a function to compose Unicode diacrtics and marks.
481 (let ((patterns '(("\\C^\\c^+" . diacritic-composition-function))))
484 (aset composition-function-table (decode-char 'unicode c) patterns)
488 (aset composition-function-table (decode-char 'unicode c) patterns)
493 ;;; european.el ends here