comparison lisp/language/european.el @ 197:acd284d43ca1 r20-3b25

Import from CVS: tag r20-3b25
author cvs
date Mon, 13 Aug 2007 10:00:02 +0200
parents 929b76928fce
children e45d5e7c476e
comparison
equal deleted inserted replaced
196:58e0786448ca 197:acd284d43ca1
1 ;;; european.el --- Support for European languages 1 ;;; european.el --- Support for European languages
2 2
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 1997 MORIOKA Tomohiko 5 ;; Copyright (C) 1997 MORIOKA Tomohiko
6 6
7 ;; Keywords: multilingual, European 7 ;; Keywords: multilingual, European
8 8
9 ;; This file is part of XEmacs. 9 ;; This file is part of XEmacs.
28 ;; For Europeans, five character sets ISO8859-1,2,3,4,9 are supported. 28 ;; For Europeans, five character sets ISO8859-1,2,3,4,9 are supported.
29 29
30 ;;; Code: 30 ;;; Code:
31 31
32 ;; For syntax of Latin-1 characters. 32 ;; For syntax of Latin-1 characters.
33 (loop for c from 64 to 127 ; from '.AN@' to 'N' 33 (loop for c from 64 to 127 ; from ',A@(B' to ',A(B'
34 do (modify-syntax-entry (make-char 'latin-iso8859-1 c) "w")) 34 do (modify-syntax-entry (make-char 'latin-iso8859-1 c) "w"))
35 35
36 (modify-syntax-entry (make-char 'latin-iso8859-1 32) "w") ; no-break space 36 (modify-syntax-entry (make-char 'latin-iso8859-1 32) "w") ; no-break space
37 (modify-syntax-entry ?NW "_") 37 (modify-syntax-entry ?,AW(B "_")
38 (modify-syntax-entry ?Nw "_") 38 (modify-syntax-entry ?,Aw(B "_")
39 39
40 ;; For syntax of Latin-2 40 ;; For syntax of Latin-2
41 (loop for c in '(?.BN! ?N# ?N% ?N& ?N) ?N* ?N+ ?N, ?N. ?N/ ?N1 ?N3 ?N5 ?N6 ?N9 ?N: ?N; ?N<) 41 (loop for c in '(?,B!(B ?,B#(B ?,B%(B ?,B&(B ?,B)(B ?,B*(B ?,B+(B ?,B,(B ?,B.(B ?,B/(B ?,B1(B ?,B3(B ?,B5(B ?,B6(B ?,B9(B ?,B:(B ?,B;(B ?,B<(B)
42 do (modify-syntax-entry c "w")) 42 do (modify-syntax-entry c "w"))
43 43
44 (loop for c from 62 to 126 44 (loop for c from 62 to 126
45 do (modify-syntax-entry (make-char 'latin-iso8859-2 c) "w")) 45 do (modify-syntax-entry (make-char 'latin-iso8859-2 c) "w"))
46 46
47 (modify-syntax-entry (make-char 'latin-iso8859-2 32) "w") ; no-break space 47 (modify-syntax-entry (make-char 'latin-iso8859-2 32) "w") ; no-break space
48 (modify-syntax-entry ?NW ".") 48 (modify-syntax-entry ?,BW(B ".")
49 (modify-syntax-entry ?Nw ".") 49 (modify-syntax-entry ?,Bw(B ".")
50 50
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52 ;;; EUROPEANS 52 ;;; EUROPEANS
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54 54
55 (define-language-environment 'european 55 ;; (define-prefix-command 'describe-european-environment-map)
56 "European (for Latin-1 through Latin-5)" 56 ;; (define-key-after describe-language-environment-map [European]
57 (lambda () 57 ;; '("European" . describe-european-environment-map)
58 (set-coding-category-system 'iso-8-designate 'iso-8859-1) 58 ;; t)
59 (set-coding-priority-list '(iso-8-designate iso-8-1)) 59
60 ;;(setq locale-coding-system 'no-conversion) ; iso-8859-1 60 ;; (define-prefix-command 'setup-european-environment-map)
61 (set-default-buffer-file-coding-system 'no-conversion) ; iso-8859-1 61 ;; (define-key-after setup-language-environment-map [European]
62 ;;(set-buffer-file-coding-system-for-read 'no-conversion) ; iso-8859-1 62 ;; '("European" . setup-european-environment-map)
63 ;;(setq display-coding-system 'iso-8859-1) 63 ;; t)
64 ;;(setq keyboard-coding-system 'iso-8859-1) 64
65 ;; (setq-default quail-current-package 65 ;; Setup for LANGAUGE which uses one-byte 8-bit CHARSET, one-byte
66 ;; (assoc "latin-1" quail-package-alist)) 66 ;; 8-bit CODING-SYSTEM, and INPUT-METHOD.
67 )) 67 (defun setup-8-bit-environment (language charset coding-system input-method)
68 68 (setup-english-environment)
69 ;; (make-coding-system 69 (set-default-coding-systems coding-system)
70 ;; 'iso-8859-1 2 ?X 70 (setq coding-category-iso-8-1 coding-system
71 ;; "Coding-system used in X as Compound Text Encoding." 71 coding-category-iso-8-2 coding-system)
72
73 (if charset
74 (let ((nonascii-offset (- (make-char charset) 128)))
75 ;; Set up for insertion of characters in this character set
76 ;; when codes 0200 - 0377 are typed in.
77 (setq nonascii-insert-offset nonascii-offset)))
78
79 (if input-method
80 (setq default-input-method input-method))
81
82 ;; If this is a Latin-N character set, set up syntax for it in
83 ;; single-byte mode. We can't use require because the file
84 ;; must be eval'd each time in case we change from one Latin-N to another.
85 (if (string-match "^Latin-\\([1-9]\\)$" language)
86 (load (downcase language) nil t)))
87
88 ;; (define-language-environment 'european
89 ;; "European (for Latin-1 through Latin-5)"
90 ;; (lambda ()
91 ;; (set-coding-category-system 'iso-8-designate 'iso-8859-1)
92 ;; (set-coding-priority-list '(iso-8-designate iso-8-1))
93 ;; ;;(setq locale-coding-system 'no-conversion) ; iso-8859-1
94 ;; (set-default-buffer-file-coding-system 'no-conversion) ; iso-8859-1
95 ;; ;;(set-buffer-file-coding-system-for-read 'no-conversion) ; iso-8859-1
96 ;; ;;(setq display-coding-system 'iso-8859-1)
97 ;; ;;(setq keyboard-coding-system 'iso-8859-1)
98 ;; ;; (setq-default quail-current-package
99 ;; ;; (assoc "latin-1" quail-package-alist))
100 ;; ))
101
102 ;; Latin-1 (ISO-8859-1)
103
104 ;; (make-coding-system
105 ;; 'iso-latin-1 2 ?1
106 ;; "ISO 2022 based 8-bit encoding (MIME:ISO-8859-1, Compound Text Encoding)"
72 ;; '((ascii t) (latin-iso8859-1 t) nil nil 107 ;; '((ascii t) (latin-iso8859-1 t) nil nil
73 ;; nil ascii-eol ascii-cntl)) 108 ;; nil ascii-eol ascii-cntl nil nil nil nil nil nil nil nil nil t))
74 109
75 ;; CTEXT is an alias for ISO-8859-1 110 ;; (define-coding-system-alias 'iso-8859-1 'iso-latin-1)
76 ;; (define-coding-system-alias 'iso-8859-1 'ctext) 111 ;; (define-coding-system-alias 'latin-1 'iso-latin-1)
77 112 ;; (define-coding-system-alias 'ctext 'iso-latin-1)
78 ;; (make-coding-system 113
79 ;; 'iso-8859-2 2 ?2 "MIME ISO-8859-2" 114 (defun setup-latin1-environment ()
115 "Set up multilingual environment (MULE) for European Latin-1 users."
116 (interactive)
117 (setup-8-bit-environment "Latin-1" 'latin-iso8859-1 'iso-8859-1
118 "latin-1-prefix"))
119
120 (set-language-info-alist
121 "Latin-1" '((setup-function . (setup-latin1-environment
122 . setup-european-environment-map))
123 (charset . (ascii latin-iso8859-1))
124 (coding-system . (iso-8859-1))
125 (sample-text
126 . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
127 (documentation . ("\
128 These languages are supported with the Latin-1 (ISO-8859-1) character set:
129 Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
130 Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
131 " . describe-european-environment-map))
132 ))
133
134 ;; Latin-2 (ISO-8859-2)
135
136 ;; (make-coding-system
137 ;; 'iso-latin-2 2 ?2
138 ;; "ISO 2022 based 8-bit encoding (MIME:ISO-8859-2)"
80 ;; '((ascii t) (latin-iso8859-2 t) nil nil 139 ;; '((ascii t) (latin-iso8859-2 t) nil nil
81 ;; nil ascii-eol ascii-cntl nil nil nil nil)) 140 ;; nil ascii-eol ascii-cntl nil nil nil nil))
141
142 ;; (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
143 ;; (define-coding-system-alias 'latin-2 'iso-latin-2)
82 144
83 (make-coding-system 145 (make-coding-system
84 'iso-8859-2 'iso2022 "MIME ISO-8859-2" 146 'iso-8859-2 'iso2022 "MIME ISO-8859-2"
85 '(charset-g0 ascii 147 '(charset-g0 ascii
86 charset-g1 latin-iso8859-2 148 charset-g1 latin-iso8859-2
87 charset-g2 t 149 charset-g2 t
88 charset-g3 t 150 charset-g3 t
89 mnemonic "MIME/Ltn-2" 151 mnemonic "MIME/Ltn-2"
90 )) 152 ))
91 153
92 ;; (make-coding-system 154 (defun setup-latin2-environment ()
93 ;; 'iso-8859-3 2 ?3 "MIME ISO-8859-3" 155 "Set up multilingual environment (MULE) for European Latin-2 users."
156 (interactive)
157 (setup-8-bit-environment "Latin-2" 'latin-iso8859-2 'iso-8859-2
158 "latin-2-prefix"))
159
160 (set-language-info-alist
161 "Latin-2" '((setup-function . (setup-latin2-environment
162 . setup-european-environment-map))
163 (charset . (ascii latin-iso8859-2))
164 (coding-system . (iso-8859-2))
165 (documentation . ("\
166 These languages are supported with the Latin-2 (ISO-8859-2) character set:
167 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
168 Serbo-Croatian or Croatian, Slovak, Slovene, and Swedish.
169 " . describe-european-environment-map))
170 ))
171
172 ;; Latin-3 (ISO-8859-3)
173
174 ;; (make-coding-system
175 ;; 'iso-latin-3 2 ?3
176 ;; "ISO 2022 based 8-bit encoding (MIME:ISO-8859-3)"
94 ;; '((ascii t) (latin-iso8859-3 t) nil nil 177 ;; '((ascii t) (latin-iso8859-3 t) nil nil
95 ;; nil ascii-eol ascii-cntl nil nil nil nil)) 178 ;; nil ascii-eol ascii-cntl nil nil nil nil))
179
180 ;; (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
181 ;; (define-coding-system-alias 'latin-3 'iso-latin-3)
96 182
97 (make-coding-system 183 (make-coding-system
98 'iso-8859-3 'iso2022 "MIME ISO-8859-3" 184 'iso-8859-3 'iso2022 "MIME ISO-8859-3"
99 '(charset-g0 ascii 185 '(charset-g0 ascii
100 charset-g1 latin-iso8859-3 186 charset-g1 latin-iso8859-3
101 charset-g2 t 187 charset-g2 t
102 charset-g3 t 188 charset-g3 t
103 mnemonic "MIME/Ltn-3" 189 mnemonic "MIME/Ltn-3"
104 )) 190 ))
105 191
106 ;; (make-coding-system 192 (defun setup-latin3-environment ()
107 ;; 'iso-8859-4 2 ?4 "MIME ISO-8859-4" 193 "Set up multilingual environment (MULE) for European Latin-3 users."
194 (interactive)
195 (setup-8-bit-environment "Latin-3" 'latin-iso8859-3 'iso-8859-3
196 "latin-3-prefix"))
197
198 (set-language-info-alist
199 "Latin-3" '((setup-function . (setup-latin3-environment
200 . setup-european-environment-map))
201 (charset . (ascii latin-iso8859-3))
202 (coding-system . (iso-8859-3))
203 (documentation . ("\
204 These languages are supported with the Latin-3 (ISO-8859-3) character set:
205 Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
206 German, Italian, Maltese, Spanish, and Turkish.
207 " . describe-european-environment-map))
208 ))
209
210 ;; Latin-4 (ISO-8859-4)
211
212 ;; (make-coding-system
213 ;; 'iso-latin-4 2 ?4
214 ;; "ISO 2022 based 8-bit encoding (MIME:ISO-8859-4)"
108 ;; '((ascii t) (latin-iso8859-4 t) nil nil 215 ;; '((ascii t) (latin-iso8859-4 t) nil nil
109 ;; nil ascii-eol ascii-cntl nil nil nil nil)) 216 ;; nil ascii-eol ascii-cntl nil nil nil nil))
217
218 ;; (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
219 ;; (define-coding-system-alias 'latin-4 'iso-latin-4)
110 220
111 (make-coding-system 221 (make-coding-system
112 'iso-8859-4 'iso2022 "MIME ISO-8859-4" 222 'iso-8859-4 'iso2022 "MIME ISO-8859-4"
113 '(charset-g0 ascii 223 '(charset-g0 ascii
114 charset-g1 latin-iso8859-4 224 charset-g1 latin-iso8859-4
115 charset-g2 t 225 charset-g2 t
116 charset-g3 t 226 charset-g3 t
117 mnemonic "MIME/Ltn-4" 227 mnemonic "MIME/Ltn-4"
118 )) 228 ))
119 229
120 ;; (make-coding-system 230 (defun setup-latin4-environment ()
121 ;; 'iso-8859-9 2 ?9 "MIME ISO-8859-9" 231 "Set up multilingual environment (MULE) for European Latin-4 users."
232 (interactive)
233 (setup-8-bit-environment "Latin-4" 'latin-iso8859-4 'iso-8859-4
234 "latin-4-prefix"))
235
236 (set-language-info-alist
237 "Latin-4" '((setup-function . (setup-latin4-environment
238 . setup-european-environment-map))
239 (charset . (ascii latin-iso8859-4))
240 (coding-system . (iso-8859-4))
241 (documentation . ("\
242 These languages are supported with the Latin-4 (ISO-8859-4) character set:
243 Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
244 Latvian, Lithuanian, and Norwegian.
245 " . describe-european-environment-map))
246 ))
247
248 ;; Latin-5 (ISO-8859-9)
249
250 ;; (make-coding-system
251 ;; 'iso-latin-5 2 ?9
252 ;; "ISO 2022 based 8-bit encoding (MIME:ISO-8859-9)"
122 ;; '((ascii t) (latin-iso8859-9 t) nil nil 253 ;; '((ascii t) (latin-iso8859-9 t) nil nil
123 ;; nil ascii-eol ascii-cntl nil nil nil nil)) 254 ;; nil ascii-eol ascii-cntl nil nil nil nil))
255
256 ;; (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
257 ;; (define-coding-system-alias 'latin-5 'iso-latin-5)
124 258
125 (make-coding-system 259 (make-coding-system
126 'iso-8859-9 'iso2022 "MIME ISO-8859-9" 260 'iso-8859-9 'iso2022 "MIME ISO-8859-9"
127 '(charset-g0 ascii 261 '(charset-g0 ascii
128 charset-g1 latin-iso8859-9 262 charset-g1 latin-iso8859-9
129 charset-g2 t 263 charset-g2 t
130 charset-g3 t 264 charset-g3 t
131 mnemonic "MIME/Ltn-5" 265 mnemonic "MIME/Ltn-5"
132 )) 266 ))
133 267
134 (register-input-method "European" 268 (defun setup-latin5-environment ()
135 '("quail-latin-1" quail-use-package "quail/latin")) 269 "Set up multilingual environment (MULE) for European Latin-5 users."
136 (register-input-method "European" 270 (interactive)
137 '("quail-latin-2" quail-use-package "quail/latin")) 271 (setup-8-bit-environment "Latin-5" 'latin-iso8859-9 'iso-8859-5
138 (register-input-method "European" 272 "latin-5-prefix"))
139 '("quail-latin-3" quail-use-package "quail/latin")) 273
140 (register-input-method "European" 274 (set-language-info-alist
141 '("quail-latin-4" quail-use-package "quail/latin")) 275 "Latin-5" '((setup-function . (setup-latin5-environment
142 (register-input-method "European" 276 . setup-european-environment-map))
143 '("quail-latin-5" quail-use-package "quail/latin")) 277 (charset . (ascii latin-iso8859-9))
144 278 (coding-system . (iso-8859-5))
145 (defun setup-european-environment () 279 (documentation . ("\
146 "Setup multilingual environment (MULE) for European languages users. 280 These languages are supported with the Latin-5 (ISO-8859-9) character set.
147 It actually reset MULE to the default status, and 281 " . describe-european-environment-map))
148 set quail-latin-1 as the default input method to be selected. 282 ))
149 See also the documentation of setup-english-environment." 283
150 (setup-english-environment) 284 ;; (defun setup-european-environment ()
151 (setq default-input-method '("European" . "quail-latin-1"))) 285 ;; "Setup multilingual environment (MULE) for European languages users.
152 286 ;; It actually reset MULE to the default status, and
153 (defun describe-european-support () 287 ;; set quail-latin-1 as the default input method to be selected.
154 "Describe how Emacs support European languages." 288 ;; See also the documentation of setup-english-environment."
155 (interactive) 289 ;; (setup-english-environment)
156 (describe-language-support-internal "European")) 290 ;; (setq default-input-method '("European" . "quail-latin-1")))
157 291
158 (set-language-info-alist 292 ;; (defun describe-european-support ()
159 "European" '((setup-function . setup-european-environment) 293 ;; "Describe how Emacs support European languages."
160 (describe-function . describe-european-support) 294 ;; (interactive)
161 (charset . (ascii latin-iso8859-1 latin-iso8859-2 295 ;; (describe-language-support-internal "European"))
162 latin-iso8859-3 latin-iso8859-4 latin-iso8859-9)) 296
163 (coding-system . (iso-8859-1 iso-8859-2 iso-8859-3 297 ;; (set-language-info-alist
164 iso-8859-4 iso-8859-9)) 298 ;; "European" '((setup-function . setup-european-environment)
165 (sample-text 299 ;; (describe-function . describe-european-support)
166 . "Hello, Hej, Tere, Hei, Bonjour, Gr.AN|N_ Gott, Ciao, N!Hola!") 300 ;; (charset . (ascii latin-iso8859-1 latin-iso8859-2
167 (documentation . "\ 301 ;; latin-iso8859-3 latin-iso8859-4 latin-iso8859-9))
168 Almost all of European languages are supported by the character sets and 302 ;; (coding-system . (iso-8859-1 iso-8859-2 iso-8859-3
169 coding systems listed below. 303 ;; iso-8859-4 iso-8859-9))
170 To input them, LEIM (Libraries for Emacs Input Methods) should have been 304 ;; (sample-text
171 installed.") 305 ;; . "Hello, Hej, Tere, Hei, Bonjour, Gr,A|_(B Gott, Ciao, ,A!(BHola!")
172 )) 306 ;; (documentation . "\
173 307 ;; Almost all of European languages are supported by the character sets and
174 (let ((languages '("French" "German" "Spanish" "Italian" 308 ;; coding systems listed below.
175 ;; We have to list much more European langauges here. 309 ;; To input them, LEIM (Libraries for Emacs Input Methods) should have been
176 )) 310 ;; installed.")
177 (val '("quail-latin-1" quail-use-package "quail/latin"))) 311 ;; ))
178 (while languages
179 (register-input-method (car languages) val)
180 (setq languages (cdr languages))))
181
182 (register-input-method "Esperanto"
183 '("quail-esperanto" quail-use-package "quail/latin"))
184
185 (mapcar (function
186 (lambda (method)
187 (register-input-method "Italian"
188 (cons method
189 '(quail-use-package "quail/latin")))
190 ))
191 '("quail-italian" "quail-itln"))
192
193 (mapcar (function
194 (lambda (method)
195 (register-input-method "Spanish"
196 (cons method
197 '(quail-use-package "quail/latin")))
198 ))
199 '("quail-spanish" "quail-spnsh"))
200
201 (mapcar (function
202 (lambda (method)
203 (register-input-method "French"
204 (cons method
205 '(quail-use-package "quail/latin")))
206 ))
207 '("quail-french" "quail-frnch" "quail-azerty"))
208
209 (mapcar (function
210 (lambda (method)
211 (register-input-method "German"
212 (cons method
213 '(quail-use-package "quail/latin")))
214 ))
215 '("quail-german" "quail-grmn"))
216
217 (register-input-method "Scandinavian"
218 '("quail-scandinavian" quail-use-package "quail/latin"))
219
220 (mapcar (function
221 (lambda (method)
222 (register-input-method "Icelandic"
223 (cons method
224 '(quail-use-package "quail/latin")))
225 ))
226 '("quail-icelandic" "quail-iclndc"))
227
228 (mapcar (function
229 (lambda (method)
230 (register-input-method "Danish"
231 (cons method
232 '(quail-use-package "quail/latin")))
233 ))
234 '("quail-danish" "quail-dnsh"))
235
236 (mapcar (function
237 (lambda (method)
238 (register-input-method "Norwegian"
239 (cons method
240 '(quail-use-package "quail/latin")))
241 ))
242 '("quail-norwegian" "quail-nrwgn"))
243
244 (mapcar (function
245 (lambda (method)
246 (register-input-method "Swedish"
247 (cons method
248 '(quail-use-package "quail/latin")))
249 ))
250 '("quail-swedish" "quail-swdsh"))
251
252 (mapcar (function
253 (lambda (method)
254 (register-input-method "Finish"
255 (cons method
256 '(quail-use-package "quail/latin")))
257 ))
258 '("quail-finnish" "quail-fnnsh"))
259
260 (register-input-method "Turkish"
261 '("quail-turkish" quail-use-package "quail/latin"))
262 312
263 ;;; european.el ends here 313 ;;; european.el ends here