Commit | Line | Data |
---|---|---|
60370d40 | 1 | ;;; cyril-util.el --- utilities for Cyrillic scripts |
d6c7b552 | 2 | |
e65186d5 | 3 | ;; Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc. |
d6c7b552 KH |
4 | |
5 | ;; Keywords: mule, multilingual, Cyrillic | |
6 | ||
7 | ;; This file is part of GNU Emacs. | |
8 | ||
9 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 | ;; it 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 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;; GNU General Public License for more details. | |
18 | ||
19 | ;; You should have received a copy of the GNU General Public License | |
20 | ;; along with GNU Emacs; 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 | ||
60370d40 PJ |
24 | ;;; Commentary: |
25 | ||
d6c7b552 KH |
26 | ;;; Code: |
27 | ||
e65186d5 DL |
28 | ;; Fixme: are the next two useful? |
29 | ||
ce58d9b4 KH |
30 | ;;;###autoload |
31 | (defun cyrillic-encode-koi8-r-char (char) | |
32 | "Return KOI8-R external character code of CHAR if appropriate." | |
a1970a1d RS |
33 | (aref (char-table-extra-slot |
34 | (get 'cyrillic-koi8-r-nonascii-translation-table 'translation-table) | |
35 | 0) | |
ce58d9b4 KH |
36 | char)) |
37 | ||
38 | ;;;###autoload | |
39 | (defun cyrillic-encode-alternativnyj-char (char) | |
40 | "Return ALTERNATIVNYJ external character code of CHAR if appropriate." | |
41 | (aref (char-table-extra-slot | |
a1970a1d RS |
42 | (get 'cyrillic-alternativnyj-nonascii-translation-table |
43 | 'translation-table) | |
44 | 0) | |
ce58d9b4 KH |
45 | char)) |
46 | ||
71ed4992 | 47 | \f |
a1970a1d | 48 | ;; Display |
71ed4992 RS |
49 | |
50 | ;; Written by Valery Alexeev <valery@math.uga.edu>. | |
51 | ||
7286c88e | 52 | (defvar cyrillic-language-alist |
a1970a1d | 53 | (list '("Belorussian") '("Bulgarian") '("Macedonian") |
f58bb396 | 54 | '("Russian") '("Serbo-Croatian") '("Ukrainian")) |
a1970a1d | 55 | "List of known cyrillic languages.") |
7286c88e | 56 | |
7286c88e KH |
57 | ;;;###autoload |
58 | (defun standard-display-cyrillic-translit (&optional cyrillic-language) | |
71ed4992 RS |
59 | "Display a cyrillic buffer using a transliteration. |
60 | For readability, the table is slightly | |
61 | different from the one used for the input method `cyrillic-translit'. | |
62 | ||
7286c88e | 63 | The argument is a string which specifies which language you are using; |
71ed4992 | 64 | that affects the choice of transliterations slightly. |
a1970a1d | 65 | Possible values are listed in `cyrillic-language-alist'. |
7286c88e | 66 | If the argument is t, we use the default cyrillic transliteration. |
71ed4992 | 67 | If the argument is nil, we return the display table to its standard state." |
2631431f RS |
68 | (interactive |
69 | (list | |
70 | (let* ((completion-ignore-case t)) | |
71 | (completing-read | |
72 | "Cyrillic language (default nil): " | |
73 | cyrillic-language-alist nil t nil nil nil)))) | |
74 | ||
75 | (or standard-display-table | |
76 | (setq standard-display-table (make-display-table))) | |
7286c88e KH |
77 | |
78 | (if (equal cyrillic-language "") | |
79 | (setq cyrillic-language nil)) | |
80 | ||
71ed4992 RS |
81 | (if (null cyrillic-language) |
82 | (setq standard-display-table (make-display-table)) | |
7286c88e KH |
83 | (aset standard-display-table ?\e,LP\e(B [?a]) |
84 | (aset standard-display-table ?\e,LQ\e(B [?b]) | |
85 | (aset standard-display-table ?\e,LR\e(B [?v]) | |
86 | (aset standard-display-table ?\e,LS\e(B [?g]) | |
87 | (aset standard-display-table ?\e,LT\e(B [?d]) | |
88 | (aset standard-display-table ?\e,LU\e(B [?e]) | |
89 | (aset standard-display-table ?\e,Lq\e(B [?y?o]) | |
90 | (aset standard-display-table ?\e,LV\e(B [?z?h]) | |
91 | (aset standard-display-table ?\e,LW\e(B [?z]) | |
92 | (aset standard-display-table ?\e,LX\e(B [?i]) | |
93 | (aset standard-display-table ?\e,LY\e(B [?j]) | |
94 | (aset standard-display-table ?\e,LZ\e(B [?k]) | |
95 | (aset standard-display-table ?\e,L[\e(B [?l]) | |
96 | (aset standard-display-table ?\e,L\\e(B [?m]) | |
97 | (aset standard-display-table ?\e,L]\e(B [?n]) | |
98 | (aset standard-display-table ?\e,L^\e(B [?o]) | |
99 | (aset standard-display-table ?\e,L_\e(B [?p]) | |
100 | (aset standard-display-table ?\e,L`\e(B [?r]) | |
101 | (aset standard-display-table ?\e,La\e(B [?s]) | |
102 | (aset standard-display-table ?\e,Lb\e(B [?t]) | |
103 | (aset standard-display-table ?\e,Lc\e(B [?u]) | |
104 | (aset standard-display-table ?\e,Ld\e(B [?f]) | |
105 | (aset standard-display-table ?\e,Le\e(B [?k?h]) | |
106 | (aset standard-display-table ?\e,Lf\e(B [?t?s]) | |
107 | (aset standard-display-table ?\e,Lg\e(B [?c?h]) | |
108 | (aset standard-display-table ?\e,Lh\e(B [?s?h]) | |
109 | (aset standard-display-table ?\e,Li\e(B [?s?c?h]) | |
110 | (aset standard-display-table ?\e,Lj\e(B [?~]) | |
111 | (aset standard-display-table ?\e,Lk\e(B [?y]) | |
112 | (aset standard-display-table ?\e,Ll\e(B [?']) | |
113 | (aset standard-display-table ?\e,Lm\e(B [?e?']) | |
114 | (aset standard-display-table ?\e,Ln\e(B [?y?u]) | |
115 | (aset standard-display-table ?\e,Lo\e(B [?y?a]) | |
a1506d29 | 116 | |
7286c88e KH |
117 | (aset standard-display-table ?\e,L0\e(B [?A]) |
118 | (aset standard-display-table ?\e,L1\e(B [?B]) | |
119 | (aset standard-display-table ?\e,L2\e(B [?V]) | |
120 | (aset standard-display-table ?\e,L3\e(B [?G]) | |
121 | (aset standard-display-table ?\e,L4\e(B [?D]) | |
122 | (aset standard-display-table ?\e,L5\e(B [?E]) | |
123 | (aset standard-display-table ?\e,L!\e(B [?Y?o]) | |
124 | (aset standard-display-table ?\e,L6\e(B [?Z?h]) | |
125 | (aset standard-display-table ?\e,L7\e(B [?Z]) | |
126 | (aset standard-display-table ?\e,L8\e(B [?I]) | |
127 | (aset standard-display-table ?\e,L9\e(B [?J]) | |
128 | (aset standard-display-table ?\e,L:\e(B [?K]) | |
129 | (aset standard-display-table ?\e,L;\e(B [?L]) | |
130 | (aset standard-display-table ?\e,L<\e(B [?M]) | |
131 | (aset standard-display-table ?\e,L=\e(B [?N]) | |
132 | (aset standard-display-table ?\e,L>\e(B [?O]) | |
133 | (aset standard-display-table ?\e,L?\e(B [?P]) | |
134 | (aset standard-display-table ?\e,L@\e(B [?R]) | |
135 | (aset standard-display-table ?\e,LA\e(B [?S]) | |
136 | (aset standard-display-table ?\e,LB\e(B [?T]) | |
137 | (aset standard-display-table ?\e,LC\e(B [?U]) | |
138 | (aset standard-display-table ?\e,LD\e(B [?F]) | |
139 | (aset standard-display-table ?\e,LE\e(B [?K?h]) | |
140 | (aset standard-display-table ?\e,LF\e(B [?T?s]) | |
141 | (aset standard-display-table ?\e,LG\e(B [?C?h]) | |
142 | (aset standard-display-table ?\e,LH\e(B [?S?h]) | |
143 | (aset standard-display-table ?\e,LI\e(B [?S?c?h]) | |
144 | (aset standard-display-table ?\e,LJ\e(B [?~]) | |
145 | (aset standard-display-table ?\e,LK\e(B [?Y]) | |
146 | (aset standard-display-table ?\e,LL\e(B [?']) | |
147 | (aset standard-display-table ?\e,LM\e(B [?E?']) | |
148 | (aset standard-display-table ?\e,LN\e(B [?Y?u]) | |
149 | (aset standard-display-table ?\e,LO\e(B [?Y?a]) | |
a1970a1d | 150 | |
7286c88e KH |
151 | (aset standard-display-table ?\e,Lt\e(B [?i?e]) |
152 | (aset standard-display-table ?\e,Lw\e(B [?i]) | |
153 | (aset standard-display-table ?\e,L~\e(B [?u]) | |
154 | (aset standard-display-table ?\e,Lr\e(B [?d?j]) | |
155 | (aset standard-display-table ?\e,L{\e(B [?c?h?j]) | |
156 | (aset standard-display-table ?\e,Ls\e(B [?g?j]) | |
157 | (aset standard-display-table ?\e,Lu\e(B [?s]) | |
158 | (aset standard-display-table ?\e,L|\e(B [?k]) | |
159 | (aset standard-display-table ?\e,Lv\e(B [?i]) | |
160 | (aset standard-display-table ?\e,Lx\e(B [?j]) | |
161 | (aset standard-display-table ?\e,Ly\e(B [?l?j]) | |
162 | (aset standard-display-table ?\e,Lz\e(B [?n?j]) | |
163 | (aset standard-display-table ?\e,L\7f\e(B [?d?z]) | |
a1970a1d | 164 | |
7286c88e KH |
165 | (aset standard-display-table ?\e,L$\e(B [?Y?e]) |
166 | (aset standard-display-table ?\e,L'\e(B [?Y?i]) | |
167 | (aset standard-display-table ?\e,L.\e(B [?U]) | |
168 | (aset standard-display-table ?\e,L"\e(B [?D?j]) | |
169 | (aset standard-display-table ?\e,L+\e(B [?C?h?j]) | |
170 | (aset standard-display-table ?\e,L#\e(B [?G?j]) | |
171 | (aset standard-display-table ?\e,L%\e(B [?S]) | |
172 | (aset standard-display-table ?\e,L,\e(B [?K]) | |
173 | (aset standard-display-table ?\e,L&\e(B [?I]) | |
174 | (aset standard-display-table ?\e,L(\e(B [?J]) | |
175 | (aset standard-display-table ?\e,L)\e(B [?L?j]) | |
176 | (aset standard-display-table ?\e,L*\e(B [?N?j]) | |
177 | (aset standard-display-table ?\e,L/\e(B [?D?j]) | |
a1970a1d RS |
178 | |
179 | ;; Unicode version: | |
180 | (aset standard-display-table ?\e$,1(P\e(B [?a]) | |
181 | (aset standard-display-table ?\e$,1(Q\e(B [?b]) | |
182 | (aset standard-display-table ?\e$,1(R\e(B [?v]) | |
183 | (aset standard-display-table ?\e$,1(S\e(B [?g]) | |
184 | (aset standard-display-table ?\e$,1(T\e(B [?d]) | |
185 | (aset standard-display-table ?\e$,1(U\e(B [?e]) | |
186 | (aset standard-display-table ?\e$,1(q\e(B [?y?o]) | |
187 | (aset standard-display-table ?\e$,1(V\e(B [?z?h]) | |
188 | (aset standard-display-table ?\e$,1(W\e(B [?z]) | |
189 | (aset standard-display-table ?\e$,1(X\e(B [?i]) | |
190 | (aset standard-display-table ?\e$,1(Y\e(B [?j]) | |
191 | (aset standard-display-table ?\e$,1(Z\e(B [?k]) | |
192 | (aset standard-display-table ?\e$,1([\e(B [?l]) | |
193 | (aset standard-display-table ?\e$,1(\\e(B [?m]) | |
194 | (aset standard-display-table ?\e$,1(]\e(B [?n]) | |
195 | (aset standard-display-table ?\e$,1(^\e(B [?o]) | |
196 | (aset standard-display-table ?\e$,1(_\e(B [?p]) | |
197 | (aset standard-display-table ?\e$,1(`\e(B [?r]) | |
198 | (aset standard-display-table ?\e$,1(a\e(B [?s]) | |
199 | (aset standard-display-table ?\e$,1(b\e(B [?t]) | |
200 | (aset standard-display-table ?\e$,1(c\e(B [?u]) | |
201 | (aset standard-display-table ?\e$,1(d\e(B [?f]) | |
202 | (aset standard-display-table ?\e$,1(e\e(B [?k?h]) | |
203 | (aset standard-display-table ?\e$,1(f\e(B [?t?s]) | |
204 | (aset standard-display-table ?\e$,1(g\e(B [?c?h]) | |
205 | (aset standard-display-table ?\e$,1(h\e(B [?s?h]) | |
206 | (aset standard-display-table ?\e$,1(i\e(B [?s?c?h]) | |
207 | (aset standard-display-table ?\e$,1(j\e(B [?~]) | |
208 | (aset standard-display-table ?\e$,1(k\e(B [?y]) | |
209 | (aset standard-display-table ?\e$,1(l\e(B [?']) | |
210 | (aset standard-display-table ?\e$,1(m\e(B [?e?']) | |
211 | (aset standard-display-table ?\e$,1(n\e(B [?y?u]) | |
212 | (aset standard-display-table ?\e$,1(o\e(B [?y?a]) | |
213 | ||
214 | (aset standard-display-table ?\e$,1(0\e(B [?A]) | |
215 | (aset standard-display-table ?\e$,1(1\e(B [?B]) | |
216 | (aset standard-display-table ?\e$,1(2\e(B [?V]) | |
217 | (aset standard-display-table ?\e$,1(3\e(B [?G]) | |
218 | (aset standard-display-table ?\e$,1(4\e(B [?D]) | |
219 | (aset standard-display-table ?\e$,1(5\e(B [?E]) | |
220 | (aset standard-display-table ?\e$,1(!\e(B [?Y?o]) | |
221 | (aset standard-display-table ?\e$,1(6\e(B [?Z?h]) | |
222 | (aset standard-display-table ?\e$,1(7\e(B [?Z]) | |
223 | (aset standard-display-table ?\e$,1(8\e(B [?I]) | |
224 | (aset standard-display-table ?\e$,1(9\e(B [?J]) | |
225 | (aset standard-display-table ?\e$,1(:\e(B [?K]) | |
226 | (aset standard-display-table ?\e$,1(;\e(B [?L]) | |
227 | (aset standard-display-table ?\e$,1(<\e(B [?M]) | |
228 | (aset standard-display-table ?\e$,1(=\e(B [?N]) | |
229 | (aset standard-display-table ?\e$,1(>\e(B [?O]) | |
230 | (aset standard-display-table ?\e$,1(?\e(B [?P]) | |
231 | (aset standard-display-table ?\e$,1(@\e(B [?R]) | |
232 | (aset standard-display-table ?\e$,1(A\e(B [?S]) | |
233 | (aset standard-display-table ?\e$,1(B\e(B [?T]) | |
234 | (aset standard-display-table ?\e$,1(C\e(B [?U]) | |
235 | (aset standard-display-table ?\e$,1(D\e(B [?F]) | |
236 | (aset standard-display-table ?\e$,1(E\e(B [?K?h]) | |
237 | (aset standard-display-table ?\e$,1(F\e(B [?T?s]) | |
238 | (aset standard-display-table ?\e$,1(G\e(B [?C?h]) | |
239 | (aset standard-display-table ?\e$,1(H\e(B [?S?h]) | |
240 | (aset standard-display-table ?\e$,1(I\e(B [?S?c?h]) | |
241 | (aset standard-display-table ?\e$,1(J\e(B [?~]) | |
242 | (aset standard-display-table ?\e$,1(K\e(B [?Y]) | |
243 | (aset standard-display-table ?\e$,1(L\e(B [?']) | |
244 | (aset standard-display-table ?\e$,1(M\e(B [?E?']) | |
245 | (aset standard-display-table ?\e$,1(N\e(B [?Y?u]) | |
246 | (aset standard-display-table ?\e$,1(O\e(B [?Y?a]) | |
247 | ||
248 | (aset standard-display-table ?\e$,1(t\e(B [?i?e]) | |
249 | (aset standard-display-table ?\e$,1(w\e(B [?i]) | |
250 | (aset standard-display-table ?\e$,1(~\e(B [?u]) | |
251 | (aset standard-display-table ?\e$,1(r\e(B [?d?j]) | |
252 | (aset standard-display-table ?\e$,1({\e(B [?c?h?j]) | |
253 | (aset standard-display-table ?\e$,1(s\e(B [?g?j]) | |
254 | (aset standard-display-table ?\e$,1(u\e(B [?s]) | |
255 | (aset standard-display-table ?\e$,1(|\e(B [?k]) | |
256 | (aset standard-display-table ?\e$,1(v\e(B [?i]) | |
257 | (aset standard-display-table ?\e$,1(x\e(B [?j]) | |
258 | (aset standard-display-table ?\e$,1(y\e(B [?l?j]) | |
259 | (aset standard-display-table ?\e$,1(z\e(B [?n?j]) | |
260 | (aset standard-display-table ?\e$,1(\7f\e(B [?d?z]) | |
261 | ||
262 | (aset standard-display-table ?\e$,1($\e(B [?Y?e]) | |
263 | (aset standard-display-table ?\e$,1('\e(B [?Y?i]) | |
264 | (aset standard-display-table ?\e$,1(.\e(B [?U]) | |
265 | (aset standard-display-table ?\e$,1("\e(B [?D?j]) | |
266 | (aset standard-display-table ?\e$,1(+\e(B [?C?h?j]) | |
267 | (aset standard-display-table ?\e$,1(#\e(B [?G?j]) | |
268 | (aset standard-display-table ?\e$,1(%\e(B [?S]) | |
269 | (aset standard-display-table ?\e$,1(,\e(B [?K]) | |
270 | (aset standard-display-table ?\e$,1(&\e(B [?I]) | |
271 | (aset standard-display-table ?\e$,1((\e(B [?J]) | |
272 | (aset standard-display-table ?\e$,1()\e(B [?L?j]) | |
273 | (aset standard-display-table ?\e$,1(*\e(B [?N?j]) | |
274 | (aset standard-display-table ?\e$,1(/\e(B [?D?j]) | |
275 | ||
7286c88e KH |
276 | (when (equal cyrillic-language "Bulgarian") |
277 | (aset standard-display-table ?\e,Li\e(B [?s?h?t]) | |
278 | (aset standard-display-table ?\e,LI\e(B [?S?h?t]) | |
279 | (aset standard-display-table ?\e,Ln\e(B [?i?u]) | |
280 | (aset standard-display-table ?\e,LN\e(B [?I?u]) | |
281 | (aset standard-display-table ?\e,Lo\e(B [?i?a]) | |
a1970a1d RS |
282 | (aset standard-display-table ?\e,LO\e(B [?I?a]) |
283 | ;; Unicode version: | |
284 | (aset standard-display-table ?\e$,1(i\e(B [?s?h?t]) | |
285 | (aset standard-display-table ?\e$,1(I\e(B [?S?h?t]) | |
286 | (aset standard-display-table ?\e$,1(n\e(B [?i?u]) | |
287 | (aset standard-display-table ?\e$,1(N\e(B [?I?u]) | |
288 | (aset standard-display-table ?\e$,1(o\e(B [?i?a]) | |
289 | (aset standard-display-table ?\e$,1(O\e(B [?I?a])) | |
290 | ||
291 | (when (equal cyrillic-language "Ukrainian") ; based on the official | |
71ed4992 | 292 | ; transliteration table |
7286c88e KH |
293 | (aset standard-display-table ?\e,LX\e(B [?y]) |
294 | (aset standard-display-table ?\e,L8\e(B [?Y]) | |
295 | (aset standard-display-table ?\e,LY\e(B [?i]) | |
296 | (aset standard-display-table ?\e,L9\e(B [?Y]) | |
a1970a1d RS |
297 | (aset standard-display-table ?\e,Ln\e(B [?i?u]) |
298 | (aset standard-display-table ?\e,Lo\e(B [?i?a]) | |
299 | ;; Unicode version: | |
300 | (aset standard-display-table ?\e$,1(X\e(B [?y]) | |
301 | (aset standard-display-table ?\e$,1(8\e(B [?Y]) | |
302 | (aset standard-display-table ?\e$,1(Y\e(B [?i]) | |
303 | (aset standard-display-table ?\e$,1(9\e(B [?Y]) | |
304 | (aset standard-display-table ?\e$,1(n\e(B [?i?u]) | |
305 | (aset standard-display-table ?\e$,1(o\e(B [?i?a])))) | |
d6c7b552 | 306 | |
d6c7b552 | 307 | ;; |
9e9af2e9 | 308 | (provide 'cyril-util) |
d6c7b552 | 309 | |
7286c88e | 310 | ;; Local Variables: |
e7509bdd | 311 | ;; coding: iso-2022-7bit |
7286c88e | 312 | ;; End: |
60370d40 PJ |
313 | |
314 | ;;; cyril-util.el ends here |