annotate lisp/language/japanese.el @ 172:a38aed19690b

Added tag r20-3b12 for changeset 929b76928fce
author cvs
date Mon, 13 Aug 2007 09:47:55 +0200
parents 3bb7ccffb0c0
children acd284d43ca1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
159
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
1 ;;; japanese.el --- Japanese support
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
2
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
6
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
7 ;; Keywords: multilingual, Japanese
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
8
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
10
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
14 ;; any later version.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
15
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
19 ;; General Public License for more details.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
20
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
25
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
26 ;;; Commentary:
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
27
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
28 ;; For Japanese, character sets JISX0201, JISX0208, JISX0212 are
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
29 ;; supported.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
30
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
31 ;;; Code:
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
32
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
33 ;;; Syntax of Japanese characters.
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
34 (modify-syntax-entry 'katakana-jisx0201 "w")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
35 (modify-syntax-entry 'japanese-jisx0212 "w")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
36
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
37 (modify-syntax-entry 'japanese-jisx0208 "w")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
38 (loop for row in '(33 34 40)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
39 do (modify-syntax-entry `[japanese-jisx0208 ,row] "_"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
40 (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)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
41 do (modify-syntax-entry char "w"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
42 (modify-syntax-entry ?\$B!J(B "($B!K(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
43 (modify-syntax-entry ?\$B!N(B "($B!O(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
44 (modify-syntax-entry ?\$B!P(B "($B!Q(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
45 (modify-syntax-entry ?\$B!V(B "($B!W(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
46 (modify-syntax-entry ?\$B!X(B "($B!Y(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
47 (modify-syntax-entry ?\$B!K(B ")$B!J(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
48 (modify-syntax-entry ?\$B!O(B ")$B!N(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
49 (modify-syntax-entry ?\$B!Q(B ")$B!P(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
50 (modify-syntax-entry ?\$B!W(B ")$B!V(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
51 (modify-syntax-entry ?\$B!Y(B ")$B!X(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
52
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
53 ;;; Character categories S, A, H, K, G, Y, and C
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
54 (define-category ?S "Japanese 2-byte symbol character.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
55 (modify-category-entry [japanese-jisx0208 33] ?S)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
56 (modify-category-entry [japanese-jisx0208 34] ?S)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
57 (modify-category-entry [japanese-jisx0208 40] ?S)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
58 (define-category ?A "Japanese 2-byte Alphanumeric character.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
59 (modify-category-entry [japanese-jisx0208 35] ?A)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
60 (define-category ?H "Japanese 2-byte Hiragana character.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
61 (modify-category-entry [japanese-jisx0208 36] ?H)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
62 (define-category ?K "Japanese 2-byte Katakana character.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
63 (modify-category-entry [japanese-jisx0208 37] ?K)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
64 (define-category ?G "Japanese 2-byte Greek character.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
65 (modify-category-entry [japanese-jisx0208 38] ?G)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
66 (define-category ?Y "Japanese 2-byte Cyrillic character.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
67 (modify-category-entry [japanese-jisx0208 39] ?Y)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
68 (define-category ?C "Japanese 2-byte Kanji characters.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
69 (loop for row from 48 to 126
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
70 do (modify-category-entry `[japanese-jisx0208 ,row] ?C))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
71 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
72 do (modify-category-entry char ?K)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
73 (modify-category-entry char ?H))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
74 (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)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
75 do (modify-category-entry char ?C))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
76 (modify-category-entry 'japanese-jisx0212 ?C)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
77
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
78 (defvar japanese-word-regexp
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
79 "\\cA+\\cH*\\|\\cK+\\cH*\\|\\cC+\\cH*\\|\\cH+\\|\\ck+\\|\\sw+"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
80 "Regular expression used to match a Japanese word.")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
81
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
82 (set-word-regexp japanese-word-regexp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
83 (setq forward-word-regexp "\\w\\>")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
84 (setq backward-word-regexp "\\<\\w")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
85
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
86 ;;; Paragraph setting
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
87 (setq sentence-end
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
88 (concat
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
89 "\\("
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
90 "\\("
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
91 "[.?!][]\"')}]*"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
92 "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
93 "[$B!%!)!*(B][$B!O!I!G!K!Q!M!S!U!W!Y(B]*"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
94 "\\)"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
95 "\\($\\|\t\\| \\)"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
96 "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
97 "$B!#(B"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
98 "\\)"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
99 "[ \t\n]*"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
100 (setq paragraph-start "^[ $B!!(B\t\n\f]")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
101 (setq paragraph-separate "^[ $B!!(B\t\f]*$")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
102
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
103 ;; EGG specific setup
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
104 (define-egg-environment 'japanese
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
105 "Japanese settings for egg."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
106 (lambda ()
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
107 (when (not (featurep 'egg-jpn))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
108 (load "its/its-hira")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
109 (load "its/its-kata")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
110 (load "its/its-hankaku")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
111 (load "its/its-zenkaku")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
112 (setq its:*standard-modes*
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
113 (append
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
114 (list (its:get-mode-map "roma-kana")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
115 (its:get-mode-map "roma-kata")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
116 (its:get-mode-map "downcase")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
117 (its:get-mode-map "upcase")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
118 (its:get-mode-map "zenkaku-downcase")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
119 (its:get-mode-map "zenkaku-upcase"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
120 its:*standard-modes*))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
121 (provide 'egg-jpn))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
122 (setq wnn-server-type 'jserver)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
123 (setq egg-default-startup-file "eggrc-wnn")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
124 (setq-default its:*current-map* (its:get-mode-map "roma-kana"))))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
125
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
126 ;; stuff for providing gramatic processing of Japanese text
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
127 ;; something like this should probably be created for all environments...
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
128
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
129 (defvar aletter (concat "\\(" ascii-char "\\|" kanji-char "\\)"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
130 (defvar kanji-space-insertable (concat
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
131 "$B!"(B" aletter "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
132 "$B!#(B" aletter "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
133 aletter "$B!J(B" "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
134 "$B!K(B" aletter "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
135 ascii-alphanumeric kanji-kanji-char "\\|"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
136 kanji-kanji-char ascii-alphanumeric ))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
137
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
138 (defvar space-insertable (concat " " aletter "\\|" kanji-space-insertable)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
139 "Regexp for finding points that can have spaces inserted into them for justification")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
140
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
141 ;; (define-coding-system-alias 'iso-2022-7 'iso-2022-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
142 ;; (define-coding-system-alias 'iso-2022-7 'junet)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
143
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
144 (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
145 'iso-2022-jp 'iso2022
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
146 "Coding-system used for communication with mail and news in Japan."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
147 '(charset-g0 ascii
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
148 short t
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
149 seven t
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
150 input-charset-conversion ((latin-jisx0201 ascii)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
151 (japanese-jisx0208-1978 japanese-jisx0208))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
152 mnemonic "MULE/7bit"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
153 ))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
154
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
155 (copy-coding-system 'iso-2022-jp 'junet)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
156
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
157 ;; (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
158 ;; 'shift_jis 1 ?S
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
159 ;; "Coding-system of Shift-JIS used in Japan." t)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
160
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
161 (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
162 'shift_jis 'shift-jis
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
163 "Coding-system of Shift-JIS used in Japan."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
164 '(mnemonic "Ja/SJIS"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
165
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
166 ;;(define-coding-system-alias 'shift_jis 'sjis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
167
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
168 (copy-coding-system 'shift_jis 'sjis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
169
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
170 ;; (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
171 ;; 'iso-2022-jp-1978-irv 2 ?J
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
172 ;; "Coding-system used for old jis terminal."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
173 ;; '((ascii t) nil nil nil
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
174 ;; short ascii-eol ascii-cntl seven nil nil use-roman use-oldjis))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
175
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
176 (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
177 'iso-2022-jp-1978-irv 'iso2022
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
178 "Coding-system used for old JIS terminal."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
179 '(charset-g0 ascii
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
180 short t
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
181 seven t
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
182 output-charset-conversion ((ascii latin-jisx0201)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
183 (japanese-jisx0208 japanese-jisx0208-1978))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
184 mnemonic "Ja-78/7bit"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
185 ))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
186
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
187 ;;(define-coding-system-alias 'iso-2022-jp-1978-irv 'old-jis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
188
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
189 (copy-coding-system 'iso-2022-jp-1978-irv 'old-jis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
190
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
191 ;; (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
192 ;; 'euc-japan-1990 2 ?E
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
193 ;; "Coding-system of Japanese EUC (Extended Unix Code)."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
194 ;; '(ascii japanese-jisx0208 katakana-jisx0201 japanese-jisx0212
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
195 ;; short ascii-eol ascii-cntl nil nil single-shift))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
196
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
197 (make-coding-system
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
198 'euc-jp 'iso2022
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
199 "Coding-system of Japanese EUC (Extended Unix Code)."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
200 '(charset-g0 ascii
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
201 charset-g1 japanese-jisx0208
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
202 charset-g2 katakana-jisx0201
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
203 charset-g3 japanese-jisx0212
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
204 short t
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
205 mnemonic "Ja/EUC"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
206 ))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
207
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
208 ;;(define-coding-system-alias 'euc-japan-1990 'euc-japan)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
209
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
210 (copy-coding-system 'euc-jp 'euc-japan) ; only for w3
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
211 (copy-coding-system 'euc-jp 'japanese-euc)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
212
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
213 (register-input-method
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
214 "Japanese" '("quail-ja-hiragana" quail-use-package "quail/japanese"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
215 (register-input-method
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
216 "Japanese" '("quail-ja" quail-use-package "quail/japanese"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
217
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
218 (defun setup-japanese-environment ()
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
219 "Setup multilingual environment (MULE) for Japanese."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
220 (interactive)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
221 (setq coding-category-iso-8-2 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
222
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
223 (set-coding-priority
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
224 '(coding-category-iso-7
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
225 coding-category-iso-8-2
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
226 coding-category-sjis
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
227 coding-category-iso-8-1
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
228 coding-category-iso-else
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
229 coding-category-internal))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
230
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
231 (if (eq system-type 'ms-dos)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
232 (progn
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
233 (setq-default buffer-file-coding-system 'shift_jis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
234 (set-terminal-coding-system 'shift_jis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
235 (set-keyboard-coding-system 'shift_jis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
236 (setq default-process-coding-system '(shift_jis-dos . shift_jis-dos)))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
237 (setq-default buffer-file-coding-system 'iso-2022-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
238 (set-terminal-coding-system 'iso-2022-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
239 (set-keyboard-coding-system 'iso-2022-jp))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
240
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
241 (set-default-input-method "Japanese" "quail-ja")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
242
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
243 (setq sendmail-coding-system 'iso-2022-jp
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
244 rmail-file-coding-system 'iso-2022-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
245 )
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
246
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
247 (defun describe-japanese-support ()
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
248 "Describe how Emacs supports Japanese."
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
249 (interactive)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
250 (describe-language-support-internal "Japanese"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
251
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
252 (set-language-info-alist
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
253 "Japanese" '((setup-function . setup-japanese-environment)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
254 (describe-function . describe-japanese-support)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
255 (tutorial . "TUTORIAL.jp")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
256 (charset . (japanese-jisx0208 japanese-jisx0208-1978
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
257 japanese-jisx0212 latin-jisx0201
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
258 katakana-jisx0201))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
259 (coding-system . (euc-jp shift_jis
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
260 iso-2022-jp iso-2022-jp-1978-irv))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
261 (sample-text . "Japanese ($BF|K\8l(B) $B$3$s$K$A$O(B, (I:]FAJ(B")
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
262 (documentation . nil)))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
263
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
264 ;; for XEmacs (will be obsoleted)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
265
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
266 (define-language-environment 'japanese
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
267 "Japanese (includes JIS and EUC)"
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
268 (lambda ()
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
269 (set-coding-category-system 'iso-7 'iso-2022-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
270 (set-coding-category-system 'iso-8-2 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
271 (set-coding-priority-list '(iso-7 iso-8-2 shift-jis no-conversion))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
272 ;;'(iso-8-2 iso-8-designate iso-8-1 shift-jis big5)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
273
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
274 ;; Added by mrb, who doesn't speak japanese - so be sceptical...
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
275 ;; (when (string-match "solaris\\|sunos" system-configuration)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
276 ;;(set-native-coding-system 'euc-japan) ; someday
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
277 (set-pathname-coding-system 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
278 (add-hook 'comint-exec-hook
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
279 (lambda ()
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
280 (let ((proc (get-buffer-process (current-buffer))))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
281 (set-process-input-coding-system proc 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
282 (set-process-output-coding-system proc 'euc-jp))))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
283 ;;(set-buffer-file-coding-system-for-read 'automatic-conversion)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
284 (set-default-buffer-file-coding-system 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
285 (setq keyboard-coding-system 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
286 (setq terminal-coding-system 'euc-jp)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
287 (when (eq 'x (device-type (selected-device)))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
288 (x-use-halfwidth-roman-font 'japanese-jisx0208 "jisx0201"))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
289
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
290 (when (eq system-type 'ms-dos)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
291 ;; Shift-JIS is the standard coding system under Japanese MS-DOS
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
292 ;; This isn't really code - just a hint to future implementors
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
293 (setq keyboard-coding-system 'shift_jis-dos)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
294 (setq terminal-coding-system 'shift_jis-dos)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
295 (set-default-buffer-file-coding-system 'shift_jis-dos)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
296 ;;(set-default-process-coding-system 'shift_jis-dos 'shift_jis-dos)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
297 )
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
298 ))
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
299
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
300 (set-coding-category-system 'shift-jis 'shift_jis)
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
301
3bb7ccffb0c0 Import from CVS: tag r20-3b6
cvs
parents:
diff changeset
302 ;;; japanese.el ends here