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,10,13,14,15,
29 ;; windows-1250,2,4,7, mac-roman, adobe-standard-encoding, cp850 and
30 ;; next are supported.
34 ;; Latin-1 (ISO-8859-1)
36 (set-language-info-alist
37 "Latin-1" '((charset iso-8859-1
)
38 (coding-system iso-latin-1
)
39 (coding-priority iso-latin-1
)
40 (nonascii-translation . iso-8859-1
)
41 (unibyte-syntax .
"latin-1")
42 (unibyte-display . iso-latin-1
)
43 (input-method .
"latin-1-prefix")
45 .
"Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
47 This language environment is a generic one for the Latin-1 (ISO-8859-1)
48 character set which supports the following European languages:
49 Albanian, Basque, Breton, Catalan, Danish, Dutch, English, Faeroese,
50 Finnish, French (with restrictions -- see Latin-9), Frisian, Galician,
51 German, Greenlandic, Icelandic, Irish Gaelic (new orthography),
52 Italian, Latin, Luxemburgish, Norwegian, Portuguese, Rhaeto-Romanic,
53 Scottish Gaelic, Spanish, and Swedish.
54 We also have specific language environments for the following languages:
56 For German, \"German\".
57 For Spanish, \"Spanish\".
58 For French, \"French\".
60 Latin-1 also covers several written languages outside Europe, including
61 Indonesian/Malay, Tagalog (Philippines), Swahili and Afrikaans."))
65 ;; Latin-2 (ISO-8859-2)
67 (define-coding-system 'iso-latin-2
68 "ISO 2022 based 8-bit encoding for Latin-2 (MIME:ISO-8859-2)."
71 :charset-list
'(iso-8859-2)
72 :mime-charset
'iso-8859-2
)
74 (define-coding-system-alias 'iso-8859-2
'iso-latin-2
)
75 (define-coding-system-alias 'latin-2
'iso-latin-2
)
77 (set-language-info-alist
78 "Latin-2" '((charset iso-8859-2
)
79 (coding-system iso-latin-2
)
80 (coding-priority iso-latin-2
)
81 (nonascii-translation . iso-8859-2
)
82 (unibyte-syntax .
"latin-2")
83 (unibyte-display . iso-latin-2
)
84 (input-method .
"latin-2-prefix")
86 This language environment is a generic one for the Latin-2 (ISO-8859-2)
87 character set which supports the following languages:
88 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
89 Serbo-Croatian or Croatian, Slovak, Slovene, Sorbian (upper and lower),
91 We also have specific language environments for the following languages:
93 For Romanian, \"Romanian\".
94 For Slovak, \"Slovak\"."))
98 ;; Latin-3 (ISO-8859-3)
100 (define-coding-system 'iso-latin-3
101 "ISO 2022 based 8-bit encoding for Latin-3 (MIME:ISO-8859-3)."
102 :coding-type
'charset
104 :charset-list
'(iso-8859-3)
105 :mime-charset
'iso-8859-3
)
107 (define-coding-system-alias 'iso-8859-3
'iso-latin-3
)
108 (define-coding-system-alias 'latin-3
'iso-latin-3
)
110 (set-language-info-alist
111 "Latin-3" '((charset iso-8859-3
)
112 (coding-system iso-latin-3
)
113 (coding-priority iso-latin-3
)
114 (nonascii-translation . iso-8859-3
)
115 (unibyte-syntax .
"latin-3")
116 (unibyte-display . iso-latin-3
)
117 (input-method .
"latin-3-prefix")
119 These languages are supported with the Latin-3 (ISO-8859-3) character set:
120 Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
121 German, Italian, Maltese, Spanish, and Turkish."))
125 ;; Latin-4 (ISO-8859-4)
127 (define-coding-system 'iso-latin-4
128 "ISO 2022 based 8-bit encoding for Latin-4 (MIME:ISO-8859-4)."
129 :coding-type
'charset
131 :charset-list
'(iso-8859-4)
132 :mime-charset
'iso-8859-4
)
134 (define-coding-system-alias 'iso-8859-4
'iso-latin-4
)
135 (define-coding-system-alias 'latin-4
'iso-latin-4
)
137 (set-language-info-alist
138 "Latin-4" '((charset iso-8859-4
)
139 (coding-system iso-8859-4
)
140 (coding-priority iso-8859-4
)
141 (nonascii-translation . iso-8859-4
)
142 (unibyte-syntax .
"latin-4")
143 (unibyte-display . iso-8859-4
)
144 (input-method .
"latin-4-postfix")
146 These languages are supported with the Latin-4 (ISO-8859-4) character set:
147 Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
148 Latvian, Lithuanian, and Norwegian."))
152 ;; Latin-5 (ISO-8859-9)
154 (define-coding-system 'iso-latin-5
155 "ISO 2022 based 8-bit encoding for Latin-5 (MIME:ISO-8859-9)."
156 :coding-type
'charset
158 :charset-list
'(iso-8859-9)
159 :mime-charset
'iso-8859-9
)
161 (define-coding-system-alias 'iso-8859-9
'iso-latin-5
)
162 (define-coding-system-alias 'latin-5
'iso-latin-5
)
164 (set-language-info-alist
165 "Latin-5" '((charset iso-8859-9
)
166 (coding-system iso-latin-5
)
167 (coding-priority iso-latin-5
)
168 (nonascii-translation . iso-8859-9
)
169 (unibyte-syntax .
"latin-5")
170 (unibyte-display . iso-latin-5
)
171 (input-method .
"latin-5-postfix")
172 (documentation .
"Support for Turkish language."))
176 ;; Latin-6 (ISO-8859-10)
178 (define-coding-system 'iso-latin-6
179 "ISO 2022 based 8-bit encoding for Latin-6 (MIME:ISO-8859-10)."
180 :coding-type
'charset
182 :charset-list
'(iso-8859-10)
183 :mime-charset
'iso-8859-10
)
185 (define-coding-system-alias 'iso-8859-10
'iso-latin-6
)
186 (define-coding-system-alias 'latin-6
'iso-latin-6
)
188 (set-language-info-alist
189 "Latin-6" '((charset iso-8859-10
)
190 (coding-system iso-latin-6
)
191 (coding-priority iso-latin-6
)
192 (nonascii-translation . iso-8859-10
)
193 (unibyte-syntax .
"latin-6")
194 (unibyte-display . iso-latin-6
)
195 ;; Fixme: input method.
196 (documentation .
"Support for generic Latin-6 (Northern European)."))
200 ;; Latin-7 (ISO-8859-13)
202 (define-coding-system 'iso-latin-7
203 "ISO 2022 based 8-bit encoding for Latin-7 (MIME:ISO-8859-13)."
204 :coding-type
'charset
206 :charset-list
'(iso-8859-13)
207 :mime-charset
'iso-8859-13
)
209 (define-coding-system-alias 'iso-8859-13
'iso-latin-7
)
210 (define-coding-system-alias 'latin-7
'iso-latin-7
)
212 (set-language-info-alist
213 "Latin-7" '((charset iso-8859-13
)
214 (coding-system iso-latin-7
)
215 (coding-priority iso-latin-7
)
216 (nonascii-translation . iso-8859-13
)
217 (unibyte-syntax .
"latin-7")
218 (unibyte-display . iso-latin-7
)
219 ;; Fixme: input method.
220 (documentation .
"Support for generic Latin-7 (Baltic Rim)."))
223 ;; Latin-8 (ISO-8859-14)
225 (define-coding-system 'iso-latin-8
226 "ISO 2022 based 8-bit encoding for Latin-8 (MIME:ISO-8859-14)."
227 :coding-type
'charset
228 ;; `W' for `Welsh', since `C' for `Celtic' is taken.
230 :charset-list
'(iso-8859-14)
231 :mime-charset
'iso-8859-14
)
233 (define-coding-system-alias 'iso-8859-14
'iso-latin-8
)
234 (define-coding-system-alias 'latin-8
'iso-latin-8
)
236 (set-language-info-alist
237 "Latin-8" '((charset iso-8859-14
)
238 (coding-system iso-latin-8
)
239 (coding-priority iso-latin-8
)
240 (nonascii-translation . iso-8859-14
)
241 (unibyte-syntax .
"latin-8")
242 (unibyte-display . iso-latin-8
)
243 (input-method .
"latin-8-prefix")
244 ;; Fixme: Welsh/Ga{e}lic greetings
245 (sample-text .
"\e,_"\e(B \e,_p
\e(B \e,_^
\e(B")
247 This language environment is a generic one for the Latin-8
(ISO-8859-14)
248 character set which supports the Celtic languages
, including those not
249 covered by other ISO-8859 character sets
:
250 Welsh
, Manx Gaelic and Irish Gaelic
(old orthography
).
"))
253 ;; Latin-9 (ISO-8859-15)
255 (define-coding-system 'iso-latin-9
256 "ISO
2022 based
8-bit encoding for Latin-9
(MIME:ISO-8859-15
).
"
257 :coding-type 'charset
260 :charset-list '(iso-8859-15)
261 :mime-charset 'iso-8859-15)
263 (define-coding-system-alias 'iso-8859-15 'iso-latin-9)
264 (define-coding-system-alias 'latin-9 'iso-latin-9)
265 (define-coding-system-alias 'latin-0 'iso-latin-9)
267 (set-language-info-alist
268 "Latin-9
" '((charset iso-8859-15)
269 (coding-system iso-latin-9)
270 (coding-priority iso-latin-9)
271 (nonascii-translation . iso-8859-15)
272 (unibyte-syntax . "latin-9
")
273 (unibyte-display . iso-latin-9)
274 (input-method . "latin-9-prefix
")
276 . "AVE.
\e,B
)9.
>\e,b
<=\e,_
/\e(B \e,b$
\e(B")
278 This language environment is a generic one for the Latin-9
(ISO-8859-15)
279 character set which supports the same languages as Latin-1 with the
280 addition of the Euro sign and some additional French and Finnish letters.
281 Latin-9 is sometimes nicknamed
`Latin-0
'.
"))
284 (define-coding-system 'iso-latin-7
285 "ISO
2022 based
8-bit encoding for Latin-7
(MIME:ISO-8859-13
).
"
286 :coding-type 'charset
289 :charset-list '(iso-8859-13)
290 :mime-charset 'iso-8859-13)
292 (define-coding-system-alias 'iso-8859-13 'iso-latin-7)
293 (define-coding-system-alias 'latin-7 'iso-latin-7)
295 (define-coding-system 'windows-1250
296 "windows-1250
(Central European
) encoding
(MIME: WINDOWS-1250
)"
297 :coding-type 'charset
299 :charset-list '(windows-1250)
300 :mime-charset 'windows-1250)
301 (define-coding-system-alias 'cp1250 'windows-1250)
303 (define-coding-system 'windows-1252
304 "windows-1252
(Western European
) encoding
(MIME: WINDOWS-1252
)"
305 :coding-type 'charset
307 :charset-list '(windows-1252)
308 :mime-charset 'windows-1252)
309 (define-coding-system-alias 'cp1252 'windows-1252)
311 (define-coding-system 'windows-1254
312 "windows-1254
(Turkish) encoding
(MIME: WINDOWS-1254
)"
313 :coding-type 'charset
315 :charset-list '(windows-1254)
316 :mime-charset 'windows-1254)
317 (define-coding-system-alias 'cp1254 'windows-1254)
319 (define-coding-system 'windows-1257
320 "windows-1257
(Baltic) encoding
(MIME: WINDOWS-1257
)"
321 :coding-type 'charset
323 :charset-list '(windows-1257)
324 :mime-charset 'windows-1257)
325 (define-coding-system-alias 'cp1257 'windows-1257)
327 (define-coding-system 'cp850
328 "DOS codepage
850 (Western European
)"
329 :coding-type 'charset
331 :charset-list '(cp850)
332 :mime-charset 'cp850)
333 (define-coding-system-alias 'ibm850 'cp850)
335 (define-coding-system 'cp852
336 "DOS codepage
852 (Slavic)"
337 :coding-type 'charset
339 :charset-list '(cp852)
340 :mime-charset 'cp852)
341 (define-coding-system-alias 'ibm852 'cp852)
343 (define-coding-system 'cp857
344 "DOS codepage
857 (Turkish)"
345 :coding-type 'charset
347 :charset-list '(cp857)
348 :mime-charset 'cp857)
349 (define-coding-system-alias 'ibm857 'cp857)
351 (define-coding-system 'cp860
352 "DOS codepage
860 (Portuguese)"
353 :coding-type 'charset
355 :charset-list '(cp860)
356 :mime-charset 'cp860)
357 (define-coding-system-alias 'ibm860 'cp860)
359 (define-coding-system 'cp861
360 "DOS codepage
861 (Icelandic)"
361 :coding-type 'charset
363 :charset-list '(cp861)
364 :mime-charset 'cp861)
365 (define-coding-system-alias 'ibm861 'cp861)
367 (define-coding-system 'cp863
368 "DOS codepage
863 (French Canadian
)"
369 :coding-type 'charset
371 :charset-list '(cp863)
372 :mime-charset 'cp863)
373 (define-coding-system-alias 'ibm863 'cp863)
375 (define-coding-system 'cp865
376 "DOS codepage
865 (Norwegian/Danish
)"
377 :coding-type 'charset
379 :charset-list '(cp865)
380 :mime-charset 'cp865)
381 (define-coding-system-alias 'ibm865 'cp865)
383 (define-coding-system 'cp437
385 :coding-type 'charset
387 :charset-list '(cp437)
388 :mime-charset 'cp437)
389 (define-coding-system-alias 'ibm437 'cp437)
391 (set-language-info-alist
392 "German
" '((tutorial . "TUTORIAL.de
")
394 (coding-system iso-latin-1 iso-latin-9)
395 (coding-priority iso-latin-1)
396 (nonascii-translation . iso-8859-1)
397 (input-method . "german-postfix
")
398 (unibyte-syntax . "latin-1
")
399 (unibyte-display . iso-latin-1)
401 German
(Deutsch Nord
) Guten Tag
402 German
(Deutsch S
\e,A|
\e(Bd) Gr
\e,A|_
\e(B Gott
")
404 This language environment is almost the same as Latin-1
,
405 but sets the default input method to
\"german-postfix
\".
406 Additionally
, it selects the German tutorial.
"))
409 (set-language-info-alist
410 "French
" '((tutorial . "TUTORIAL.fr
")
412 (coding-system iso-latin-1 iso-latin-9)
413 (coding-priority iso-latin-1)
414 (nonascii-translation . iso-8859-1)
415 (unibyte-syntax . "latin-1
")
416 (unibyte-display . iso-latin-1)
417 (input-method . "latin-1-prefix
")
418 (sample-text . "French
(Fran\e,Ag
\e(Bais) Bonjour
, Salut
")
420 This language environment is almost the same as Latin-1
,
421 but it selects the French tutorial.
"))
424 (set-language-info-alist
425 "Slovenian
" '((charset iso-8859-2)
426 (coding-system . (iso-8859-2 windows-1250))
427 (coding-priority . (iso-8859-2))
428 (nonascii-translation . iso-8859-2)
429 (input-method . "latin-2-postfix
")
430 (unibyte-syntax . "latin-2
")
431 (unibyte-display . iso-8859-2)
432 (tutorial . "TUTORIAL.sl
")
433 (sample-text . "\e,B.
\e(Belimo vam uspe
\e,B9
\e(Ben dan
!")
437 (set-language-info-alist
438 "Spanish
" '((tutorial . "TUTORIAL.es
")
440 (coding-system iso-latin-1 iso-latin-9)
441 (coding-priority iso-latin-1)
442 (nonascii-translation . iso-8859-1)
443 (input-method . "spanish-postfix
")
444 (unibyte-syntax . "latin-1
")
445 (unibyte-display . iso-latin-1)
446 (sample-text . "Spanish
(Espa\e,Aq
\e(Bol) \e,A
!\e(BHola!")
448 This language environment is almost the same as Latin-1
,
449 but it sets the default input method to
\"spanish-postfix
\",
450 and it selects the Spanish tutorial.
"))
453 (set-language-info-alist
454 "Dutch
" '((tutorial . "TUTORIAL.nl
")
456 (coding-system iso-latin-1 iso-latin-9)
457 (coding-priority iso-latin-1)
458 (nonascii-translation . iso-8859-1)
459 (unibyte-syntax . "latin-1
")
460 (unibyte-display . iso-latin-1)
461 (input-method . "dutch
")
462 (sample-text . "Er is een aantal manieren waarop je dit kan doen
")
464 This language environment is almost the same as Latin-1
,
465 but it selects the Dutch tutorial and input method.
"))
468 ;; For Turkish, the character set ISO-8859-9 (Latin-5) is used. But,
469 ;; before the introduction of ISO-8859-9 in 1988, ISO-8859-3 (Latin-3)
470 ;; was used for Turkish. Those who use Latin-3 for Turkish should use
471 ;; "Latin-3
" language environment.
473 (set-language-info-alist
474 "Turkish
" '((charset iso-8859-9)
475 (coding-system iso-latin-5 windows-1254 iso-latin-3)
476 (coding-priority iso-latin-5)
477 (nonascii-translation . iso-8859-9)
478 (unibyte-syntax . "latin-5
")
479 (unibyte-display . iso-latin-5)
480 (input-method . "turkish-postfix
")
481 (sample-text . "Turkish
(T\e,A|
\e(Brk\e,Ag
\e(Be) Merhaba
")
482 (documentation . t)))
484 ;; Polish ISO 8859-2 environment.
485 ;; Maintainer: Wlodek Bzyl <matwb@univ.gda.pl>
486 ;; Keywords: multilingual, Polish
488 (set-language-info-alist
489 "Polish
" '((charset . (iso-8859-2))
490 (coding-system . (iso-8859-2 windows-1250))
491 (coding-priority . (iso-8859-2))
492 (nonascii-translation . iso-8859-2)
493 (input-method . "polish-slash
")
494 (unibyte-syntax . "latin-2
")
495 (unibyte-display . iso-8859-2)
496 (tutorial . "TUTORIAL.pl
")
497 (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
")
501 (set-language-info-alist
502 "Welsh
" `((coding-system utf-8 latin-8) ; the input method is Unicode-based
503 (coding-priority utf-8 latin-8)
504 (nonascii-translation . iso-8859-14)
505 (input-method . "welsh
")
506 (documentation . "Support for Welsh
, using Unicode.
"))
509 (set-language-info-alist
510 "Latin-7
" `((coding-system latin-7)
511 (coding-priority latin-7)
512 (nonascii-translation . iso-8859-13)
513 ;; Fixme: input-method
514 (documentation . "Support for Latin-7
, e.g. Latvian
, Lithuanian.
"))
517 (set-language-info-alist
518 "Lithuanian
" `((coding-system latin-7 windows-1257)
519 (coding-priority latin-7)
520 (nonascii-translation . iso-8859-13)
521 (input-method . "lithuanian-keyboard
")
522 (documentation . "Support for Lithuanian.
"))
525 (set-language-info-alist
526 "Latvian
" `((coding-system latin-7 windows-1257)
527 (coding-priority latin-7)
528 (nonascii-translation . iso-8859-13)
529 (input-method . "latvian-keyboard
")
530 (documentation . "Support for Latvian.
"))
534 (define-coding-system 'mac-roman
535 "Mac Roman Encoding
(MIME:MACINTOSH
).
"
536 :coding-type 'charset
538 :charset-list '(mac-roman)
539 :mime-charset 'macintosh)
541 (define-coding-system 'next
543 :coding-type 'charset
545 :charset-list '(next)
548 (define-coding-system 'hp-roman8
549 "Hewlet-Packard roman-8 encoding
(MIME:ROMAN-8
)"
550 :coding-type 'charset
552 :charset-list '(hp-roman8)
553 :mime-charset 'hp-roman8)
554 (define-coding-system-alias 'roman8 'hp-roman8)
556 (define-coding-system 'adobe-standard-encoding
557 "Adobe
`standard
' encoding for PostScript
"
558 :coding-type 'charset
560 :charset-list '(adobe-standard-encoding)
561 :mime-charset 'adobe-standard-encoding)
563 (defconst diacritic-composition-pattern "\\C^
\\c^
+")
565 (defun diacritic-compose-region (beg end)
566 "Compose diacritic characters in the region.
567 When called from a program
, expects two arguments
,
568 positions
(integers or markers
) specifying the region.
"
571 (narrow-to-region beg end)
572 (goto-char (point-min))
573 (while (re-search-forward diacritic-composition-pattern nil t)
574 (compose-region (match-beginning 0) (match-end 0)))))
576 (defun diacritic-compose-string (string)
577 "Compose diacritic characters in STRING and return the resulting string.
"
579 (while (setq idx (string-match diacritic-composition-pattern string idx))
580 (compose-string string idx (match-end 0))
581 (setq idx (match-end 0))))
584 (defun diacritic-compose-buffer ()
585 "Compose diacritic characters in the current buffer.
"
587 (diacritic-compose-region (point-min) (point-max)))
589 (defun diacritic-post-read-conversion (len)
590 (diacritic-compose-region (point) (+ (point) len))
593 (defun diacritic-composition-function (from to pattern &optional string)
594 "Compose diacritic text in the region FROM and TO.
595 The text matches the regular expression PATTERN.
596 Optional
4th argument STRING
, if non-nil
, is a string containing text
599 The return value is number of composed characters.
"
603 (compose-string string from to)
604 (compose-region from to))
607 ;; Register a function to compose Unicode diacrtics and marks.
608 (let ((patterns '(("\\C^
\\c^
+" . diacritic-composition-function))))
611 (aset composition-function-table c patterns)
615 (aset composition-function-table c patterns)
620 ;;; european.el ends here