Mercurial > hg > xemacs-beta
comparison lisp/mule/japanese-hooks.el @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | |
children | 54cc21c15cbb |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
1 ;;; japanese-hooks.el --- pre-loaded support for Japanese. | |
2 | |
3 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1995 Amdahl Corporation. | |
5 ;; Copyright (C) 1995 Sun Microsystems. | |
6 | |
7 ;; This file is part of XEmacs. | |
8 | |
9 ;; XEmacs is free software; you can redistribute it and/or modify it | |
10 ;; under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; XEmacs is distributed in the hope that it will be useful, but | |
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 ;; General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with XEmacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;; Synched up with: Mule 2.3. | |
25 | |
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
27 ;;; JAPANESE | |
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
29 | |
30 ;;; Syntax of Japanese characters. | |
31 (modify-syntax-entry 'japanese-jisx0201-kana "w") | |
32 (modify-syntax-entry 'japanese-jisx0212 "w") | |
33 | |
34 (modify-syntax-entry 'japanese-jisx0208 "w") | |
35 (loop for row in '(33 34 40) | |
36 do (modify-syntax-entry `[japanese-jisx0208 ,row] "_")) | |
37 (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) | |
38 do (modify-syntax-entry char "w")) | |
39 (modify-syntax-entry ?\$B!J(B "($B!K(B") | |
40 (modify-syntax-entry ?\$B!N(B "($B!O(B") | |
41 (modify-syntax-entry ?\$B!P(B "($B!Q(B") | |
42 (modify-syntax-entry ?\$B!V(B "($B!W(B") | |
43 (modify-syntax-entry ?\$B!X(B "($B!Y(B") | |
44 (modify-syntax-entry ?\$B!K(B ")$B!J(B") | |
45 (modify-syntax-entry ?\$B!O(B ")$B!N(B") | |
46 (modify-syntax-entry ?\$B!Q(B ")$B!P(B") | |
47 (modify-syntax-entry ?\$B!W(B ")$B!V(B") | |
48 (modify-syntax-entry ?\$B!Y(B ")$B!X(B") | |
49 | |
50 | |
51 ;;; Character categories S, A, H, K, G, Y, and C | |
52 (define-category ?S "Japanese 2-byte symbol character.") | |
53 (modify-category-entry [japanese-jisx0208 33] ?S) | |
54 (modify-category-entry [japanese-jisx0208 34] ?S) | |
55 (modify-category-entry [japanese-jisx0208 40] ?S) | |
56 (define-category ?A "Japanese 2-byte Alphanumeric character.") | |
57 (modify-category-entry [japanese-jisx0208 35] ?A) | |
58 (define-category ?H "Japanese 2-byte Hiragana character.") | |
59 (modify-category-entry [japanese-jisx0208 36] ?H) | |
60 (define-category ?K "Japanese 2-byte Katakana character.") | |
61 (modify-category-entry [japanese-jisx0208 37] ?K) | |
62 (define-category ?G "Japanese 2-byte Greek character.") | |
63 (modify-category-entry [japanese-jisx0208 38] ?G) | |
64 (define-category ?Y "Japanese 2-byte Cyrillic character.") | |
65 (modify-category-entry [japanese-jisx0208 39] ?Y) | |
66 (define-category ?C "Japanese 2-byte Kanji characters.") | |
67 (loop for row from 48 to 126 do (modify-category-entry `[japanese-jisx0208 ,row] ?C)) | |
68 (loop for char in '(?$B!<(B ?$B!+(B ?$B!,(B) | |
69 do (modify-category-entry char ?K) | |
70 (modify-category-entry char ?H)) | |
71 (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) | |
72 do (modify-category-entry char ?C)) | |
73 (modify-category-entry 'japanese-jisx0212 ?C) | |
74 | |
75 (defvar japanese-word-regexp | |
76 "\\cA+\\cH*\\|\\cK+\\cH*\\|\\cC+\\cH*\\|\\cH+\\|\\ck+\\|\\sw+" | |
77 "Regular expression used to match a Japanese word.") | |
78 | |
79 (set-word-regexp japanese-word-regexp) | |
80 (setq forward-word-regexp "\\w\\>") | |
81 (setq backward-word-regexp "\\<\\w") | |
82 | |
83 ;;; Paragraph setting | |
84 (setq sentence-end | |
85 (concat | |
86 "\\(" | |
87 "\\(" | |
88 "[.?!][]\"')}]*" | |
89 "\\|" | |
90 "[$B!%!)!*(B][$B!O!I!G!K!Q!M!S!U!W!Y(B]*" | |
91 "\\)" | |
92 "\\($\\|\t\\| \\)" | |
93 "\\|" | |
94 "$B!#(B" | |
95 "\\)" | |
96 "[ \t\n]*")) | |
97 (setq paragraph-start "^[ $B!!(B\t\n\f]") | |
98 (setq paragraph-separate "^[ $B!!(B\t\f]*$") | |
99 | |
100 ;; EGG specific setup | |
101 ;;(when (featurep 'egg) | |
102 ;; (setq wnn-server-type 'jserver) | |
103 ;; (load "its/hira") | |
104 ;; (load "its/kata") | |
105 ;; (load "its/hankaku") | |
106 ;; (load "its/zenkaku") | |
107 ;; (setq its:*standard-modes* | |
108 ;; (append | |
109 ;; (list (its:get-mode-map "roma-kana") | |
110 ;; (its:get-mode-map "roma-kata") | |
111 ;; (its:get-mode-map "downcase") | |
112 ;; (its:get-mode-map "upcase") | |
113 ;; (its:get-mode-map "zenkaku-downcase") | |
114 ;; (its:get-mode-map "zenkaku-upcase")) | |
115 ;; its:*standard-modes*))) | |
116 | |
117 (make-coding-system | |
118 'shift-jis 'shift-jis | |
119 "Coding-system of Shift-JIS used in Japan." | |
120 '(mnemonic "SJIS")) | |
121 | |
122 (copy-coding-system 'shift-jis 'sjis) | |
123 | |
124 (make-coding-system | |
125 'iso-2022-jp 'iso2022 | |
126 "Coding-system used for communication with mail and news in Japan." | |
127 '(charset-g0 ascii | |
128 short t | |
129 seven t | |
130 input-charset-conversion ((japanese-jisx0201-roman ascii) | |
131 (japanese-jisx0208-1978 japanese-jisx0208)) | |
132 mnemonic "Mail/Ja" | |
133 )) | |
134 | |
135 (copy-coding-system 'iso-2022-jp 'junet) | |
136 | |
137 (make-coding-system | |
138 'oldjis 'iso2022 | |
139 "Coding-system used for old JIS terminal." | |
140 '(charset-g0 ascii | |
141 short t | |
142 seven t | |
143 output-charset-conversion ((ascii japanese-jisx0201-roman) | |
144 (japanese-jisx0208 japanese-jisx0208-1978)) | |
145 mnemonic "Mail/Ja-old" | |
146 )) | |
147 | |
148 (make-coding-system | |
149 'euc-japan 'iso2022 | |
150 "Coding-system of Japanese EUC (Extended Unix Code)." | |
151 '(charset-g0 ascii | |
152 charset-g1 japanese-jisx0208 | |
153 charset-g2 japanese-jisx0201-kana | |
154 charset-g3 japanese-jisx0212 | |
155 short t | |
156 mnemonic "EUC/Ja" | |
157 )) | |
158 | |
159 (define-language-environment 'japanese | |
160 "Japanese (includes JIS and EUC)" | |
161 (lambda () | |
162 (set-coding-category-system 'iso-7 'iso-2022-jp) | |
163 (set-coding-category-system 'iso-8-2 'euc-japan) | |
164 (set-coding-priority-list '(iso-7 iso-8-2 no-conversion)) | |
165 ;;'(iso-8-2 iso-8-designate iso-8-1 shift-jis big5) | |
166 | |
167 ;;(when (featurep 'egg) | |
168 ;; (setq-default its:*current-map* (its:get-mode-map "roma-kana"))) | |
169 | |
170 ;; Added by mrb, who doesn't speak japanese - so be sceptical... | |
171 ;; (when (string-match "solaris\\|sunos" system-configuration) | |
172 ;;(set-native-coding-system 'euc-japan) ; someday | |
173 (set-pathname-coding-system 'euc-japan) | |
174 (add-hook 'comint-exec-hook | |
175 (lambda () | |
176 (let ((proc (get-buffer-process (current-buffer)))) | |
177 (set-process-input-coding-system proc 'euc-japan) | |
178 (set-process-output-coding-system proc 'euc-japan)))) | |
179 (set-file-coding-system-for-read 'autodetect) | |
180 (set-default-file-coding-system 'euc-japan) | |
181 (setq keyboard-coding-system 'euc-japan) | |
182 (setq terminal-coding-system 'euc-japan) | |
183 (set-charset-registry 'ascii "JISX0201") | |
184 | |
185 (when (eq system-type 'ms-dos) | |
186 ;; Shift-JIS is the standard coding system under Japanese MS-DOS | |
187 ;; This isn't really code - just a hint to future implementors | |
188 (setq keyboard-coding-system 'shift-jis-dos) | |
189 (setq terminal-coding-system 'shift-jis-dos) | |
190 (set-default-file-coding-system 'shift-jis-dos) | |
191 ;;(set-default-process-coding-system 'shift-jis-dos 'shift-jis-dos) | |
192 ) | |
193 )) | |
194 | |
195 (set-coding-category-system 'shift-jis 'shift-jis) |