Mercurial > hg > xemacs-beta
annotate lisp/mule/japanese.el @ 4610:38e8af61f38d
Check if env vars are encodable by native coding system, #'setenv
2009-02-11 Aidan Kehoe <kehoea@parhasard.net>
* process.el (setenv):
Check whether the environment variable and value can be encoded by
the native coding system, error if not, as does GNU Emacs (but our
implementation is different).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 11 Feb 2009 12:14:28 +0000 |
parents | 1d74a1d115ee |
children | 311f6817efc2 308d34e9f07d |
rev | line source |
---|---|
428 | 1 ;;; japanese.el --- Japanese support -*- coding: iso-2022-7bit; -*- |
2 | |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
4 ;; Licensed to the Free Software Foundation. | |
5 ;; Copyright (C) 1997 MORIOKA Tomohiko | |
771 | 6 ;; Copyright (C) 2000, 2002 Ben Wing. |
428 | 7 |
8 ;; Keywords: multilingual, Japanese | |
9 | |
10 ;; This file is part of XEmacs. | |
11 | |
12 ;; XEmacs is free software; you can redistribute it and/or modify it | |
13 ;; under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; XEmacs is distributed in the hope that it will be useful, but | |
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 ;; General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
25 ;; 02111-1307, USA. | |
26 | |
771 | 27 ;;; Synched up with: Emacs 20.6 (international/japanese.el). |
28 | |
428 | 29 ;;; Commentary: |
30 | |
31 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are | |
32 ;; supported. | |
33 | |
34 ;;; Code: | |
35 | |
778 | 36 (make-charset 'japanese-jisx0213-1 "JISX0213 Plane 1 (Japanese)" |
37 '(dimension | |
38 2 | |
3659 | 39 registries ["JISX0213.2000-1"] |
778 | 40 chars 94 |
41 columns 2 | |
42 direction l2r | |
43 final ?O | |
44 graphic 0 | |
45 short-name "JISX0213-1" | |
46 long-name "JISX0213-1" | |
47 )) | |
48 | |
49 ;; JISX0213 Plane 2 | |
50 (make-charset 'japanese-jisx0213-2 "JISX0213 Plane 2 (Japanese)" | |
51 '(dimension | |
52 2 | |
3659 | 53 registries ["JISX0213.2000-2"] |
778 | 54 chars 94 |
55 columns 2 | |
56 direction l2r | |
57 final ?P | |
58 graphic 0 | |
59 short-name "JISX0213-2" | |
60 long-name "JISX0213-2" | |
61 )) | |
62 | |
428 | 63 ;;; Syntax of Japanese characters. |
64 (loop for row in '(33 34 40) | |
65 do (modify-syntax-entry `[japanese-jisx0208 ,row] "_")) | |
66 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B ?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B) | |
67 do (modify-syntax-entry char "w")) | |
68 (modify-syntax-entry ?\$B!J(B "($B!K(B") | |
69 (modify-syntax-entry ?\$B!N(B "($B!O(B") | |
70 (modify-syntax-entry ?\$B!P(B "($B!Q(B") | |
71 (modify-syntax-entry ?\$B!V(B "($B!W(B") | |
72 (modify-syntax-entry ?\$B!X(B "($B!Y(B") | |
73 (modify-syntax-entry ?\$B!K(B ")$B!J(B") | |
74 (modify-syntax-entry ?\$B!O(B ")$B!N(B") | |
75 (modify-syntax-entry ?\$B!Q(B ")$B!P(B") | |
76 (modify-syntax-entry ?\$B!W(B ")$B!V(B") | |
77 (modify-syntax-entry ?\$B!Y(B ")$B!X(B") | |
78 | |
79 ;;; Character categories S, A, H, K, G, Y, and C | |
80 (define-category ?S "Japanese 2-byte symbol character.") | |
81 (modify-category-entry [japanese-jisx0208 33] ?S) | |
82 (modify-category-entry [japanese-jisx0208 34] ?S) | |
83 (modify-category-entry [japanese-jisx0208 40] ?S) | |
84 (define-category ?A "Japanese 2-byte Alphanumeric character.") | |
85 (modify-category-entry [japanese-jisx0208 35] ?A) | |
86 (define-category ?H "Japanese 2-byte Hiragana character.") | |
87 (modify-category-entry [japanese-jisx0208 36] ?H) | |
88 (define-category ?K "Japanese 2-byte Katakana character.") | |
89 (modify-category-entry [japanese-jisx0208 37] ?K) | |
90 (define-category ?G "Japanese 2-byte Greek character.") | |
91 (modify-category-entry [japanese-jisx0208 38] ?G) | |
92 (define-category ?Y "Japanese 2-byte Cyrillic character.") | |
93 (modify-category-entry [japanese-jisx0208 39] ?Y) | |
94 (define-category ?C "Japanese 2-byte Kanji characters.") | |
95 (loop for row from 48 to 126 | |
96 do (modify-category-entry `[japanese-jisx0208 ,row] ?C)) | |
97 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B) | |
98 do (modify-category-entry char ?K) | |
99 (modify-category-entry char ?H)) | |
100 (loop for char in '(?$B!3(B ?$B!4(B ?$B!5(B ?$B!6(B ?$B!7(B ?$B!8(B ?$B!9(B ?$B!:(B ?$B!;(B) | |
101 do (modify-category-entry char ?C)) | |
102 (modify-category-entry 'japanese-jisx0212 ?C) | |
103 | |
104 (defvar japanese-word-regexp | |
105 "\\cA+\\cH*\\|\\cK+\\cH*\\|\\cC+\\cH*\\|\\cH+\\|\\ck+\\|\\sw+" | |
106 "Regular expression used to match a Japanese word.") | |
107 | |
108 (set-word-regexp japanese-word-regexp) | |
109 (setq forward-word-regexp "\\w\\>") | |
110 (setq backward-word-regexp "\\<\\w") | |
111 | |
112 ;;; Paragraph setting | |
113 (setq sentence-end | |
114 (concat | |
115 "\\(" | |
116 "\\(" | |
117 "[.?!][]\"')}]*" | |
118 "\\|" | |
119 "[$B!%!)!*(B][$B!O!I!G!K!Q!M!S!U!W!Y(B]*" | |
120 "\\)" | |
121 "\\($\\|\t\\| \\)" | |
122 "\\|" | |
123 "$B!#(B" | |
124 "\\)" | |
125 "[ \t\n]*")) | |
1891 | 126 |
127 ;; allow paragraphs to start with a zenkaku space | |
128 (setq paragraph-start "[ $B!!(B\t\n\f]") | |
129 (setq paragraph-separate "[ $B!!(B\t\f]*$") | |
428 | 130 |
131 ;; EGG specific setup | |
132 (define-egg-environment 'japanese | |
133 "Japanese settings for egg." | |
134 (lambda () | |
771 | 135 (with-boundp '(its:*standard-modes* its:*current-map* wnn-server-type) |
136 (with-fboundp 'its:get-mode-map | |
137 (when (not (featurep 'egg-jpn)) | |
138 (load "its-hira") | |
139 (load "its-kata") | |
140 (load "its-hankaku") | |
141 (load "its-zenkaku") | |
142 (setq its:*standard-modes* | |
143 (append | |
144 (list (its:get-mode-map "roma-kana") | |
145 (its:get-mode-map "roma-kata") | |
146 (its:get-mode-map "downcase") | |
147 (its:get-mode-map "upcase") | |
148 (its:get-mode-map "zenkaku-downcase") | |
149 (its:get-mode-map "zenkaku-upcase")) | |
150 its:*standard-modes*)) | |
151 (provide 'egg-jpn)) | |
152 (setq wnn-server-type 'jserver) | |
153 ;; Can't do this here any more. Must do it when selecting egg-wnn | |
154 ;; or egg-sj3 | |
155 ;; (setq egg-default-startup-file "eggrc-wnn") | |
156 (setq-default its:*current-map* (its:get-mode-map "roma-kana")))))) | |
428 | 157 |
450 | 158 ;; stuff for providing grammatic processing of Japanese text |
428 | 159 ;; something like this should probably be created for all environments... |
450 | 160 ;; #### Arrgh. This stuff should defvar'd in either fill.el or kinsoku.el. |
161 ;; Then the language environment should set these things, probably buffer- | |
162 ;; locally. | |
428 | 163 |
771 | 164 ;; #### will be moved to fill.el |
165 (defvar space-insertable | |
166 (let* ((aletter (concat "\\(" ascii-char "\\|" kanji-char "\\)")) | |
167 (kanji-space-insertable | |
168 (concat | |
428 | 169 "$B!"(B" aletter "\\|" |
170 "$B!#(B" aletter "\\|" | |
171 aletter "$B!J(B" "\\|" | |
172 "$B!K(B" aletter "\\|" | |
173 ascii-alphanumeric kanji-kanji-char "\\|" | |
771 | 174 kanji-kanji-char ascii-alphanumeric))) |
175 (concat " " aletter "\\|" kanji-space-insertable)) | |
176 "Regexp for finding points that can have spaces inserted into them for justification") | |
428 | 177 |
771 | 178 ;; Beginning of FSF synching with international/japanese.el. |
179 | |
428 | 180 ;; (make-coding-system |
181 ;; 'iso-2022-jp 2 ?J | |
182 ;; "ISO 2022 based 7bit encoding for Japanese (MIME:ISO-2022-JP)" | |
183 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208 | |
184 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201) nil nil nil | |
185 ;; short ascii-eol ascii-cntl seven) | |
186 ;; '((safe-charsets ascii japanese-jisx0208-1978 japanese-jisx0208 | |
187 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201) | |
188 ;; (mime-charset . iso-2022-jp))) | |
189 | |
190 (make-coding-system | |
191 'iso-2022-jp 'iso2022 | |
771 | 192 "ISO-2022-JP (Japanese mail)" |
428 | 193 '(charset-g0 ascii |
194 short t | |
195 seven t | |
196 input-charset-conversion ((latin-jisx0201 ascii) | |
197 (japanese-jisx0208-1978 japanese-jisx0208)) | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
198 safe-charsets (ascii japanese-jisx0208-1978 japanese-jisx0208 |
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
199 latin-jisx0201 japanese-jisx0212 katakana-jisx0201) |
428 | 200 mnemonic "MULE/7bit" |
771 | 201 documentation |
202 "Coding system used for communication with mail and news in Japan." | |
203 )) | |
204 | |
205 (make-coding-system | |
206 'jis7 'iso2022 | |
207 "JIS7 (old Japanese 7-bit encoding)" | |
208 '(charset-g0 ascii | |
209 charset-g1 katakana-jisx0201 | |
210 short t | |
211 seven t | |
212 lock-shift t | |
213 input-charset-conversion ((latin-jisx0201 ascii) | |
214 (japanese-jisx0208-1978 japanese-jisx0208)) | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
215 safe-charsets (latin-jisx0201 ascii japanese-jisx0208-1978 japanese-jisx0208) |
771 | 216 mnemonic "JIS7" |
217 documentation | |
218 "Old JIS 7-bit encoding; mostly superseded by ISO-2022-JP. | |
219 Uses locking-shift (SI/SO) to select half-width katakana." | |
220 )) | |
221 | |
222 (make-coding-system | |
223 'jis8 'iso2022 | |
224 "JIS8 (old Japanese 8-bit encoding)" | |
225 '(charset-g0 ascii | |
226 charset-g1 katakana-jisx0201 | |
227 short t | |
228 input-charset-conversion ((latin-jisx0201 ascii) | |
229 (japanese-jisx0208-1978 japanese-jisx0208)) | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
230 safe-charsets (latin-jisx0201 ascii japanese-jisx0208-1978 |
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
231 japanese-jisx0208) |
771 | 232 mnemonic "JIS8" |
233 documentation | |
234 "Old JIS 8-bit encoding; mostly superseded by ISO-2022-JP. | |
235 Uses high bytes for half-width katakana." | |
428 | 236 )) |
237 | |
238 (define-coding-system-alias 'junet 'iso-2022-jp) | |
239 | |
240 ;; (make-coding-system | |
241 ;; 'iso-2022-jp-2 2 ?J | |
242 ;; "ISO 2022 based 7bit encoding for CJK, Latin-1, and Greek (MIME:ISO-2022-JP-2)" | |
243 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208 | |
244 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201 | |
245 ;; chinese-gb2312 korean-ksc5601) nil | |
246 ;; (nil latin-iso8859-1 greek-iso8859-7) nil | |
247 ;; short ascii-eol ascii-cntl seven nil single-shift) | |
248 ;; '((safe-charsets ascii japanese-jisx0208-1978 japanese-jisx0208 | |
249 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201 | |
250 ;; chinese-gb2312 korean-ksc5601 | |
251 ;; latin-iso8859-1 greek-iso8859-7) | |
252 ;; (mime-charset . iso-2022-jp-2))) | |
253 | |
254 ;; (make-coding-system | |
255 ;; 'japanese-shift-jis 1 ?S | |
256 ;; "Shift-JIS 8-bit encoding for Japanese (MIME:SHIFT_JIS)" | |
257 ;; nil | |
258 ;; '((safe-charsets ascii japanese-jisx0208 japanese-jisx0208-1978 | |
259 ;; latin-jisx0201 katakana-jisx0201) | |
771 | 260 ;; (mime-charset . shift-jis) |
428 | 261 ;; (charset-origin-alist (japanese-jisx0208 "SJIS" encode-sjis-char) |
262 ;; (katakana-jisx0201 "SJIS" encode-sjis-char)))) | |
263 | |
264 (make-coding-system | |
771 | 265 'shift-jis 'shift-jis |
266 "Shift-JIS" | |
267 '(mnemonic "Ja/SJIS" | |
268 documentation "The standard Japanese encoding in MS Windows." | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
269 safe-charsets (ascii japanese-jisx0208 japanese-jisx0208-1978 |
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
270 latin-jisx0201 katakana-jisx0201) |
771 | 271 )) |
428 | 272 |
771 | 273 ;; A former name? |
274 (define-coding-system-alias 'shift_jis 'shift-jis) | |
275 | |
276 ;; FSF: | |
277 ;; (define-coding-system-alias 'shift-jis 'japanese-shift-jis) | |
428 | 278 ;; (define-coding-system-alias 'sjis 'japanese-shift-jis) |
279 | |
280 ;; (make-coding-system | |
281 ;; 'japanese-iso-7bit-1978-irv 2 ?j | |
282 ;; "ISO 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman" | |
283 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208 | |
284 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201 t) nil nil nil | |
285 ;; short ascii-eol ascii-cntl seven nil nil use-roman use-oldjis) | |
286 ;; '(ascii japanese-jisx0208-1978 japanese-jisx0208 latin-jisx0201)) | |
287 | |
288 (make-coding-system | |
289 'iso-2022-jp-1978-irv 'iso2022 | |
771 | 290 "ISO-2022-JP-1978-IRV (Old JIS)" |
428 | 291 '(charset-g0 ascii |
292 short t | |
293 seven t | |
294 output-charset-conversion ((ascii latin-jisx0201) | |
295 (japanese-jisx0208 japanese-jisx0208-1978)) | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
296 safe-charsets (ascii latin-jisx0201 japanese-jisx0208 |
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
297 japanese-jisx0208-1978) |
771 | 298 documentation |
299 "This is a coding system used for old JIS terminals. It's an ISO | |
300 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman." | |
428 | 301 mnemonic "Ja-78/7bit" |
302 )) | |
303 | |
771 | 304 ;; FSF: |
428 | 305 ;; (define-coding-system-alias 'iso-2022-jp-1978-irv 'japanese-iso-7bit-1978-irv) |
306 ;; (define-coding-system-alias 'old-jis 'japanese-iso-7bit-1978-irv) | |
307 | |
308 (define-coding-system-alias 'old-jis 'iso-2022-jp-1978-irv) | |
309 | |
310 ;; (make-coding-system | |
311 ;; 'japanese-iso-8bit 2 ?E | |
312 ;; "ISO 2022 based EUC encoding for Japanese (MIME:EUC-JP)" | |
313 ;; '(ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212 | |
314 ;; short ascii-eol ascii-cntl nil nil single-shift) | |
315 ;; '((safe-charsets ascii latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978 | |
771 | 316 ;; katakana-jisx0201 japanese-jisx0212) |
428 | 317 ;; (mime-charset . euc-jp))) |
771 | 318 ;; |
428 | 319 (make-coding-system |
320 'euc-jp 'iso2022 | |
771 | 321 "Japanese EUC" |
428 | 322 '(charset-g0 ascii |
323 charset-g1 japanese-jisx0208 | |
324 charset-g2 katakana-jisx0201 | |
325 charset-g3 japanese-jisx0212 | |
4568
1d74a1d115ee
Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4145
diff
changeset
|
326 safe-charsets (ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212) |
428 | 327 short t |
328 mnemonic "Ja/EUC" | |
771 | 329 documentation |
330 "Japanese EUC (Extended Unix Code), the standard Japanese encoding in Unix. | |
331 Equivalent MIME encoding: EUC-JP. | |
332 | |
333 Japanese EUC was the forefather of all the different EUC's, which all follow | |
334 a similar structure: | |
335 | |
336 1. Up to four character sets can be encoded. | |
337 | |
338 2. This is a non-modal encoding, i.e. it is impossible to set a global state | |
339 that affects anything more than the directly following character. [Modal | |
340 encodings typically have escape sequences to change global settings, which | |
341 affect all the following characters until the setting is turned off. | |
342 Modal encodings are typically used when it's necessary to support text in | |
343 a wide variety of character sets and still keep basic ASCII compatibility, | |
344 or in cases (e.g. sending email) where the allowed characters that can | |
345 pass the gateway are small and (typically) no high-bit range is available. | |
346 | |
347 3. The first character set is always ASCII or some national variant of it, | |
348 and encoded in the standard ASCII position. All characters in all other | |
349 character sets are encoded entirely using high-half bytes. Therefore, | |
350 it is safe to scan for ASCII characters, such as '/' to separate path | |
351 components, in the obvious way. | |
352 | |
353 4. Each of the other three character sets can be of dimension 1, 2, or 3. | |
354 A dimension-1 character set contains 96 bytes; a dimension-2 character | |
355 set contains 96 x 96 bytes; and a dimension-3 character set contains | |
356 96 x 96 x 96 bytes. 94 instead of 96 as the number of characters per | |
357 dimension is also supported. Character sets of dimensions 1, 2, and 3 | |
358 use 1-3 bytes, respectively, to encode a character, and each byte is | |
359 in the range A0-FF (or A1-FE for those with 94 bytes per dimension). | |
360 | |
361 5. The four character sets encoded in EUC are called G0, G1, G2, and G3. | |
362 As mentioned earlier, G0 is ASCII or some variant, and encoded into | |
363 the ASCII positions 00 - 7F. G1 is encoded directly by laying out | |
364 its bytes. G2 is encoded using an 8E byte followed by the character's | |
365 bytes. G3 is encoded using an 8F byte followed by the character's bytes." | |
366 | |
428 | 367 )) |
368 | |
771 | 369 ;; FSF: |
428 | 370 ;; (define-coding-system-alias 'euc-japan-1990 'japanese-iso-8bit) |
371 ;; (define-coding-system-alias 'euc-japan 'japanese-iso-8bit) | |
372 ;; (define-coding-system-alias 'euc-jp 'japanese-iso-8bit) | |
373 | |
374 (define-coding-system-alias 'euc-japan 'euc-jp) ; only for w3 | |
375 (define-coding-system-alias 'japanese-euc 'euc-jp) | |
376 | |
377 (set-language-info-alist | |
378 "Japanese" '((setup-function . setup-japanese-environment-internal) | |
379 (exit-function . exit-japanese-environment) | |
380 (tutorial . "TUTORIAL.ja") | |
381 (charset japanese-jisx0208 japanese-jisx0208-1978 | |
382 japanese-jisx0212 latin-jisx0201 katakana-jisx0201) | |
383 (coding-system iso-2022-jp euc-jp | |
771 | 384 shift-jis iso-2022-jp-2) |
428 | 385 (coding-priority iso-2022-jp euc-jp |
771 | 386 shift-jis iso-2022-jp-2) |
387 ;; These locale names come from the X11R6 locale.alias file. | |
388 ;; What an incredible fucking mess!!!!!!!!!!!!!!!!!!!!!!!!!! | |
389 ;; What's worse is that typical Unix implementations of | |
390 ;; setlocale() return back exactly what you passed them, even | |
391 ;; though it's perfectly allowed (and in fact done under | |
392 ;; Windows) to expand the locale to its full form (including | |
393 ;; encoding), so you have some hint as to the encoding!!! | |
394 ;; | |
395 ;; We order them in such a way that we're maximally likely | |
396 ;; to get an encoding name. | |
397 ;; | |
398 (locale | |
399 ;; SunOS 5.7: ja ja_JP.PCK ja_JP.UTF-8 japanese | |
400 ;; RedHat Linux 6.2J: ja ja_JP ja_JP.eucJP ja_JP.ujis \ | |
401 ;; japanese japanese.euc | |
402 ;; HP-UX 10.20: ja_JP.SJIS ja_JP.eucJPput ja_JP.kana8 | |
403 ;; Cygwin b20.1: ja_JP.EUC | |
404 ;; FreeBSD 2.2.8: ja_JP.EUC ja_JP.SJIS | |
405 | |
406 ;; EUC locales | |
407 "ja_JP.EUC" | |
408 "ja_JP.eucJP" | |
409 "ja_JP.AJEC" | |
410 "ja_JP.ujis" | |
411 "Japanese-EUC" | |
412 "japanese.euc" | |
413 | |
414 ;; Shift-JIS locales | |
415 "ja_JP.SJIS" | |
416 "ja_JP.mscode" | |
417 "ja.SJIS" | |
418 | |
419 ;; 7-bit locales | |
420 "ja_JP.ISO-2022-JP" | |
421 "ja_JP.jis7" | |
422 "ja_JP.pjis" | |
423 "ja_JP.JIS" | |
424 "ja.JIS" | |
425 | |
426 ;; 8-bit locales | |
427 "ja_JP.jis8" | |
428 | |
429 ;; encoding-unspecified locales | |
430 "ja_JP" | |
431 "Ja_JP" | |
432 "Jp_JP" | |
433 "japanese" | |
434 "japan" | |
435 "ja" | |
436 ) | |
428 | 437 ;; (input-method . "japanese") |
438 (features japan-util) | |
450 | 439 (sample-text . "Japanese ($BF|K\8l(B) $B$3$s$K$A$O(B, (I:]FAJ(B") |
428 | 440 (documentation . t))) |
441 | |
4145 | 442 ;; Set the native-coding-system separately so the lambdas get compiled. (Not |
443 ;; a huge speed improvement, but this code is called at startup, and every | |
444 ;; little helps there.) | |
445 (set-language-info "Japanese" | |
446 'native-coding-system | |
447 (list | |
448 ;; first, see if an explicit encoding was given. | |
449 (lambda (locale) | |
450 (let ((case-fold-search t)) | |
451 (cond | |
452 ;; many unix versions | |
453 ((string-match "\\.euc" locale) 'euc-jp) | |
454 ((string-match "\\.sjis" locale) 'shift-jis) | |
455 | |
456 ;; X11R6 (CJKV p. 471) | |
457 ((string-match "\\.jis7" locale) 'jis7) | |
458 ((string-match "\\.jis8" locale) 'jis8) | |
459 ((string-match "\\.mscode" locale) 'shift-jis) | |
460 ((string-match "\\.pjis" locale) 'iso-2022-jp) | |
461 ((string-match "\\.ujis" locale) 'euc-jp) | |
462 | |
463 ;; other names in X11R6 locale.alias | |
464 ((string-match "\\.ajec" locale) 'euc-jp) | |
465 ((string-match "-euc" locale) 'euc-jp) | |
466 ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp) | |
467 ((string-match "\\.jis" locale) 'jis7) ;; or just jis? | |
468 ))) | |
469 | |
470 ;; aix (CJKV p. 465) | |
471 (lambda (locale) | |
472 (when (eq system-type 'aix) | |
473 (cond | |
474 ((string-match "^Ja_JP" locale) 'shift-jis) | |
475 ((string-match "^ja_JP" locale) 'euc-jp)))) | |
476 | |
477 ;; other X11R6 locale.alias | |
478 (lambda (locale) | |
479 (cond | |
480 ((string-match "^Jp_JP" locale) 'euc-jp) | |
481 ((and (eq system-type 'hpux) (eq locale "japanese")) | |
482 'shift-jis))) | |
483 | |
484 ;; fallback | |
485 'euc-jp)) | |
486 | |
428 | 487 ;;; japanese.el ends here |