Sync to HEAD
[bpt/emacs.git] / lisp / language / european.el
1 ;;; european.el --- support for European languages -*- coding: iso-2022-7bit; -*-
2
3 ;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
6 ;; Copyright (C) 2003
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
8 ;; Registration Number H13PRO009
9
10 ;; Keywords: multilingual, European
11
12 ;; This file is part of GNU Emacs.
13
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; any later version.
18
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
23
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA.
28
29 ;;; Commentary:
30
31 ;; For European scripts, all the ISO Latin character sets are
32 ;; supported, along with various others.
33
34 ;;; Code:
35
36 ;; Latin-1 (ISO-8859-1)
37
38 (set-language-info-alist
39 "Latin-1" '((charset iso-8859-1)
40 (coding-system iso-latin-1 iso-latin-9 windows-1252)
41 (coding-priority iso-latin-1)
42 (nonascii-translation . iso-8859-1)
43 (unibyte-display . iso-latin-1)
44 (input-method . "latin-1-prefix")
45 (sample-text
46 . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
47 (documentation . "\
48 This language environment is a generic one for the Latin-1 (ISO-8859-1)
49 character set which supports the following European languages:
50 Albanian, Basque, Breton, Catalan, Danish, Dutch, English, Faeroese,
51 Finnish, French (with restrictions -- see Latin-9), Frisian, Galician,
52 German, Greenlandic, Icelandic, Irish Gaelic (new orthography),
53 Italian, Latin, Luxemburgish, Norwegian, Portuguese, Rhaeto-Romanic,
54 Scottish Gaelic, Spanish, and Swedish.
55 We also have specific language environments for the following languages:
56 For Dutch, \"Dutch\".
57 For German, \"German\".
58 For French, \"French\".
59 For Italian, \"Italian\".
60 For Slovenian, \"Slovenian\".
61 For Spanish, \"Spanish\".
62
63 Latin-1 also covers several written languages outside Europe, including
64 Indonesian/Malay, Tagalog (Philippines), Swahili and Afrikaans."))
65 '("European"))
66
67 \f
68 ;; Latin-2 (ISO-8859-2)
69
70 (define-coding-system 'iso-latin-2
71 "ISO 2022 based 8-bit encoding for Latin-2 (MIME:ISO-8859-2)."
72 :coding-type 'charset
73 :mnemonic ?2
74 :charset-list '(iso-8859-2)
75 :mime-charset 'iso-8859-2)
76
77 (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
78 (define-coding-system-alias 'latin-2 'iso-latin-2)
79
80 (set-language-info-alist
81 "Latin-2" '((charset iso-8859-2)
82 (coding-system iso-latin-2 windows-1250)
83 (coding-priority iso-latin-2)
84 (nonascii-translation . iso-8859-2)
85 (unibyte-display . iso-latin-2)
86 (input-method . "latin-2-prefix")
87 (documentation . "\
88 This language environment is a generic one for the Latin-2 (ISO-8859-2)
89 character set which supports the following languages:
90 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
91 Serbo-Croatian or Croatian, Slovak, Slovene, Sorbian (upper and lower),
92 and Swedish.
93 We also have specific language environments for the following languages:
94 For Czech, \"Czech\".
95 For Croatian, \"Croatian\".
96 For Polish, \"Polish\".
97 For Romanian, \"Romanian\".
98 For Slovak, \"Slovak\"."))
99 '("European"))
100
101 \f
102 ;; Latin-3 (ISO-8859-3)
103
104 (define-coding-system 'iso-latin-3
105 "ISO 2022 based 8-bit encoding for Latin-3 (MIME:ISO-8859-3)."
106 :coding-type 'charset
107 :mnemonic ?3
108 :charset-list '(iso-8859-3)
109 :mime-charset 'iso-8859-3)
110
111 (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
112 (define-coding-system-alias 'latin-3 'iso-latin-3)
113
114 (set-language-info-alist
115 "Latin-3" '((charset iso-8859-3)
116 (coding-system iso-latin-3)
117 (coding-priority iso-latin-3)
118 (nonascii-translation . iso-8859-3)
119 (unibyte-display . iso-latin-3)
120 (input-method . "latin-3-prefix")
121 (documentation . "\
122 These languages are supported with the Latin-3 (ISO-8859-3) character set:
123 Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
124 German, Italian, Maltese, Spanish, and Turkish."))
125 '("European"))
126
127 \f
128 ;; Latin-4 (ISO-8859-4)
129
130 (define-coding-system 'iso-latin-4
131 "ISO 2022 based 8-bit encoding for Latin-4 (MIME:ISO-8859-4)."
132 :coding-type 'charset
133 :mnemonic ?4
134 :charset-list '(iso-8859-4)
135 :mime-charset 'iso-8859-4)
136
137 (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
138 (define-coding-system-alias 'latin-4 'iso-latin-4)
139
140 (set-language-info-alist
141 "Latin-4" '((charset iso-8859-4)
142 (coding-system iso-8859-4)
143 (coding-priority iso-8859-4)
144 (nonascii-translation . iso-8859-4)
145 (unibyte-display . iso-8859-4)
146 (input-method . "latin-4-postfix")
147 (documentation . "\
148 These languages are supported with the Latin-4 (ISO-8859-4) character set:
149 Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
150 Latvian, Lithuanian, and Norwegian."))
151 '("European"))
152
153 \f
154 ;; Latin-5 (ISO-8859-9)
155
156 (define-coding-system 'iso-latin-5
157 "ISO 2022 based 8-bit encoding for Latin-5 (MIME:ISO-8859-9)."
158 :coding-type 'charset
159 :mnemonic ?9
160 :charset-list '(iso-8859-9)
161 :mime-charset 'iso-8859-9)
162
163 (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
164 (define-coding-system-alias 'latin-5 'iso-latin-5)
165
166 (set-language-info-alist
167 "Latin-5" '((charset iso-8859-9)
168 (coding-system iso-latin-5)
169 (coding-priority iso-latin-5)
170 (nonascii-translation . iso-8859-9)
171 (unibyte-display . iso-latin-5)
172 (input-method . "latin-5-postfix")
173 (documentation . "Support for Latin-5.\
174 See also the Turkish environment."))
175 '("European"))
176
177 \f
178 ;; Latin-6 (ISO-8859-10)
179
180 (define-coding-system 'iso-latin-6
181 "ISO 2022 based 8-bit encoding for Latin-6 (MIME:ISO-8859-10)."
182 :coding-type 'charset
183 :mnemonic ?9
184 :charset-list '(iso-8859-10)
185 :mime-charset 'iso-8859-10)
186
187 (define-coding-system-alias 'iso-8859-10 'iso-latin-6)
188 (define-coding-system-alias 'latin-6 'iso-latin-6)
189
190 (set-language-info-alist
191 "Latin-6" '((charset iso-8859-10)
192 (coding-system iso-latin-6)
193 (coding-priority iso-latin-6)
194 (nonascii-translation . iso-8859-10)
195 (unibyte-display . iso-latin-6)
196 ;; Fixme: input method.
197 (documentation . "Support for generic Latin-6 (Northern European)."))
198 '("European"))
199
200 \f
201 ;; Latin-7 (ISO-8859-13)
202
203 (define-coding-system 'iso-latin-7
204 "ISO 2022 based 8-bit encoding for Latin-7 (MIME:ISO-8859-13)."
205 :coding-type 'charset
206 :mnemonic ?9
207 :charset-list '(iso-8859-13)
208 :mime-charset 'iso-8859-13)
209
210 (define-coding-system-alias 'iso-8859-13 'iso-latin-7)
211 (define-coding-system-alias 'latin-7 'iso-latin-7)
212
213 (set-language-info-alist
214 "Latin-7" '((charset iso-8859-13)
215 (coding-system iso-latin-7)
216 (coding-priority iso-latin-7)
217 (nonascii-translation . iso-8859-13)
218 (unibyte-display . iso-latin-7)
219 ;; Fixme: input method.
220 (documentation . "Support for generic Latin-7 (Baltic Rim)."))
221 '("European"))
222 \f
223 ;; Latin-8 (ISO-8859-14)
224
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.
229 :mnemonic ?W
230 :charset-list '(iso-8859-14)
231 :mime-charset 'iso-8859-14)
232
233 (define-coding-system-alias 'iso-8859-14 'iso-latin-8)
234 (define-coding-system-alias 'latin-8 'iso-latin-8)
235
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-display . iso-latin-8)
242 (input-method . "latin-8-prefix")
243 ;; Fixme: Welsh/Ga{e}lic greetings
244 (sample-text . "\e,_"\e(B \e,_p\e(B \e,_^\e(B")
245 (documentation . "\
246 This language environment is a generic one for the Latin-8 (ISO-8859-14)
247 character set which supports the Celtic languages, including those not
248 covered by other ISO-8859 character sets:
249 Welsh, Manx Gaelic and Irish Gaelic (old orthography)."))
250 '("European"))
251 \f
252 ;; Latin-9 (ISO-8859-15)
253
254 (define-coding-system 'iso-latin-9
255 "ISO 2022 based 8-bit encoding for Latin-9 (MIME:ISO-8859-15)."
256 :coding-type 'charset
257 ;; `0' for `Latin-0'
258 :mnemonic ?0
259 :charset-list '(iso-8859-15)
260 :mime-charset 'iso-8859-15)
261
262 (define-coding-system-alias 'iso-8859-15 'iso-latin-9)
263 (define-coding-system-alias 'latin-9 'iso-latin-9)
264 (define-coding-system-alias 'latin-0 'iso-latin-9)
265
266 (set-language-info-alist
267 "Latin-9" '((charset iso-8859-15)
268 (coding-system iso-latin-9)
269 (coding-priority iso-latin-9)
270 (nonascii-translation . iso-8859-15)
271 (unibyte-display . iso-latin-9)
272 (input-method . "latin-9-prefix")
273 (sample-text
274 . "AVE. \e,B)9.>\e,b<=\e,_/\e(B \e,b$\e(B")
275 (documentation . "\
276 This language environment is a generic one for the Latin-9 (ISO-8859-15)
277 character set which supports the same languages as Latin-1 with the
278 addition of the Euro sign and some additional French and Finnish letters.
279 Latin-9 is sometimes nicknamed `Latin-0'."))
280 '("European"))
281 \f
282 (define-coding-system 'windows-1250
283 "windows-1250 (Central European) encoding (MIME: WINDOWS-1250)"
284 :coding-type 'charset
285 :mnemonic ?*
286 :charset-list '(windows-1250)
287 :mime-charset 'windows-1250)
288 (define-coding-system-alias 'cp1250 'windows-1250)
289
290 (define-coding-system 'windows-1252
291 "windows-1252 (Western European) encoding (MIME: WINDOWS-1252)"
292 :coding-type 'charset
293 :mnemonic ?*
294 :charset-list '(windows-1252)
295 :mime-charset 'windows-1252)
296 (define-coding-system-alias 'cp1252 'windows-1252)
297
298 (define-coding-system 'windows-1254
299 "windows-1254 (Turkish) encoding (MIME: WINDOWS-1254)"
300 :coding-type 'charset
301 :mnemonic ?*
302 :charset-list '(windows-1254)
303 :mime-charset 'windows-1254)
304 (define-coding-system-alias 'cp1254 'windows-1254)
305
306 (define-coding-system 'windows-1257
307 "windows-1257 (Baltic) encoding (MIME: WINDOWS-1257)"
308 :coding-type 'charset
309 :mnemonic ?*
310 :charset-list '(windows-1257)
311 :mime-charset 'windows-1257)
312 (define-coding-system-alias 'cp1257 'windows-1257)
313
314 (define-coding-system 'cp850
315 "DOS codepage 850 (Western European)"
316 :coding-type 'charset
317 :mnemonic ?D
318 :charset-list '(cp850)
319 :mime-charset 'cp850)
320 (define-coding-system-alias 'ibm850 'cp850)
321
322 (define-coding-system 'cp852
323 "DOS codepage 852 (Slavic)"
324 :coding-type 'charset
325 :mnemonic ?D
326 :charset-list '(cp852)
327 :mime-charset 'cp852)
328 (define-coding-system-alias 'ibm852 'cp852)
329
330 (define-coding-system 'cp857
331 "DOS codepage 857 (Turkish)"
332 :coding-type 'charset
333 :mnemonic ?D
334 :charset-list '(cp857)
335 :mime-charset 'cp857)
336 (define-coding-system-alias 'ibm857 'cp857)
337
338 (define-coding-system 'cp858
339 "Codepage 858 (Multilingual Latin I + Euro)"
340 :coding-type 'charset
341 :mnemonic ?D
342 :charset-list '(cp858)
343 :mime-charset 'cp858)
344
345 (define-coding-system 'cp860
346 "DOS codepage 860 (Portuguese)"
347 :coding-type 'charset
348 :mnemonic ?D
349 :charset-list '(cp860)
350 :mime-charset 'cp860)
351 (define-coding-system-alias 'ibm860 'cp860)
352
353 (define-coding-system 'cp861
354 "DOS codepage 861 (Icelandic)"
355 :coding-type 'charset
356 :mnemonic ?D
357 :charset-list '(cp861)
358 :mime-charset 'cp861)
359 (define-coding-system-alias 'ibm861 'cp861)
360
361 (define-coding-system 'cp863
362 "DOS codepage 863 (French Canadian)"
363 :coding-type 'charset
364 :mnemonic ?D
365 :charset-list '(cp863)
366 :mime-charset 'cp863)
367 (define-coding-system-alias 'ibm863 'cp863)
368
369 (define-coding-system 'cp865
370 "DOS codepage 865 (Norwegian/Danish)"
371 :coding-type 'charset
372 :mnemonic ?D
373 :charset-list '(cp865)
374 :mime-charset 'cp865)
375 (define-coding-system-alias 'ibm865 'cp865)
376
377 (define-coding-system 'cp437
378 "DOS codepage 437"
379 :coding-type 'charset
380 :mnemonic ?D
381 :charset-list '(cp437)
382 :mime-charset 'cp437)
383 (define-coding-system-alias 'ibm437 'cp437)
384 \f
385 (set-language-info-alist
386 "Dutch" '((tutorial . "TUTORIAL.nl")
387 (charset iso-8859-1)
388 (coding-system iso-latin-1 iso-latin-9)
389 (coding-priority iso-latin-1)
390 (nonascii-translation . iso-8859-1)
391 (unibyte-display . iso-latin-1)
392 (input-method . "dutch")
393 (sample-text . "Er is een aantal manieren waarop je dit kan doen")
394 (documentation . "\
395 This language environment is almost the same as Latin-1,
396 but it selects the Dutch tutorial and input method."))
397 '("European"))
398
399 (set-language-info-alist
400 "German" '((tutorial . "TUTORIAL.de")
401 (charset iso-8859-1)
402 (coding-system iso-latin-1 iso-latin-9)
403 (coding-priority iso-latin-1)
404 (nonascii-translation . iso-8859-1)
405 (input-method . "german-postfix")
406 (unibyte-display . iso-latin-1)
407 (sample-text . "\
408 German (Deutsch Nord) Guten Tag
409 German (Deutsch S\e,A|\e(Bd) Gr\e,A|_\e(B Gott")
410 (documentation . "\
411 This language environment is almost the same as Latin-1,
412 but sets the default input method to \"german-postfix\".
413 Additionally, it selects the German tutorial."))
414 '("European"))
415
416 (set-language-info-alist
417 "French" '((tutorial . "TUTORIAL.fr")
418 (charset iso-8859-1)
419 (coding-system iso-latin-1 iso-latin-9)
420 (coding-priority iso-latin-1)
421 (nonascii-translation . iso-8859-1)
422 (unibyte-display . iso-latin-1)
423 (input-method . "latin-1-prefix")
424 (sample-text . "French (Fran\e,Ag\e(Bais) Bonjour, Salut")
425 (documentation . "\
426 This language environment is almost the same as Latin-1,
427 but it selects the French tutorial and input method."))
428 '("European"))
429
430 (set-language-info-alist
431 "Italian" '((tutorial . "TUTORIAL.it")
432 (charset iso-8859-1)
433 (coding-system iso-latin-1 iso-latin-9)
434 (coding-priority iso-latin-1)
435 (nonascii-translation . iso-8859-1)
436 (unibyte-display . iso-latin-1)
437 (input-method . "italian-postfix")
438 (sample-text . "Salve, ciao!")
439 (documentation . "\
440 This language environment is almost the same as Latin-1,
441 but sets the default input method to \"italian-postfix\".
442 Additionally, it selects the Italian tutorial."))
443 '("European"))
444
445 (set-language-info-alist
446 "Slovenian" '((charset iso-8859-2)
447 (coding-system . (iso-8859-2 windows-1250))
448 (coding-priority . (iso-8859-2))
449 (nonascii-translation . iso-8859-2)
450 (input-method . "slovenian")
451 (unibyte-display . iso-8859-2)
452 (tutorial . "TUTORIAL.sl")
453 (sample-text . "\e,B.\e(Belimo vam uspe\e,B9\e(Ben dan!")
454 (documentation . "\
455 This language environment is almost the same as Latin-2,
456 but it selects the Slovenian tutorial and input method."))
457 '("European"))
458
459 (set-language-info-alist
460 "Spanish" '((tutorial . "TUTORIAL.es")
461 (charset iso-8859-1)
462 (coding-system iso-latin-1 iso-latin-9)
463 (coding-priority iso-latin-1)
464 (input-method . "spanish-postfix")
465 (nonascii-translation . iso-8859-1)
466 (unibyte-display . iso-latin-1)
467 (sample-text . "Spanish (Espa\e,Aq\e(Bol) \e,A!\e(BHola!")
468 (documentation . "\
469 This language environment is almost the same as Latin-1,
470 but it sets the default input method to \"spanish-postfix\",
471 and it selects the Spanish tutorial."))
472 '("European"))
473
474 ;; For Turkish, the character set ISO-8859-9 (Latin-5) is used. But,
475 ;; before the introduction of ISO-8859-9 in 1988, ISO-8859-3 (Latin-3)
476 ;; was used for Turkish. Those who use Latin-3 for Turkish should use
477 ;; "Latin-3" language environment.
478
479 (set-language-info-alist
480 "Turkish" '((charset iso-8859-9)
481 (coding-system iso-latin-5 windows-1254 iso-latin-3)
482 (coding-priority iso-latin-5)
483 (nonascii-translation . iso-8859-9)
484 (unibyte-display . iso-latin-5)
485 (input-method . "turkish-postfix")
486 (sample-text . "Turkish (T\e,A|\e(Brk\e,Ag\e(Be) Merhaba")
487 (setup-function
488 . (lambda ()
489 (set-case-syntax-pair ?I ?\e,C9\e(B (standard-case-table))
490 (set-case-syntax-pair ?\e,C)\e(B ?i (standard-case-table))))
491 (exit-function
492 . (lambda ()
493 (set-case-syntax-pair ?I ?i (standard-case-table))
494 (set-case-syntax ?\e,C9\e(B "w" (standard-case-table))
495 (set-case-syntax ?\e,C)\e(B "w" (standard-case-table))))
496 (documentation . "Support for Turkish.
497 Differs from the Latin-5 environment in using the `turkish-postfix' input
498 method and applying Turkish case rules for the characters i, I, \e,C9\e(B, \e,C)\e(B.")))
499
500 ;; Polish ISO 8859-2 environment.
501 ;; Maintainer: Wlodek Bzyl <matwb@univ.gda.pl>
502 ;; Keywords: multilingual, Polish
503
504 (set-language-info-alist
505 "Polish" '((charset iso-8859-2)
506 (coding-system iso-8859-2 windows-1250)
507 (coding-priority iso-8859-2)
508 (input-method . "polish-slash")
509 (nonascii-translation . iso-8859-2)
510 (unibyte-display . iso-8859-2)
511 (tutorial . "TUTORIAL.pl")
512 (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")
513 (documentation . t))
514 '("European"))
515
516 (set-language-info-alist
517 "Welsh" `((coding-system utf-8 latin-8) ; the input method is Unicode-based
518 (coding-priority utf-8 latin-8)
519 (nonascii-translation . iso-8859-14)
520 (input-method . "welsh")
521 (documentation . "Support for Welsh, using Unicode."))
522 '("European"))
523
524 (set-language-info-alist
525 "Latin-6" `((coding-system latin-6)
526 (coding-priority latin-6)
527 (nonascii-translation . ,(get 'decode-iso-latin-6 'translation-table))
528 (input-method . "latin-prefix")
529 (features code-pages)
530 (documentation . "Support for Latin-6."))
531 '("European"))
532
533 (set-language-info-alist
534 "Latin-7" `((coding-system latin-7)
535 (coding-priority latin-7)
536 (nonascii-translation . iso-8859-13)
537 (input-method . "latin-prefix")
538 (documentation . "Support for Latin-7, e.g. Latvian, Lithuanian."))
539 '("European"))
540
541 (set-language-info-alist
542 "Lithuanian" `((coding-system latin-7 windows-1257)
543 (coding-priority latin-7)
544 (nonascii-translation . iso-8859-13)
545 (input-method . "lithuanian-keyboard")
546 (documentation . "Support for Lithuanian."))
547 '("European"))
548
549 (set-language-info-alist
550 "Latvian" `((coding-system latin-7 windows-1257)
551 (coding-priority latin-7)
552 (nonascii-translation . iso-8859-13)
553 (input-method . "latvian-keyboard")
554 (documentation . "Support for Latvian."))
555 '("European"))
556
557 (set-language-info-alist
558 "Swedish" '((tutorial . "TUTORIAL.sv")
559 (charset iso-8859-1)
560 (coding-system iso-latin-1)
561 (coding-priority iso-latin-1)
562 (nonascii-translation . iso-8859-1)
563 (unibyte-display . iso-latin-1)
564 (sample-text . "Goddag Hej")
565 (documentation . "Support for Swedish"))
566 '("European"))
567
568 (set-language-info-alist
569 "Croatian" '((charset iso-8859-2)
570 (coding-system iso-8859-2)
571 (coding-priority iso-8859-2)
572 (input-method . "croatian")
573 (nonascii-translation . iso-8859-2)
574 (unibyte-display . iso-8859-2)
575 (documentation . "Support for Croatian with Latin-2 encoding."))
576 '("European"))
577
578 \f
579 (define-coding-system 'mac-roman
580 "Mac Roman Encoding (MIME:MACINTOSH)."
581 :coding-type 'charset
582 :mnemonic ?M
583 :charset-list '(mac-roman)
584 :mime-charset 'macintosh)
585
586 (define-coding-system 'next
587 "NeXTstep encoding"
588 :coding-type 'charset
589 :mnemonic ?*
590 :charset-list '(next)
591 :mime-charset 'next)
592
593 (define-coding-system 'hp-roman8
594 "Hewlet-Packard roman-8 encoding (MIME:ROMAN-8)"
595 :coding-type 'charset
596 :mnemonic ?*
597 :charset-list '(hp-roman8)
598 :mime-charset 'hp-roman8)
599 (define-coding-system-alias 'roman8 'hp-roman8)
600
601 (define-coding-system 'adobe-standard-encoding
602 "Adobe `standard' encoding for PostScript"
603 :coding-type 'charset
604 :mnemonic ?*
605 :charset-list '(adobe-standard-encoding)
606 :mime-charset 'adobe-standard-encoding)
607
608 \f
609 ;; For automatic composing of diacritics and combining marks.
610 (dolist (range '( ;; combining diacritical marks
611 (#x0300 #x0314 (tc . bc))
612 (#x0315 (tr . bl))
613 (#x0316 #x0319 (bc . tc))
614 (#x031A (tr . cl))
615 (#x031B #x0320 (bc . tc))
616 (#x0321 (Br . tr))
617 (#x0322 (Br . tl))
618 (#x0323 #x0333 (bc . tc))
619 (#x0334 #x0338 (Bc . Bc))
620 (#x0339 #x033C (bc . tc))
621 (#x033D #x033F (tc . bc))
622 (#x0340 (tl . bc))
623 (#x0341 (tr . bc))
624 (#x0342 #x0344 (tc . bc))
625 (#x0345 (bc . tc))
626 (#x0346 (tc . bc))
627 (#x0347 #x0349 (bc . tc))
628 (#x034A #x034C (tc . bc))
629 (#x034D #x034E (bc . tc))
630 ;; combining diacritical marks for symbols
631 (#x20D0 #x20D1 (tc . bc))
632 (#x20D2 #x20D3 (Bc . Bc))
633 (#x20D4 #x20D7 (tc . bc))
634 (#x20D8 #x20DA (Bc . Bc))
635 (#x20DB #x20DC (tc . bc))
636 (#x20DD #x20E0 (Bc . Bc))
637 (#x20E1 (tc . bc))
638 (#x20E2 #x20E3 (Bc . Bc))))
639 (let* ((from (car range))
640 (to (if (= (length range) 3)
641 (nth 1 range)
642 from))
643 (composition (car (last range))))
644 (while (<= from to)
645 (put-char-code-property from 'diacritic-composition composition)
646 (aset composition-function-table from 'diacritic-composition-function)
647 (setq from (1+ from)))))
648
649 (defconst diacritic-composition-pattern "\\C^\\c^+")
650
651 (defun diacritic-compose-region (beg end)
652 "Compose diacritic characters in the region.
653 When called from a program, expects two arguments,
654 positions (integers or markers) specifying the region."
655 (interactive "r")
656 (save-restriction
657 (narrow-to-region beg end)
658 (goto-char (point-min))
659 (while (re-search-forward diacritic-composition-pattern nil t)
660 (compose-region (match-beginning 0) (match-end 0)))))
661
662 (defun diacritic-compose-string (string)
663 "Compose diacritic characters in STRING and return the resulting string."
664 (let ((idx 0))
665 (while (setq idx (string-match diacritic-composition-pattern string idx))
666 (compose-string string idx (match-end 0))
667 (setq idx (match-end 0))))
668 string)
669
670 (defun diacritic-compose-buffer ()
671 "Compose diacritic characters in the current buffer."
672 (interactive)
673 (diacritic-compose-region (point-min) (point-max)))
674
675 (defun diacritic-post-read-conversion (len)
676 (diacritic-compose-region (point) (+ (point) len))
677 len)
678
679 (defun diacritic-composition-function (pos &optional string)
680 "Compose diacritic text around POS.
681 Optional 2nd argument STRING, if non-nil, is a string containing text
682 to compose.
683
684 The return value is the end position of composed characters,
685 or nil if no characters are composed."
686 (setq pos (1- pos))
687 (if string
688 (if (>= pos 0)
689 (let ((ch (aref string pos))
690 start end components ch composition)
691 (when (and (>= ch 32) (or (< ch 127) (>= ch 160)))
692 (setq start pos
693 end (length string)
694 components (list ch)
695 pos (1+ pos))
696 (while (and
697 (< pos end)
698 (setq ch (aref string pos)
699 composition
700 (get-char-code-property ch
701 'diacritic-composition)))
702 (setq components (cons ch (cons composition components))
703 pos (1+ pos)))
704 (compose-string string start pos (nreverse components))
705 pos)))
706 (if (>= pos (point-min))
707 (let ((ch (char-after pos))
708 start end components composition)
709 (when (and (>= ch 32) (or (< ch 127) (>= ch 160)))
710 (setq start pos
711 end (point-max)
712 components (list ch)
713 pos (1+ pos))
714 (while (and
715 (< pos end)
716 (setq ch (char-after pos)
717 composition
718 (get-char-code-property ch 'diacritic-composition)))
719 (setq components (cons ch (cons composition components))
720 pos (1+ pos)))
721 (compose-region start pos (nreverse components))
722 pos)))))
723
724 (provide 'european)
725
726 ;;; arch-tag: 9e018b12-fb02-4120-907b-9adeaf84b5c2
727 ;;; european.el ends here