aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1998-01-22 01:45:51 +0000
committerKenichi Handa1998-01-22 01:45:51 +0000
commit8f3969f8ab93f4c7361097f5aeac9a8b9430ae77 (patch)
tree64b2ecacc6baf58ac34bc82064920d721d555228
parent5e92d2b80109ccad114ed62591b9f6d518a0e800 (diff)
downloademacs-8f3969f8ab93f4c7361097f5aeac9a8b9430ae77.tar.gz
emacs-8f3969f8ab93f4c7361097f5aeac9a8b9430ae77.zip
In setup-LANGUAGE-environment functions,
call set-language-environment-coding-systems.
-rw-r--r--lisp/language/china-util.el152
-rw-r--r--lisp/language/japan-util.el21
-rw-r--r--lisp/language/korea-util.el9
-rw-r--r--lisp/language/tibet-util.el5
-rw-r--r--lisp/language/viet-util.el4
5 files changed, 61 insertions, 130 deletions
diff --git a/lisp/language/china-util.el b/lisp/language/china-util.el
index 4942a064b24..e70afa9b908 100644
--- a/lisp/language/china-util.el
+++ b/lisp/language/china-util.el
@@ -29,25 +29,7 @@
29 "Setup multilingual environment (MULE) for Chinese GB2312 users." 29 "Setup multilingual environment (MULE) for Chinese GB2312 users."
30 (interactive) 30 (interactive)
31 (setup-english-environment) 31 (setup-english-environment)
32 32 (set-language-environment-coding-systems "Chinese-GB")
33 (set-default-coding-systems 'chinese-iso-8bit)
34 (setq coding-category-iso-8-2 'chinese-iso-8bit)
35 (setq coding-category-iso-7-else 'chinese-iso-7bit)
36 (setq coding-category-big5 'chinese-big5)
37
38 (set-coding-priority
39 '(coding-category-iso-7
40 coding-category-iso-7-else
41 coding-category-iso-8-2
42 coding-category-big5
43 coding-category-iso-8-1
44 coding-category-emacs-mule
45 coding-category-iso-8-else))
46
47 (setq-default buffer-file-coding-system 'chinese-iso-8bit)
48 (setq default-terminal-coding-system 'chinese-iso-8bit)
49 (setq default-keyboard-coding-system 'chinese-iso-8bit)
50
51 (setq default-input-method "chinese-py-punct")) 33 (setq default-input-method "chinese-py-punct"))
52 34
53;;;###autoload 35;;;###autoload
@@ -55,24 +37,7 @@
55 "Setup multilingual environment (MULE) for Chinese Big5 users." 37 "Setup multilingual environment (MULE) for Chinese Big5 users."
56 (interactive) 38 (interactive)
57 (setup-english-environment) 39 (setup-english-environment)
58 40 (set-language-environment-coding-systems "Chinese-BIG5")
59 (set-default-coding-systems 'chinese-big5)
60 (setq coding-category-iso-8-2 'chinese-big5)
61 (setq coding-category-iso-7-else 'chinese-iso-7bit)
62 (setq coding-category-big5 'chinese-big5)
63
64 (set-coding-priority
65 '(coding-category-iso-7
66 coding-category-iso-7-else
67 coding-category-big5
68 coding-category-iso-8-2
69 coding-category-emacs-mule
70 coding-category-iso-8-else))
71
72 (setq-default buffer-file-coding-system 'chinese-big5)
73 (setq default-terminal-coding-system 'chinese-big5)
74 (setq default-keyboard-coding-system 'chinese-big5)
75
76 (setq default-input-method "chinese-py-punct-b5")) 41 (setq default-input-method "chinese-py-punct-b5"))
77 42
78;;;###autoload 43;;;###autoload
@@ -80,23 +45,7 @@
80 "Setup multilingual environment (MULE) for Chinese CNS11643 family users." 45 "Setup multilingual environment (MULE) for Chinese CNS11643 family users."
81 (interactive) 46 (interactive)
82 (setup-english-environment) 47 (setup-english-environment)
83 48 (set-language-environment-coding-systems "Chinese-CNS")
84 (setq coding-category-iso-7-else 'chinese-iso-7bit)
85 (setq coding-category-big5 'chinese-big5)
86 (setq coding-category-iso-8-2 'chinese-big5)
87 (set-default-coding-systems 'chinese-iso-7bit)
88
89 (set-coding-priority
90 '(coding-category-iso-7
91 coding-category-iso-7-else
92 coding-category-iso-8-2
93 coding-category-big5
94 coding-category-iso-7-else))
95
96 (setq-default buffer-file-coding-system 'chinese-iso-7bit)
97 (setq default-terminal-coding-system 'chinese-iso-7bit)
98 (setq default-keyboard-coding-system 'chinese-iso-7bit)
99
100 (setq default-input-method "chinese-quick-cns")) 49 (setq default-input-method "chinese-quick-cns"))
101 50
102;; Hz/ZW encoding stuffs 51;; Hz/ZW encoding stuffs
@@ -122,11 +71,23 @@
122;; Regexp of ZW sequence to start GB2312. 71;; Regexp of ZW sequence to start GB2312.
123(defvar zw-start-gb "^zW") 72(defvar zw-start-gb "^zW")
124;; Regexp for start of GB2312 in an encoding mixture of HZ and ZW. 73;; Regexp for start of GB2312 in an encoding mixture of HZ and ZW.
125(defvar hz/zw-start-gb (concat hz-gb-designnation "\\|" zw-start-gb)) 74(defvar hz/zw-start-gb
75 (concat hz-gb-designnation "\\|" zw-start-gb "\\|[^\0-\177]"))
126 76
127(defvar decode-hz-line-continuation nil 77(defvar decode-hz-line-continuation nil
128 "Flag to tell if we should care line continuation convention of Hz.") 78 "Flag to tell if we should care line continuation convention of Hz.")
129 79
80(defconst hz-set-msb-table
81 (let ((str (make-string 127 0))
82 (i 0))
83 (while (< i 33)
84 (aset str i i)
85 (setq i (1+ i)))
86 (while (< i 127)
87 (aset str i (+ i 128))
88 (setq i (1+ i)))
89 str))
90
130;;;###autoload 91;;;###autoload
131(defun decode-hz-region (beg end) 92(defun decode-hz-region (beg end)
132 "Decode HZ/ZW encoded text in the current region. 93 "Decode HZ/ZW encoded text in the current region.
@@ -134,49 +95,46 @@ Return the length of resulting text."
134 (interactive "r") 95 (interactive "r")
135 (save-excursion 96 (save-excursion
136 (save-restriction 97 (save-restriction
137 (narrow-to-region beg end) 98 (let (pos ch)
138 99 (narrow-to-region beg end)
139 ;; We, at first, convert HZ/ZW to `iso-2022-7bit', 100
140 ;; then decode it. 101 ;; We, at first, convert HZ/ZW to `euc-china',
141 102 ;; then decode it.
142 ;; "~\n" -> "\n" 103
143 (goto-char (point-min)) 104 ;; "~\n" -> "\n", "~~" -> "~"
144 (while (search-forward "~" nil t) 105 (goto-char (point-min))
145 (if (= (following-char) ?\n) (delete-char -1)) 106 (while (search-forward "~" nil t)
146 (if (not (eobp)) (forward-char 1))) 107 (setq ch (following-char))
147 108 (if (or (= ch ?\n) (= ch ?~)) (delete-char -1)))
148 ;; "^zW...\n" -> Chinese GB2312 109
149 ;; "~{...~}" -> Chinese GB2312 110 ;; "^zW...\n" -> Chinese GB2312
150 (goto-char (point-min)) 111 ;; "~{...~}" -> Chinese GB2312
151 (let ((chinese-found nil)) 112 (goto-char (point-min))
113 (setq beg nil)
152 (while (re-search-forward hz/zw-start-gb nil t) 114 (while (re-search-forward hz/zw-start-gb nil t)
153 (if (= (char-after (match-beginning 0)) ?z) 115 (setq pos (match-beginning 0)
154 ;; ZW -> iso-2022-7bit 116 ch (char-after pos))
155 (progn 117 ;; Record the first position to start conversion.
156 (delete-char -2) 118 (or beg (setq beg pos))
157 (insert iso2022-gb-designation) 119 (end-of-line)
158 (end-of-line) 120 (setq end (point))
159 (insert iso2022-ascii-designation)) 121 (if (>= ch 128) ; 8bit GB2312
160 ;; HZ -> iso-2022-7bit 122 nil
161 (delete-char -2) 123 (goto-char pos)
162 (insert iso2022-gb-designation) 124 (delete-char 2)
163 (let ((pos (save-excursion (end-of-line) (point)))) 125 (setq end (- end 2))
164 (if (search-forward hz-ascii-designnation pos t) 126 (if (= ch ?z) ; ZW -> euc-china
165 (replace-match iso2022-ascii-designation) 127 (progn
166 (if (not decode-hz-line-continuation) 128 (translate-region (point) end hz-set-msb-table)
167 (insert iso2022-ascii-designation))))) 129 (goto-char end))
168 (setq chinese-found t)) 130 (if (search-forward hz-ascii-designnation
169 (if (or chinese-found 131 (if decode-hz-line-continuation nil end)
170 (let ((enable-multibyte-characters nil)) 132 t)
171 ;; Here we check if the text contains EUC (China) codes. 133 (delete-char -2))
172 ;; If any, we had better decode them also. 134 (setq end (point))
173 (goto-char (point-min)) 135 (translate-region pos (point) hz-set-msb-table))))
174 (re-search-forward "[\240-\377]" nil t))) 136 (if beg
175 (decode-coding-region (point-min) (point-max) 'euc-china))) 137 (decode-coding-region beg end 'euc-china)))
176
177 ;; "~~" -> "~"
178 (goto-char (point-min))
179 (while (search-forward "~~" nil t) (delete-char -1))
180 (- (point-max) (point-min))))) 138 (- (point-max) (point-min)))))
181 139
182;;;###autoload 140;;;###autoload
diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el
index 35e6c3f686f..6d257c3f6aa 100644
--- a/lisp/language/japan-util.el
+++ b/lisp/language/japan-util.el
@@ -29,24 +29,9 @@
29 "Setup multilingual environment (MULE) for Japanese." 29 "Setup multilingual environment (MULE) for Japanese."
30 (interactive) 30 (interactive)
31 (setup-english-environment) 31 (setup-english-environment)
32 32 (set-language-environment-coding-systems "Japanese")
33 (setq coding-category-iso-8-2 'japanese-iso-8bit) 33 (if (eq system-type 'ms-dos)
34 (setq coding-category-iso-8-else 'japanese-iso-8bit) 34 (prefer-coding-system 'japanese-shift-jis))
35
36 (set-coding-priority
37 '(coding-category-iso-7
38 coding-category-iso-8-2
39 coding-category-sjis
40 coding-category-iso-8-1
41 coding-category-iso-7-else
42 coding-category-iso-8-else
43 coding-category-emacs-mule))
44
45 (set-default-coding-systems
46 (if (eq system-type 'ms-dos)
47 'japanese-shift-jis
48 'iso-2022-jp))
49
50 (setq default-input-method "japanese")) 35 (setq default-input-method "japanese"))
51 36
52(defconst japanese-kana-table 37(defconst japanese-kana-table
diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el
index c9ca349776d..c2a0310a3c7 100644
--- a/lisp/language/korea-util.el
+++ b/lisp/language/korea-util.el
@@ -65,14 +65,7 @@
65 "Setup multilingual environment (MULE) for Korean." 65 "Setup multilingual environment (MULE) for Korean."
66 (interactive) 66 (interactive)
67 (setup-english-environment) 67 (setup-english-environment)
68 (setq coding-category-iso-8-2 'korean-iso-8bit) 68 (set-language-environment-coding-systems "Korean")
69
70 (set-coding-priority
71 '(coding-category-iso-7
72 coding-category-iso-8-2
73 coding-category-iso-8-1))
74
75 (set-default-coding-systems 'korean-iso-8bit)
76 69
77 (setq default-input-method "korean-hangul") 70 (setq default-input-method "korean-hangul")
78 71
diff --git a/lisp/language/tibet-util.el b/lisp/language/tibet-util.el
index 4ce4f36bc90..bb10564c699 100644
--- a/lisp/language/tibet-util.el
+++ b/lisp/language/tibet-util.el
@@ -36,10 +36,7 @@
36(defun setup-tibetan-environment () 36(defun setup-tibetan-environment ()
37 (interactive) 37 (interactive)
38 (setup-english-environment) 38 (setup-english-environment)
39 (setq coding-category-iso-8-2 'tibetan) 39 (set-language-environment-coding-systems "Tibetan")
40
41 (setq-default buffer-file-coding-system 'iso-2022-7bit)
42
43 (setq default-input-method "tibetan-wylie")) 40 (setq default-input-method "tibetan-wylie"))
44 41
45;;; This function makes a transcription string for 42;;; This function makes a transcription string for
diff --git a/lisp/language/viet-util.el b/lisp/language/viet-util.el
index 750f482c4bc..95c54f159c3 100644
--- a/lisp/language/viet-util.el
+++ b/lisp/language/viet-util.el
@@ -39,9 +39,7 @@
39(defun setup-vietnamese-environment () 39(defun setup-vietnamese-environment ()
40 "Setup multilingual environment (MULE) for Vietnamese VISCII users." 40 "Setup multilingual environment (MULE) for Vietnamese VISCII users."
41 (interactive) 41 (interactive)
42 (setup-8-bit-environment "Vietnamese" nil 'vietnamese-viscii 42 (setup-8-bit-environment "Vietnamese" nil "vietnamese-viqr"))
43 "vietnamese-viqr")
44 (setq coding-category-raw-text 'vietnamese-viscii))
45 43
46;; VIQR is a menmonic encoding specification for Vietnamese. 44;; VIQR is a menmonic encoding specification for Vietnamese.
47;; It represents diacritical marks by ASCII characters as follows: 45;; It represents diacritical marks by ASCII characters as follows: