annotate lisp/language/chinese.el @ 17959:7b3eb9189759

(Fdo_auto_save): Pass new arg to sit_for.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 May 1997 01:51:04 +0000
parents 084d922fcd78
children 73869115ae0a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1 ;;; chinese.el --- Support for Chinese
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6 ;; Keywords: multilingual, Chinese
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
23 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 ;; supported.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;;; Chinese (general)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 "Coding system ISO-2022-CN for Chinese (GB and CNS character sets)."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 '(ascii
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40 (nil chinese-gb2312 chinese-cns11643-1)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 (nil chinese-cns11643-2)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59 ;;; Chinese GB2312 (simplified)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
64 "Coding-system of Chinese EUC (so called GB Encoding)."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
65 '((ascii t) chinese-gb2312 chinese-sisheng nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
66 nil ascii-eol ascii-cntl nil nil single-shift nil))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
72 "Codins-system of Hz/ZW used for Chinese (GB)."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79 (defun post-read-decode-hz (len)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80 (let ((pos (point)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81 (decode-hz-region pos (+ pos len))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83 (defun pre-write-encode-hz (from to)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84 (let ((buf (current-buffer))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
85 (work (get-buffer-create " *pre-write-encoding-work*")))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
86 (set-buffer work)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
91 (encode-hz-region 1 (point-max))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
92 nil))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
93
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
94 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95 "Chinese-GB" '("quail-ccdospy" quail-use-package "quail/ccdospy"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
96 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
97 "Chinese-GB" '("quail-ctlau" quail-use-package "quail/ctlau"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
98 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
99 "Chinese-GB" '("quail-punct" quail-use-package "quail/punct"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
100 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
101 "Chinese-GB" '("quail-qj" quail-use-package "quail/qj"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
102 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103 "Chinese-GB" '("quail-sw" quail-use-package "quail/sw"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
104 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
105 "Chinese-GB" '("quail-ziranma" quail-use-package "quail/ziranma"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
106 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107 "Chinese-GB" '("quail-tonepy" quail-use-package "quail/tonepy"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
109 "Chinese-GB" '("quail-py" quail-use-package "quail/py"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 (setq primary-language "Chinese-GB")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
119
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 (set-coding-priority
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 '(coding-category-iso-7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 coding-category-iso-else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 coding-category-iso-8-2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
124 coding-category-big5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127 ))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 (setq default-input-method '("Chinese-GB" . "quail-py"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 )
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
144 ;; Chinese BIG5 (traditional)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
145 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
146
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 "Coding-system of BIG5.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153 ;; Big5 font requires special encoding.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 (define-ccl-program ccl-encode-big5-font
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155 `(0
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
156 ;; In: R0:chinese-big5-1 or chinese-big5-2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
157 ;; R1:position code 1
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158 ;; R2:position code 2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
159 ;; Out: R1:font code point 1
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160 ;; R2:font code point 2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161 ((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
163 (r1 = ((r2 / 157) + ?\xA1))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
164 (r2 %= 157)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
165 (if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166 "CCL program to encode a Big5 code to code point of Big5 font.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168 (setq font-ccl-encoder-alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 (cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
171 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172 "Chinese-BIG5" '("quail-qj-b5" quail-use-package "quail/qj-b5"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
173 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
174 "Chinese-BIG5" '("quail-zozy" quail-use-package "quail/zozy"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
175 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176 "Chinese-BIG5" '("quail-tsangchi-b5" quail-use-package "quail/tsangchi-b5"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 "Chinese-BIG5" '("quail-py-b5" quail-use-package "quail/py-b5"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180 "Chinese-BIG5" '("quail-quick-b5" quail-use-package "quail/quick-bt"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182 "Chinese-BIG5" '("quail-etzy" quail-use-package "quail/etzy"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 "Chinese-BIG5" '("quail-ecdict" quail-use-package "quail/ecdict"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186 "Chinese-BIG5" '("quail-ctlaub" quail-use-package "quail/ctlaub"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188 "Chinese-BIG5" '("quail-array30" quail-use-package "quail/array30"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190 "Chinese-BIG5" '("quail-4corner" quail-use-package "quail/4corner"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
191
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195 (setq primary-language "Chinese-BIG5")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 (set-coding-priority
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202 '(coding-category-iso-7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 (setq default-input-method '("Chinese-BIG5" . "quail-py-b5"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212 )
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 (set-language-info-alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 "Chinese-BIG5" '((setup-function . setup-chinese-big5-environment)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222 ;; Chinese CNS11643 (traditional)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226 "Chinese-CNS" '("quail-quick-cns" quail-use-package "quail/quick-cns"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 (register-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 "Chinese-CNS" '("quail-tsangchi-cns" quail-use-package "quail/tsangchi-cns"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233 (setq primary-language "Chinese-CNS")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
239 (set-coding-priority
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240 '(coding-category-iso-7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 coding-category-big5))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250 )
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
251
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
252 (set-language-info-alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
253 "Chinese-CNS" '((setup-function . setup-chinese-cns-environment)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
254 (charset . (chinese-cns11643-1 chinese-cns11643-2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255 chinese-cns11643-3 chinese-cns11643-4
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
256 chinese-cns11643-5 chinese-cns11643-6
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
260
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
261 ;;; chinese.el ends here