Mercurial > emacs
annotate lisp/language/chinese.el @ 17963:b77c13e71ba3
(XTread_socket) <UnmapNotify>: Don't make an inconify_event
when frame was made invisible.
(x_make_frame_visible): Put the call to x_set_offset back as it was.
Near the end, instead call XMoveWindow, but only if original
positions were not negative.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 27 May 1997 03:09:37 +0000 |
parents | 084d922fcd78 |
children | 73869115ae0a |
rev | line source |
---|---|
17052 | 1 ;;; chinese.el --- Support for Chinese |
2 | |
3 ;; Copyright (C) 1995 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
5 | |
6 ;; Keywords: multilingual, Chinese | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
17071 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
17052 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are | |
28 ;; supported. | |
29 | |
30 ;;; Code: | |
31 | |
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
33 ;;; Chinese (general) | |
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
35 | |
36 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
37 'iso-2022-cn 2 ?C |
17052 | 38 "Coding system ISO-2022-CN for Chinese (GB and CNS character sets)." |
39 '(ascii | |
40 (nil chinese-gb2312 chinese-cns11643-1) | |
41 (nil chinese-cns11643-2) | |
42 (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 | |
43 chinese-cns11643-6 chinese-cns11643-7) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
44 nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
45 init-bol)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
46 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
47 (define-coding-system-alias 'iso-2022-cn 'iso-2022-cn-ext) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
48 |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
49 (set-language-info-alist |
17841
084d922fcd78
Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents:
17765
diff
changeset
|
50 "Chinese" '((documentation . "\ |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
51 Emacs provides the following three kinds of Chinese support: |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
52 Chinese-GB: for users of the charset GB2312 |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
53 Chinese-BIG5: for users of the charset Big5 |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
54 Chinese-CNS: for users of the charset CNS11643 family |
17841
084d922fcd78
Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents:
17765
diff
changeset
|
55 Please specify/select one of them to get more information.") |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
56 )) |
17052 | 57 |
58 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
59 ;;; Chinese GB2312 (simplified) | |
60 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
61 | |
62 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
63 'cn-gb-2312 2 ?C |
17052 | 64 "Coding-system of Chinese EUC (so called GB Encoding)." |
65 '((ascii t) chinese-gb2312 chinese-sisheng nil | |
66 nil ascii-eol ascii-cntl nil nil single-shift nil)) | |
67 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
68 (define-coding-system-alias 'cn-gb-2312 'euc-china) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
69 |
17052 | 70 (make-coding-system |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
71 'hz-gb-2312 0 ?z |
17052 | 72 "Codins-system of Hz/ZW used for Chinese (GB)." |
73 nil) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
74 (put 'hz-gb-2312 'post-read-conversion 'post-read-decode-hz) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
75 (put 'hz-gb-2312 'pre-write-conversion 'pre-write-encode-hz) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
76 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
77 (define-coding-system-alias 'hz-gb-2312 'hz) |
17052 | 78 |
79 (defun post-read-decode-hz (len) | |
80 (let ((pos (point))) | |
81 (decode-hz-region pos (+ pos len)))) | |
82 | |
83 (defun pre-write-encode-hz (from to) | |
84 (let ((buf (current-buffer)) | |
85 (work (get-buffer-create " *pre-write-encoding-work*"))) | |
86 (set-buffer work) | |
87 (erase-buffer) | |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
88 (if (stringp from) |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
89 (insert from) |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
90 (insert-buffer-substring buf from to)) |
17052 | 91 (encode-hz-region 1 (point-max)) |
92 nil)) | |
93 | |
94 (register-input-method | |
95 "Chinese-GB" '("quail-ccdospy" quail-use-package "quail/ccdospy")) | |
96 (register-input-method | |
97 "Chinese-GB" '("quail-ctlau" quail-use-package "quail/ctlau")) | |
98 (register-input-method | |
99 "Chinese-GB" '("quail-punct" quail-use-package "quail/punct")) | |
100 (register-input-method | |
101 "Chinese-GB" '("quail-qj" quail-use-package "quail/qj")) | |
102 (register-input-method | |
103 "Chinese-GB" '("quail-sw" quail-use-package "quail/sw")) | |
104 (register-input-method | |
105 "Chinese-GB" '("quail-ziranma" quail-use-package "quail/ziranma")) | |
106 (register-input-method | |
107 "Chinese-GB" '("quail-tonepy" quail-use-package "quail/tonepy")) | |
108 (register-input-method | |
109 "Chinese-GB" '("quail-py" quail-use-package "quail/py")) | |
110 | |
111 (defun setup-chinese-gb-environment () | |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
112 "Setup multilingual environment (MULE) for Chinese GB2312 users." |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
113 (interactive) |
17052 | 114 (setq primary-language "Chinese-GB") |
115 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
116 (setq coding-category-iso-8-2 'cn-gb-2312) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
117 (setq coding-category-iso-else 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
118 (setq coding-category-big5 'cn-big5) |
17052 | 119 |
120 (set-coding-priority | |
121 '(coding-category-iso-7 | |
122 coding-category-iso-else | |
123 coding-category-iso-8-2 | |
124 coding-category-big5 | |
125 coding-category-iso-8-1 | |
17841
084d922fcd78
Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents:
17765
diff
changeset
|
126 coding-category-emacs-mule |
17052 | 127 )) |
128 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
129 (setq-default buffer-file-coding-system 'cn-gb-2312) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
130 (set-terminal-coding-system 'cn-gb-2312) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
131 (set-keyboard-coding-system 'cn-gb-2312) |
17052 | 132 |
133 (setq default-input-method '("Chinese-GB" . "quail-py")) | |
134 ) | |
135 | |
136 (set-language-info-alist | |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
137 "Chinese-GB" '((setup-function . setup-chinese-gb-environment) |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
138 (charset . (chinese-gb2312 chinese-sisheng)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
139 (coding-system . (cn-gb-2312 hz-gb-2312 iso-2022-cn)) |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
140 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B") |
17841
084d922fcd78
Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents:
17765
diff
changeset
|
141 (documentation . t))) |
17052 | 142 |
143 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
144 ;; Chinese BIG5 (traditional) | |
145 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
146 | |
147 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
148 'big5 3 ?B |
17052 | 149 "Coding-system of BIG5.") |
150 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
151 (define-coding-system-alias 'big5 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
152 |
17052 | 153 ;; Big5 font requires special encoding. |
154 (define-ccl-program ccl-encode-big5-font | |
155 `(0 | |
156 ;; In: R0:chinese-big5-1 or chinese-big5-2 | |
157 ;; R1:position code 1 | |
158 ;; R2:position code 2 | |
159 ;; Out: R1:font code point 1 | |
160 ;; R2:font code point 2 | |
161 ((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21)) | |
162 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280)) | |
163 (r1 = ((r2 / 157) + ?\xA1)) | |
164 (r2 %= 157) | |
165 (if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62)))) | |
166 "CCL program to encode a Big5 code to code point of Big5 font.") | |
167 | |
168 (setq font-ccl-encoder-alist | |
169 (cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist)) | |
170 | |
171 (register-input-method | |
172 "Chinese-BIG5" '("quail-qj-b5" quail-use-package "quail/qj-b5")) | |
173 (register-input-method | |
174 "Chinese-BIG5" '("quail-zozy" quail-use-package "quail/zozy")) | |
175 (register-input-method | |
176 "Chinese-BIG5" '("quail-tsangchi-b5" quail-use-package "quail/tsangchi-b5")) | |
177 (register-input-method | |
178 "Chinese-BIG5" '("quail-py-b5" quail-use-package "quail/py-b5")) | |
179 (register-input-method | |
180 "Chinese-BIG5" '("quail-quick-b5" quail-use-package "quail/quick-bt")) | |
181 (register-input-method | |
182 "Chinese-BIG5" '("quail-etzy" quail-use-package "quail/etzy")) | |
183 (register-input-method | |
184 "Chinese-BIG5" '("quail-ecdict" quail-use-package "quail/ecdict")) | |
185 (register-input-method | |
186 "Chinese-BIG5" '("quail-ctlaub" quail-use-package "quail/ctlaub")) | |
187 (register-input-method | |
188 "Chinese-BIG5" '("quail-array30" quail-use-package "quail/array30")) | |
189 (register-input-method | |
190 "Chinese-BIG5" '("quail-4corner" quail-use-package "quail/4corner")) | |
191 | |
192 (defun setup-chinese-big5-environment () | |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
193 "Setup multilingual environment (MULE) for Chinese Big5 users." |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
194 (interactive) |
17052 | 195 (setq primary-language "Chinese-BIG5") |
196 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
197 (setq coding-category-big5 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
198 (setq coding-category-iso-else 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
199 (setq coding-category-iso-8-2 'cn-gb-2312) |
17052 | 200 |
201 (set-coding-priority | |
202 '(coding-category-iso-7 | |
203 coding-category-iso-else | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
204 coding-category-big5 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
205 coding-category-iso-8-2)) |
17052 | 206 |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
207 (setq-default buffer-file-coding-system 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
208 (set-terminal-coding-system 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
209 (set-keyboard-coding-system 'cn-big5) |
17052 | 210 |
211 (setq default-input-method '("Chinese-BIG5" . "quail-py-b5")) | |
212 ) | |
213 | |
214 (set-language-info-alist | |
215 "Chinese-BIG5" '((setup-function . setup-chinese-big5-environment) | |
216 (charset . (chinese-big5-1 chinese-big5-2)) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
217 (coding-system . (cn-big5 iso-2022-cn)) |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
218 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B") |
17841
084d922fcd78
Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents:
17765
diff
changeset
|
219 (documentation . t))) |
17052 | 220 |
221 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
222 ;; Chinese CNS11643 (traditional) | |
223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
224 | |
225 (register-input-method | |
226 "Chinese-CNS" '("quail-quick-cns" quail-use-package "quail/quick-cns")) | |
227 (register-input-method | |
228 "Chinese-CNS" '("quail-tsangchi-cns" quail-use-package "quail/tsangchi-cns")) | |
229 | |
230 (defun setup-chinese-cns-environment () | |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
231 "Setup multilingual environment (MULE) for Chinese CNS11643 family users." |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
232 (interactive) |
17052 | 233 (setq primary-language "Chinese-CNS") |
234 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
235 (setq coding-category-iso-else 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
236 (setq coding-category-big5 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
237 (setq coding-category-iso-8-2 'cn-gb-2312) |
17052 | 238 |
239 (set-coding-priority | |
240 '(coding-category-iso-7 | |
241 coding-category-iso-else | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
242 coding-category-iso-8-2 |
17052 | 243 coding-category-big5)) |
244 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
245 (setq-default buffer-file-coding-system 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
246 (set-terminal-coding-system 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
247 (set-keyboard-coding-system 'iso-2022-cn) |
17052 | 248 |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
249 (setq default-input-method '("Chinese-CNS" . "quail-quick-cns")) |
17052 | 250 ) |
251 | |
252 (set-language-info-alist | |
253 "Chinese-CNS" '((setup-function . setup-chinese-cns-environment) | |
254 (charset . (chinese-cns11643-1 chinese-cns11643-2 | |
255 chinese-cns11643-3 chinese-cns11643-4 | |
256 chinese-cns11643-5 chinese-cns11643-6 | |
257 chinese-cns11643-7)) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
258 (coding-system . (iso-2022-cn)) |
17841
084d922fcd78
Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents:
17765
diff
changeset
|
259 (documentation . t))) |
17052 | 260 |
261 ;;; chinese.el ends here |