Mercurial > emacs
annotate lisp/language/viet-util.el @ 18092:8428d56cd207
(smtpmail-via-smtp): Recognize XVRB as a synonym for
VERB and XONE as a synonym for ONEX.
(smtpmail-read-response): Add "%s" to `message' calls to avoid
problems with percent signs in strings.
(smtpmail-read-response): Return all lines of the
response text as a list of strings. Formerly only the first line
was returned. This is insufficient when one wants to parse
e.g. an EHLO response.
Ignore responses starting with "0". This is necessary to support
the VERB SMTP extension.
(smtpmail-via-smtp): Try EHLO and find out which SMTP service
extensions the receiving mailer supports.
Issue the ONEX and XUSR commands if the corresponding extensions
are supported.
Issue VERB if supported and `smtpmail-debug-info' is non-nil.
Add SIZE attribute to MAIL FROM: command if SIZE extension is
supported.
Add code that could set the BODY= attribute to MAIL FROM: if the
receiving mailer supports 8BITMIME. This is currently disabled,
since doing it right might involve adding MIME headers to, and in
some cases reencoding, the message.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Jun 1997 22:24:22 +0000 |
parents | 73869115ae0a |
children | 0745f30aec66 |
rev | line source |
---|---|
17315
a3ca5e15c82a
Fix the format of the first line.
Kenichi Handa <handa@m17n.org>
parents:
17171
diff
changeset
|
1 ;;; viet-util.el --- utilities for Vietnamese |
17052 | 2 |
3 ;; Copyright (C) 1995 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
5 | |
6 ;; Keywords: mule, multilingual, Vietnamese | |
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 ;; Vietnamese uses ASCII characters and additional 134 unique | |
28 ;; characters (these are Latin alphabets with various diacritical and | |
29 ;; tone marks). As far as I know, Vietnamese now has 4 different ways | |
30 ;; for representing these characters: VISCII, VSCII, VIQR, and | |
31 ;; Unicode. VISCII and VSCII are simple 1-byte code which assigns 134 | |
32 ;; unique characters in control-code area (0x00..0x1F) and right half | |
33 ;; area (0x80..0xFF). VIQR is a menmonic encoding specification | |
34 ;; representing diacritical marks by following ASCII characters. | |
35 | |
36 ;;; Code: | |
37 | |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17777
diff
changeset
|
38 (defun setup-vietnamese-environment () |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17777
diff
changeset
|
39 "Setup multilingual environment (MULE) for Vietnamese." |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17777
diff
changeset
|
40 (interactive) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17777
diff
changeset
|
41 (setup-8-bit-environment nil 'viscii '("Vietnamese" . "quail-viqr"))) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17777
diff
changeset
|
42 |
17052 | 43 ;; VIQR is a menmonic encoding specification for Vietnamese. |
44 ;; It represents diacritical marks by ASCII characters as follows: | |
45 ;; ------------+----------+-------- | |
46 ;; mark | mnemonic | example | |
47 ;; ------------+----------+--------- | |
48 ;; breve | ( | a( -> ,1e(B | |
49 ;; circumflex | ^ | a^ -> ,1b(B | |
50 ;; horn | + | o+ -> ,1=(B | |
51 ;; ------------+----------+--------- | |
52 ;; acute | ' | a' -> ,1a(B | |
53 ;; grave | ` | a` -> ,1`(B | |
54 ;; hook above | ? | a? -> ,1d(B | |
55 ;; tilde | ~ | a~ -> ,1c(B | |
56 ;; dot below | . | a. -> ,1U(B | |
57 ;; ------------+----------+--------- | |
58 ;; d bar | dd | dd -> ,1p(B | |
59 ;; ------------+----------+--------- | |
60 | |
61 (defvar viet-viqr-alist | |
62 '(;; lowercase | |
63 (?,1!(B . "a('") ; 161 | |
64 (?,1"(B . "a(`") ; 162 | |
65 (?,1#(B . "a(.") ; 163 | |
66 (?,1$(B . "a^'") ; 164 | |
67 (?,1%(B . "a^`") ; 165 | |
68 (?,1&(B . "a^?") ; 166 | |
69 (?,1'(B . "a^.") ; 167 | |
70 (?,1((B . "e~") ; 168 | |
71 (?,1)(B . "e.") ; 169 | |
72 (?,1*(B . "e^'") ; 170 | |
73 (?,1+(B . "e^`") ; 171 | |
74 (?,1,(B . "e^?") ; 172 | |
75 (?,1-(B . "e^~") ; 173 | |
76 (?,1.(B . "e^.") ; 174 | |
77 (?,1/(B . "o^'") ; 175 | |
78 (?,10(B . "o^`") ; 176 | |
79 (?,11(B . "o^?") ; 177 | |
80 (?,12(B . "o^~") ; 178 | |
81 (?,15(B . "o^.") ; 181 | |
82 (?,16(B . "o+`") ; 182 | |
83 (?,17(B . "o+?") ; 183 | |
84 (?,18(B . "i.") ; 184 | |
85 (?,1=(B . "o+") ; 189 | |
86 (?,1>(B . "o+'") ; 190 | |
87 (?,1F(B . "a(?") ; 198 | |
88 (?,1G(B . "a(~") ; 199 | |
89 (?,1O(B . "y`") ; 207 | |
90 (?,1Q(B . "u+'") ; 209 | |
91 (?,1U(B . "a.") ; 213 | |
92 (?,1V(B . "y?") ; 214 | |
93 (?,1W(B . "u+`") ; 215 | |
94 (?,1X(B . "u+?") ; 216 | |
95 (?,1[(B . "y~") ; 219 | |
96 (?,1\(B . "y.") ; 220 | |
97 (?,1^(B . "o+~") ; 222 | |
98 (?,1_(B . "u+") ; 223 | |
99 (?,1`(B . "a`") ; 224 | |
100 (?,1a(B . "a'") ; 225 | |
101 (?,1b(B . "a^") ; 226 | |
102 (?,1c(B . "a~") ; 227 | |
103 (?,1d(B . "a?") ; 228 | |
104 (?,1e(B . "a(") ; 229 | |
105 (?,1f(B . "u+~") ; 230 | |
106 (?,1g(B . "a^~") ; 231 | |
107 (?,1h(B . "e`") ; 232 | |
108 (?,1i(B . "e'") ; 233 | |
109 (?,1j(B . "e^") ; 234 | |
110 (?,1k(B . "e?") ; 235 | |
111 (?,1l(B . "i`") ; 236 | |
112 (?,1m(B . "i'") ; 237 | |
113 (?,1n(B . "i~") ; 238 | |
114 (?,1o(B . "i?") ; 239 | |
115 (?,1p(B . "dd") ; 240 | |
116 (?,1q(B . "u+.") ; 241 | |
117 (?,1r(B . "o`") ; 242 | |
118 (?,1s(B . "o'") ; 243 | |
119 (?,1t(B . "o^") ; 244 | |
120 (?,1u(B . "o~") ; 245 | |
121 (?,1v(B . "o?") ; 246 | |
122 (?,1w(B . "o.") ; 247 | |
123 (?,1x(B . "u.") ; 248 | |
124 (?,1y(B . "u`") ; 249 | |
125 (?,1z(B . "u'") ; 250 | |
126 (?,1{(B . "u~") ; 251 | |
127 (?,1|(B . "u?") ; 252 | |
128 (?,1}(B . "y'") ; 253 | |
129 (?,1~(B . "o+.") ; 254 | |
130 | |
131 ;; upper case | |
132 (?,2!(B . "A('") ; 161 | |
133 (?,2"(B . "A(`") ; 162 | |
134 (?,2#(B . "A(.") ; 163 | |
135 (?,2$(B . "A^'") ; 164 | |
136 (?,2%(B . "A^`") ; 165 | |
137 (?,2&(B . "A^?") ; 166 | |
138 (?,2'(B . "A^.") ; 167 | |
139 (?,2((B . "E~") ; 168 | |
140 (?,2)(B . "E.") ; 169 | |
141 (?,2*(B . "E^'") ; 170 | |
142 (?,2+(B . "E^`") ; 171 | |
143 (?,2,(B . "E^?") ; 172 | |
144 (?,2-(B . "E^~") ; 173 | |
145 (?,2.(B . "E^.") ; 174 | |
146 (?,2/(B . "O^'") ; 175 | |
147 (?,20(B . "O^`") ; 176 | |
148 (?,21(B . "O^?") ; 177 | |
149 (?,22(B . "O^~") ; 178 | |
150 (?,25(B . "O^.") ; 181 | |
151 (?,26(B . "O+`") ; 182 | |
152 (?,27(B . "O+?") ; 183 | |
153 (?,28(B . "I.") ; 184 | |
154 (?,2=(B . "O+") ; 189 | |
155 (?,2>(B . "O+'") ; 190 | |
156 (?,2F(B . "A(?") ; 198 | |
157 (?,2G(B . "A(~") ; 199 | |
158 (?,2O(B . "Y`") ; 207 | |
159 (?,2Q(B . "U+'") ; 209 | |
160 (?,2U(B . "A.") ; 213 | |
161 (?,2V(B . "Y?") ; 214 | |
162 (?,2W(B . "U+`") ; 215 | |
163 (?,2X(B . "U+?") ; 216 | |
164 (?,2[(B . "Y~") ; 219 | |
165 (?,2\(B . "Y.") ; 220 | |
166 (?,2^(B . "O+~") ; 222 | |
167 (?,2_(B . "U+") ; 223 | |
168 (?,2`(B . "A`") ; 224 | |
169 (?,2a(B . "A'") ; 225 | |
170 (?,2b(B . "A^") ; 226 | |
171 (?,2c(B . "A~") ; 227 | |
172 (?,2d(B . "A?") ; 228 | |
173 (?,2e(B . "A(") ; 229 | |
174 (?,2f(B . "U+~") ; 230 | |
175 (?,2g(B . "A^~") ; 231 | |
176 (?,2h(B . "E`") ; 232 | |
177 (?,2i(B . "E'") ; 233 | |
178 (?,2j(B . "E^") ; 234 | |
179 (?,2k(B . "E?") ; 235 | |
180 (?,2l(B . "I`") ; 236 | |
181 (?,2m(B . "I'") ; 237 | |
182 (?,2n(B . "I~") ; 238 | |
183 (?,2o(B . "I?") ; 239 | |
184 (?,2p(B . "DD") ; 240 | |
185 (?,2p(B . "dD") ; 240 | |
186 (?,2p(B . "Dd") ; 240 | |
187 (?,2q(B . "U+.") ; 241 | |
188 (?,2r(B . "O`") ; 242 | |
189 (?,2s(B . "O'") ; 243 | |
190 (?,2t(B . "O^") ; 244 | |
191 (?,2u(B . "O~") ; 245 | |
192 (?,2v(B . "O?") ; 246 | |
193 (?,2w(B . "O.") ; 247 | |
194 (?,2x(B . "U.") ; 248 | |
195 (?,2y(B . "U`") ; 249 | |
196 (?,2z(B . "U'") ; 250 | |
197 (?,2{(B . "U~") ; 251 | |
198 (?,2|(B . "U?") ; 252 | |
199 (?,2}(B . "Y'") ; 253 | |
200 (?,2~(B . "O+.") ; 254 | |
201 | |
202 ;; escape from composition | |
203 (?\( . "\\(") ; breve (left parenthesis) | |
204 (?^ . "\\^") ; circumflex (caret) | |
205 (?+ . "\\+") ; horn (plus sign) | |
206 (?' . "\\'") ; acute (apostrophe) | |
207 (?` . "\\`") ; grave (backquote) | |
208 (?? . "\\?") ; hook above (question mark) | |
209 (?~ . "\\~") ; tilde (tilde) | |
210 (?. . "\\.") ; dot below (period) | |
211 (?d . "\\d") ; d-bar (d) | |
212 (?\\ . "\\\\") ; literal backslash | |
213 ) | |
214 "Alist of Vietnamese characters vs corresponding `VIQR' string.") | |
215 | |
216 ;; Regular expression matching single Vietnamese character represented | |
217 ;; by VIQR. | |
218 (defconst viqr-regexp | |
219 "[aeiouyAEIOUY]\\([(^+]?['`?~.]\\|[(^+]\\)\\|[Dd][Dd]") | |
220 | |
221 ;;;###autoload | |
222 (defun viet-decode-viqr-region (from to) | |
223 "Convert `VIQR' mnemonics of the current region to Vietnamese characaters. | |
224 When called from a program, expects two arguments, | |
225 positions (integers or markers) specifying the stretch of the region." | |
226 (interactive "r") | |
227 (save-restriction | |
228 (narrow-to-region from to) | |
229 (goto-char (point-min)) | |
230 (while (re-search-forward viqr-regexp nil t) | |
231 (let* ((viqr (buffer-substring (match-beginning 0) (match-end 0))) | |
17171
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
232 (ch (car (rassoc viqr viet-viqr-alist)))) |
17052 | 233 (if ch |
234 (progn | |
235 (delete-region (match-beginning 0) (match-end 0)) | |
236 (insert ch))))))) | |
237 | |
238 ;;;###autoload | |
239 (defun viet-decode-viqr-buffer () | |
240 "Convert `VIQR' mnemonics of the current buffer to Vietnamese characaters." | |
241 (interactive) | |
242 (viet-decode-viqr-region (point-min) (point-max))) | |
243 | |
244 ;;;###autoload | |
245 (defun viet-encode-viqr-region (from to) | |
246 "Convert Vietnamese characaters of the current region to `VIQR' mnemonics. | |
247 When called from a program, expects two arguments, | |
248 positions (integers or markers) specifying the stretch of the region." | |
249 (interactive "r") | |
250 (save-restriction | |
251 (narrow-to-region from to) | |
252 (goto-char (point-min)) | |
253 (while (re-search-forward "\\cv" nil t) | |
254 (let* ((ch (preceding-char)) | |
17171
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
255 (viqr (cdr (assq ch viet-viqr-alist)))) |
17052 | 256 (if viqr |
257 (progn | |
258 (delete-char -1) | |
259 (insert viqr))))))) | |
260 | |
261 ;;;###autoload | |
262 (defun viet-encode-viqr-buffer () | |
263 "Convert Vietnamese characaters of the current buffer to `VIQR' mnemonics." | |
264 (interactive) | |
265 (viet-encode-viqr-region (point-min) (point-max))) | |
266 | |
17171
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
267 ;;;###autoload |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
268 (defun viqr-post-read-conversion (len) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
269 (save-excursion |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
270 (save-restriction |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
271 (narrow-to-region (point) (+ (point) len)) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
272 (let ((buffer-modified-p (buffer-modified-p))) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
273 (viet-decode-viqr-region (point-min) (point-max)) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
274 (set-buffer-modified-p buffer-modified-p) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
275 (- (point-max) (point-min)))))) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
276 |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
277 ;;;###autoload |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
278 (defun viqr-pre-write-conversion (from to) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
279 (let ((old-buf (current-buffer)) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
280 (work-buf (get-buffer-create " *viet-work*"))) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
281 (set-buffer work-buf) |
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
282 (erase-buffer) |
17777
081f940a8d1f
(viqr-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
283 (if (stringp from) |
081f940a8d1f
(viqr-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
284 (insert from) |
081f940a8d1f
(viqr-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
285 (insert-buffer-substring old-buf from to)) |
081f940a8d1f
(viqr-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
286 (viet-encode-viqr-region (point-min) (point-max)) |
081f940a8d1f
(viqr-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
287 ;; Should return nil as annotations. |
081f940a8d1f
(viqr-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
288 nil)) |
17171
6f95d429f32d
(viet-decode-viqr-region): Supply correct
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
289 |
17052 | 290 ;;; |
291 (provide 'language/viet-util) | |
292 | |
293 ;;; Local Variables: | |
294 ;;; generated-autoload-file: "../loaddefs.el" | |
295 ;;; End: | |
296 ;;; viet-util.el ends here |