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))
|
|
198 mnemonic "MULE/7bit"
|
771
|
199 documentation
|
|
200 "Coding system used for communication with mail and news in Japan."
|
|
201 ))
|
|
202
|
|
203 (make-coding-system
|
|
204 'jis7 'iso2022
|
|
205 "JIS7 (old Japanese 7-bit encoding)"
|
|
206 '(charset-g0 ascii
|
|
207 charset-g1 katakana-jisx0201
|
|
208 short t
|
|
209 seven t
|
|
210 lock-shift t
|
|
211 input-charset-conversion ((latin-jisx0201 ascii)
|
|
212 (japanese-jisx0208-1978 japanese-jisx0208))
|
|
213 mnemonic "JIS7"
|
|
214 documentation
|
|
215 "Old JIS 7-bit encoding; mostly superseded by ISO-2022-JP.
|
|
216 Uses locking-shift (SI/SO) to select half-width katakana."
|
|
217 ))
|
|
218
|
|
219 (make-coding-system
|
|
220 'jis8 'iso2022
|
|
221 "JIS8 (old Japanese 8-bit encoding)"
|
|
222 '(charset-g0 ascii
|
|
223 charset-g1 katakana-jisx0201
|
|
224 short t
|
|
225 input-charset-conversion ((latin-jisx0201 ascii)
|
|
226 (japanese-jisx0208-1978 japanese-jisx0208))
|
|
227 mnemonic "JIS8"
|
|
228 documentation
|
|
229 "Old JIS 8-bit encoding; mostly superseded by ISO-2022-JP.
|
|
230 Uses high bytes for half-width katakana."
|
428
|
231 ))
|
|
232
|
|
233 (define-coding-system-alias 'junet 'iso-2022-jp)
|
|
234
|
|
235 ;; (make-coding-system
|
|
236 ;; 'iso-2022-jp-2 2 ?J
|
|
237 ;; "ISO 2022 based 7bit encoding for CJK, Latin-1, and Greek (MIME:ISO-2022-JP-2)"
|
|
238 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
239 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201
|
|
240 ;; chinese-gb2312 korean-ksc5601) nil
|
|
241 ;; (nil latin-iso8859-1 greek-iso8859-7) nil
|
|
242 ;; short ascii-eol ascii-cntl seven nil single-shift)
|
|
243 ;; '((safe-charsets ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
244 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201
|
|
245 ;; chinese-gb2312 korean-ksc5601
|
|
246 ;; latin-iso8859-1 greek-iso8859-7)
|
|
247 ;; (mime-charset . iso-2022-jp-2)))
|
|
248
|
|
249 ;; (make-coding-system
|
|
250 ;; 'japanese-shift-jis 1 ?S
|
|
251 ;; "Shift-JIS 8-bit encoding for Japanese (MIME:SHIFT_JIS)"
|
|
252 ;; nil
|
|
253 ;; '((safe-charsets ascii japanese-jisx0208 japanese-jisx0208-1978
|
|
254 ;; latin-jisx0201 katakana-jisx0201)
|
771
|
255 ;; (mime-charset . shift-jis)
|
428
|
256 ;; (charset-origin-alist (japanese-jisx0208 "SJIS" encode-sjis-char)
|
|
257 ;; (katakana-jisx0201 "SJIS" encode-sjis-char))))
|
|
258
|
|
259 (make-coding-system
|
771
|
260 'shift-jis 'shift-jis
|
|
261 "Shift-JIS"
|
|
262 '(mnemonic "Ja/SJIS"
|
|
263 documentation "The standard Japanese encoding in MS Windows."
|
|
264 ))
|
428
|
265
|
771
|
266 ;; A former name?
|
|
267 (define-coding-system-alias 'shift_jis 'shift-jis)
|
|
268
|
|
269 ;; FSF:
|
|
270 ;; (define-coding-system-alias 'shift-jis 'japanese-shift-jis)
|
428
|
271 ;; (define-coding-system-alias 'sjis 'japanese-shift-jis)
|
|
272
|
|
273 ;; (make-coding-system
|
|
274 ;; 'japanese-iso-7bit-1978-irv 2 ?j
|
|
275 ;; "ISO 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman"
|
|
276 ;; '((ascii japanese-jisx0208-1978 japanese-jisx0208
|
|
277 ;; latin-jisx0201 japanese-jisx0212 katakana-jisx0201 t) nil nil nil
|
|
278 ;; short ascii-eol ascii-cntl seven nil nil use-roman use-oldjis)
|
|
279 ;; '(ascii japanese-jisx0208-1978 japanese-jisx0208 latin-jisx0201))
|
|
280
|
|
281 (make-coding-system
|
|
282 'iso-2022-jp-1978-irv 'iso2022
|
771
|
283 "ISO-2022-JP-1978-IRV (Old JIS)"
|
428
|
284 '(charset-g0 ascii
|
|
285 short t
|
|
286 seven t
|
|
287 output-charset-conversion ((ascii latin-jisx0201)
|
|
288 (japanese-jisx0208 japanese-jisx0208-1978))
|
771
|
289 documentation
|
|
290 "This is a coding system used for old JIS terminals. It's an ISO
|
|
291 2022 based 7-bit encoding for Japanese JISX0208-1978 and JISX0201-Roman."
|
428
|
292 mnemonic "Ja-78/7bit"
|
|
293 ))
|
|
294
|
771
|
295 ;; FSF:
|
428
|
296 ;; (define-coding-system-alias 'iso-2022-jp-1978-irv 'japanese-iso-7bit-1978-irv)
|
|
297 ;; (define-coding-system-alias 'old-jis 'japanese-iso-7bit-1978-irv)
|
|
298
|
|
299 (define-coding-system-alias 'old-jis 'iso-2022-jp-1978-irv)
|
|
300
|
|
301 ;; (make-coding-system
|
|
302 ;; 'japanese-iso-8bit 2 ?E
|
|
303 ;; "ISO 2022 based EUC encoding for Japanese (MIME:EUC-JP)"
|
|
304 ;; '(ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212
|
|
305 ;; short ascii-eol ascii-cntl nil nil single-shift)
|
|
306 ;; '((safe-charsets ascii latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978
|
771
|
307 ;; katakana-jisx0201 japanese-jisx0212)
|
428
|
308 ;; (mime-charset . euc-jp)))
|
771
|
309 ;;
|
428
|
310 (make-coding-system
|
|
311 'euc-jp 'iso2022
|
771
|
312 "Japanese EUC"
|
428
|
313 '(charset-g0 ascii
|
|
314 charset-g1 japanese-jisx0208
|
|
315 charset-g2 katakana-jisx0201
|
|
316 charset-g3 japanese-jisx0212
|
|
317 short t
|
|
318 mnemonic "Ja/EUC"
|
771
|
319 documentation
|
|
320 "Japanese EUC (Extended Unix Code), the standard Japanese encoding in Unix.
|
|
321 Equivalent MIME encoding: EUC-JP.
|
|
322
|
|
323 Japanese EUC was the forefather of all the different EUC's, which all follow
|
|
324 a similar structure:
|
|
325
|
|
326 1. Up to four character sets can be encoded.
|
|
327
|
|
328 2. This is a non-modal encoding, i.e. it is impossible to set a global state
|
|
329 that affects anything more than the directly following character. [Modal
|
|
330 encodings typically have escape sequences to change global settings, which
|
|
331 affect all the following characters until the setting is turned off.
|
|
332 Modal encodings are typically used when it's necessary to support text in
|
|
333 a wide variety of character sets and still keep basic ASCII compatibility,
|
|
334 or in cases (e.g. sending email) where the allowed characters that can
|
|
335 pass the gateway are small and (typically) no high-bit range is available.
|
|
336
|
|
337 3. The first character set is always ASCII or some national variant of it,
|
|
338 and encoded in the standard ASCII position. All characters in all other
|
|
339 character sets are encoded entirely using high-half bytes. Therefore,
|
|
340 it is safe to scan for ASCII characters, such as '/' to separate path
|
|
341 components, in the obvious way.
|
|
342
|
|
343 4. Each of the other three character sets can be of dimension 1, 2, or 3.
|
|
344 A dimension-1 character set contains 96 bytes; a dimension-2 character
|
|
345 set contains 96 x 96 bytes; and a dimension-3 character set contains
|
|
346 96 x 96 x 96 bytes. 94 instead of 96 as the number of characters per
|
|
347 dimension is also supported. Character sets of dimensions 1, 2, and 3
|
|
348 use 1-3 bytes, respectively, to encode a character, and each byte is
|
|
349 in the range A0-FF (or A1-FE for those with 94 bytes per dimension).
|
|
350
|
|
351 5. The four character sets encoded in EUC are called G0, G1, G2, and G3.
|
|
352 As mentioned earlier, G0 is ASCII or some variant, and encoded into
|
|
353 the ASCII positions 00 - 7F. G1 is encoded directly by laying out
|
|
354 its bytes. G2 is encoded using an 8E byte followed by the character's
|
|
355 bytes. G3 is encoded using an 8F byte followed by the character's bytes."
|
|
356
|
428
|
357 ))
|
|
358
|
771
|
359 ;; FSF:
|
428
|
360 ;; (define-coding-system-alias 'euc-japan-1990 'japanese-iso-8bit)
|
|
361 ;; (define-coding-system-alias 'euc-japan 'japanese-iso-8bit)
|
|
362 ;; (define-coding-system-alias 'euc-jp 'japanese-iso-8bit)
|
|
363
|
|
364 (define-coding-system-alias 'euc-japan 'euc-jp) ; only for w3
|
|
365 (define-coding-system-alias 'japanese-euc 'euc-jp)
|
|
366
|
|
367 (set-language-info-alist
|
|
368 "Japanese" '((setup-function . setup-japanese-environment-internal)
|
|
369 (exit-function . exit-japanese-environment)
|
|
370 (tutorial . "TUTORIAL.ja")
|
|
371 (charset japanese-jisx0208 japanese-jisx0208-1978
|
|
372 japanese-jisx0212 latin-jisx0201 katakana-jisx0201)
|
|
373 (coding-system iso-2022-jp euc-jp
|
771
|
374 shift-jis iso-2022-jp-2)
|
428
|
375 (coding-priority iso-2022-jp euc-jp
|
771
|
376 shift-jis iso-2022-jp-2)
|
|
377 ;; These locale names come from the X11R6 locale.alias file.
|
|
378 ;; What an incredible fucking mess!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
379 ;; What's worse is that typical Unix implementations of
|
|
380 ;; setlocale() return back exactly what you passed them, even
|
|
381 ;; though it's perfectly allowed (and in fact done under
|
|
382 ;; Windows) to expand the locale to its full form (including
|
|
383 ;; encoding), so you have some hint as to the encoding!!!
|
|
384 ;;
|
|
385 ;; We order them in such a way that we're maximally likely
|
|
386 ;; to get an encoding name.
|
|
387 ;;
|
|
388 (locale
|
|
389 ;; SunOS 5.7: ja ja_JP.PCK ja_JP.UTF-8 japanese
|
|
390 ;; RedHat Linux 6.2J: ja ja_JP ja_JP.eucJP ja_JP.ujis \
|
|
391 ;; japanese japanese.euc
|
|
392 ;; HP-UX 10.20: ja_JP.SJIS ja_JP.eucJPput ja_JP.kana8
|
|
393 ;; Cygwin b20.1: ja_JP.EUC
|
|
394 ;; FreeBSD 2.2.8: ja_JP.EUC ja_JP.SJIS
|
|
395
|
|
396 ;; EUC locales
|
|
397 "ja_JP.EUC"
|
|
398 "ja_JP.eucJP"
|
|
399 "ja_JP.AJEC"
|
|
400 "ja_JP.ujis"
|
|
401 "Japanese-EUC"
|
|
402 "japanese.euc"
|
|
403
|
|
404 ;; Shift-JIS locales
|
|
405 "ja_JP.SJIS"
|
|
406 "ja_JP.mscode"
|
|
407 "ja.SJIS"
|
|
408
|
|
409 ;; 7-bit locales
|
|
410 "ja_JP.ISO-2022-JP"
|
|
411 "ja_JP.jis7"
|
|
412 "ja_JP.pjis"
|
|
413 "ja_JP.JIS"
|
|
414 "ja.JIS"
|
|
415
|
|
416 ;; 8-bit locales
|
|
417 "ja_JP.jis8"
|
|
418
|
|
419 ;; encoding-unspecified locales
|
|
420 "ja_JP"
|
|
421 "Ja_JP"
|
|
422 "Jp_JP"
|
|
423 "japanese"
|
|
424 "japan"
|
|
425 "ja"
|
|
426 )
|
428
|
427 ;; (input-method . "japanese")
|
|
428 (features japan-util)
|
450
|
429 (sample-text . "Japanese ($BF|K\8l(B) $B$3$s$K$A$O(B, (I:]FAJ(B")
|
428
|
430 (documentation . t)))
|
|
431
|
4145
|
432 ;; Set the native-coding-system separately so the lambdas get compiled. (Not
|
|
433 ;; a huge speed improvement, but this code is called at startup, and every
|
|
434 ;; little helps there.)
|
|
435 (set-language-info "Japanese"
|
|
436 'native-coding-system
|
|
437 (list
|
|
438 ;; first, see if an explicit encoding was given.
|
|
439 (lambda (locale)
|
|
440 (let ((case-fold-search t))
|
|
441 (cond
|
|
442 ;; many unix versions
|
|
443 ((string-match "\\.euc" locale) 'euc-jp)
|
|
444 ((string-match "\\.sjis" locale) 'shift-jis)
|
|
445
|
|
446 ;; X11R6 (CJKV p. 471)
|
|
447 ((string-match "\\.jis7" locale) 'jis7)
|
|
448 ((string-match "\\.jis8" locale) 'jis8)
|
|
449 ((string-match "\\.mscode" locale) 'shift-jis)
|
|
450 ((string-match "\\.pjis" locale) 'iso-2022-jp)
|
|
451 ((string-match "\\.ujis" locale) 'euc-jp)
|
|
452
|
|
453 ;; other names in X11R6 locale.alias
|
|
454 ((string-match "\\.ajec" locale) 'euc-jp)
|
|
455 ((string-match "-euc" locale) 'euc-jp)
|
|
456 ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp)
|
|
457 ((string-match "\\.jis" locale) 'jis7) ;; or just jis?
|
|
458 )))
|
|
459
|
|
460 ;; aix (CJKV p. 465)
|
|
461 (lambda (locale)
|
|
462 (when (eq system-type 'aix)
|
|
463 (cond
|
|
464 ((string-match "^Ja_JP" locale) 'shift-jis)
|
|
465 ((string-match "^ja_JP" locale) 'euc-jp))))
|
|
466
|
|
467 ;; other X11R6 locale.alias
|
|
468 (lambda (locale)
|
|
469 (cond
|
|
470 ((string-match "^Jp_JP" locale) 'euc-jp)
|
|
471 ((and (eq system-type 'hpux) (eq locale "japanese"))
|
|
472 'shift-jis)))
|
|
473
|
|
474 ;; fallback
|
|
475 'euc-jp))
|
|
476
|
428
|
477 ;;; japanese.el ends here
|