1 ;;; cyril-util.el --- utilities for Cyrillic scripts
3 ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Keywords: mule, multilingual, Cyrillic
8 ;; This file is part of GNU Emacs.
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 3, or (at your option)
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.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
29 ;; Fixme: are the next two useful?
32 (defun cyrillic-encode-koi8-r-char (char)
33 "Return KOI8-R external character code of CHAR if appropriate."
34 (aref (char-table-extra-slot
35 (get 'cyrillic-koi8-r-nonascii-translation-table
'translation-table
)
40 (defun cyrillic-encode-alternativnyj-char (char)
41 "Return ALTERNATIVNYJ external character code of CHAR if appropriate."
42 (aref (char-table-extra-slot
43 (get 'cyrillic-alternativnyj-nonascii-translation-table
51 ;; Written by Valery Alexeev <valery@math.uga.edu>.
53 (defvar cyrillic-language-alist
54 (list '("Belorussian") '("Bulgarian") '("Macedonian")
55 '("Russian") '("Serbo-Croatian") '("Ukrainian"))
56 "List of known cyrillic languages.")
59 (defun standard-display-cyrillic-translit (&optional cyrillic-language
)
60 "Display a cyrillic buffer using a transliteration.
61 For readability, the table is slightly
62 different from the one used for the input method `cyrillic-translit'.
64 The argument is a string which specifies which language you are using;
65 that affects the choice of transliterations slightly.
66 Possible values are listed in `cyrillic-language-alist'.
67 If the argument is t, we use the default cyrillic transliteration.
68 If the argument is nil, we return the display table to its standard state."
71 (let* ((completion-ignore-case t
))
73 "Cyrillic language (default nil): "
74 cyrillic-language-alist nil t nil nil nil
))))
76 (or standard-display-table
77 (setq standard-display-table
(make-display-table)))
79 (if (equal cyrillic-language
"")
80 (setq cyrillic-language nil
))
82 (if (null cyrillic-language
)
83 (setq standard-display-table
(make-display-table))
84 (aset standard-display-table ?
\e,LP
\e(B [?a
])
85 (aset standard-display-table ?
\e,LQ
\e(B [?b
])
86 (aset standard-display-table ?
\e,LR
\e(B [?v
])
87 (aset standard-display-table ?
\e,LS
\e(B [?g
])
88 (aset standard-display-table ?
\e,LT
\e(B [?d
])
89 (aset standard-display-table ?
\e,LU
\e(B [?e
])
90 (aset standard-display-table ?
\e,Lq
\e(B [?y ?o
])
91 (aset standard-display-table ?
\e,LV
\e(B [?z ?h
])
92 (aset standard-display-table ?
\e,LW
\e(B [?z
])
93 (aset standard-display-table ?
\e,LX
\e(B [?i
])
94 (aset standard-display-table ?
\e,LY
\e(B [?j
])
95 (aset standard-display-table ?
\e,LZ
\e(B [?k
])
96 (aset standard-display-table ?
\e,L
[\e(B [?l
])
97 (aset standard-display-table ?
\e,L\
\e(B [?m
])
98 (aset standard-display-table ?
\e,L
]\e(B [?n
])
99 (aset standard-display-table ?
\e,L^
\e(B [?o
])
100 (aset standard-display-table ?
\e,L_
\e(B [?p
])
101 (aset standard-display-table ?
\e,L
`\e(B [?r
])
102 (aset standard-display-table ?
\e,La
\e(B [?s
])
103 (aset standard-display-table ?
\e,Lb
\e(B [?t
])
104 (aset standard-display-table ?
\e,Lc
\e(B [?u
])
105 (aset standard-display-table ?
\e,Ld
\e(B [?f
])
106 (aset standard-display-table ?
\e,Le
\e(B [?k ?h
])
107 (aset standard-display-table ?
\e,Lf
\e(B [?t ?s
])
108 (aset standard-display-table ?
\e,Lg
\e(B [?c ?h
])
109 (aset standard-display-table ?
\e,Lh
\e(B [?s ?h
])
110 (aset standard-display-table ?
\e,Li
\e(B [?s ?c ?h
])
111 (aset standard-display-table ?
\e,Lj
\e(B [?~
])
112 (aset standard-display-table ?
\e,Lk
\e(B [?y
])
113 (aset standard-display-table ?
\e,Ll
\e(B [?
'])
114 (aset standard-display-table ?
\e,Lm
\e(B [?e ?
'])
115 (aset standard-display-table ?
\e,Ln
\e(B [?y ?u
])
116 (aset standard-display-table ?
\e,Lo
\e(B [?y ?a
])
118 (aset standard-display-table ?
\e,L0
\e(B [?A
])
119 (aset standard-display-table ?
\e,L1
\e(B [?B
])
120 (aset standard-display-table ?
\e,L2
\e(B [?V
])
121 (aset standard-display-table ?
\e,L3
\e(B [?G
])
122 (aset standard-display-table ?
\e,L4
\e(B [?D
])
123 (aset standard-display-table ?
\e,L5
\e(B [?E
])
124 (aset standard-display-table ?
\e,L
!\e(B [?Y ?o
])
125 (aset standard-display-table ?
\e,L6
\e(B [?Z ?h
])
126 (aset standard-display-table ?
\e,L7
\e(B [?Z
])
127 (aset standard-display-table ?
\e,L8
\e(B [?I
])
128 (aset standard-display-table ?
\e,L9
\e(B [?J
])
129 (aset standard-display-table ?
\e,L
:\e(B [?K
])
130 (aset standard-display-table ?
\e,L
;\e(B [?L])
131 (aset standard-display-table ?
\e,L
<\e(B [?M
])
132 (aset standard-display-table ?
\e,L
=\e(B [?N
])
133 (aset standard-display-table ?
\e,L
>\e(B [?O
])
134 (aset standard-display-table ?
\e,L?
\e(B [?P
])
135 (aset standard-display-table ?
\e,L
@\e(B [?R
])
136 (aset standard-display-table ?
\e,LA
\e(B [?S
])
137 (aset standard-display-table ?
\e,LB
\e(B [?T
])
138 (aset standard-display-table ?
\e,LC
\e(B [?U
])
139 (aset standard-display-table ?
\e,LD
\e(B [?F
])
140 (aset standard-display-table ?
\e,LE
\e(B [?K ?h
])
141 (aset standard-display-table ?
\e,LF
\e(B [?T ?s
])
142 (aset standard-display-table ?
\e,LG
\e(B [?C ?h
])
143 (aset standard-display-table ?
\e,LH
\e(B [?S ?h
])
144 (aset standard-display-table ?
\e,LI
\e(B [?S ?c ?h
])
145 (aset standard-display-table ?
\e,LJ
\e(B [?~
])
146 (aset standard-display-table ?
\e,LK
\e(B [?Y
])
147 (aset standard-display-table ?
\e,LL
\e(B [?
'])
148 (aset standard-display-table ?
\e,LM
\e(B [?E ?
'])
149 (aset standard-display-table ?
\e,LN
\e(B [?Y ?u
])
150 (aset standard-display-table ?
\e,LO
\e(B [?Y ?a
])
152 (aset standard-display-table ?
\e,Lt
\e(B [?i ?e
])
153 (aset standard-display-table ?
\e,Lw
\e(B [?i
])
154 (aset standard-display-table ?
\e,L~
\e(B [?u
])
155 (aset standard-display-table ?
\e,Lr
\e(B [?d ?j
])
156 (aset standard-display-table ?
\e,L
{\e(B [?c ?h ?j
])
157 (aset standard-display-table ?
\e,Ls
\e(B [?g ?j
])
158 (aset standard-display-table ?
\e,Lu
\e(B [?s
])
159 (aset standard-display-table ?
\e,L|
\e(B [?k
])
160 (aset standard-display-table ?
\e,Lv
\e(B [?i
])
161 (aset standard-display-table ?
\e,Lx
\e(B [?j
])
162 (aset standard-display-table ?
\e,Ly
\e(B [?l ?j
])
163 (aset standard-display-table ?
\e,Lz
\e(B [?n ?j
])
164 (aset standard-display-table ?
\e,L
\x7f\e(B [?d ?z
])
166 (aset standard-display-table ?
\e,L$
\e(B [?Y ?e
])
167 (aset standard-display-table ?
\e,L
'\e(B [?Y ?i
])
168 (aset standard-display-table ?
\e,L.
\e(B [?U
])
169 (aset standard-display-table ?
\e,L
"\e(B [?D ?j])
170 (aset standard-display-table ?\e,L+\e(B [?C ?h ?j])
171 (aset standard-display-table ?\e,L#\e(B [?G ?j])
172 (aset standard-display-table ?\e,L%\e(B [?S])
173 (aset standard-display-table ?\e,L,\e(B [?K])
174 (aset standard-display-table ?\e,L&\e(B [?I])
175 (aset standard-display-table ?\e,L(\e(B [?J])
176 (aset standard-display-table ?\e,L)\e(B [?L ?j])
177 (aset standard-display-table ?\e,L*\e(B [?N ?j])
178 (aset standard-display-table ?\e,L/\e(B [?D ?j])
181 (aset standard-display-table ?\e$,1(P\e(B [?a])
182 (aset standard-display-table ?\e$,1(Q\e(B [?b])
183 (aset standard-display-table ?\e$,1(R\e(B [?v])
184 (aset standard-display-table ?\e$,1(S\e(B [?g])
185 (aset standard-display-table ?\e$,1(T\e(B [?d])
186 (aset standard-display-table ?\e$,1(U\e(B [?e])
187 (aset standard-display-table ?\e$,1(q\e(B [?y ?o])
188 (aset standard-display-table ?\e$,1(V\e(B [?z ?h])
189 (aset standard-display-table ?\e$,1(W\e(B [?z])
190 (aset standard-display-table ?\e$,1(X\e(B [?i])
191 (aset standard-display-table ?\e$,1(Y\e(B [?j])
192 (aset standard-display-table ?\e$,1(Z\e(B [?k])
193 (aset standard-display-table ?\e$,1([\e(B [?l])
194 (aset standard-display-table ?\e$,1(\\e(B [?m])
195 (aset standard-display-table ?\e$,1(]\e(B [?n])
196 (aset standard-display-table ?\e$,1(^\e(B [?o])
197 (aset standard-display-table ?\e$,1(_\e(B [?p])
198 (aset standard-display-table ?\e$,1(`\e(B [?r])
199 (aset standard-display-table ?\e$,1(a\e(B [?s])
200 (aset standard-display-table ?\e$,1(b\e(B [?t])
201 (aset standard-display-table ?\e$,1(c\e(B [?u])
202 (aset standard-display-table ?\e$,1(d\e(B [?f])
203 (aset standard-display-table ?\e$,1(e\e(B [?k ?h])
204 (aset standard-display-table ?\e$,1(f\e(B [?t ?s])
205 (aset standard-display-table ?\e$,1(g\e(B [?c ?h])
206 (aset standard-display-table ?\e$,1(h\e(B [?s ?h])
207 (aset standard-display-table ?\e$,1(i\e(B [?s ?c ?h])
208 (aset standard-display-table ?\e$,1(j\e(B [?~])
209 (aset standard-display-table ?\e$,1(k\e(B [?y])
210 (aset standard-display-table ?\e$,1(l\e(B [?'])
211 (aset standard-display-table ?\e$,1(m\e(B [?e ?'])
212 (aset standard-display-table ?\e$,1(n\e(B [?y ?u])
213 (aset standard-display-table ?\e$,1(o\e(B [?y ?a])
215 (aset standard-display-table ?\e$,1(0\e(B [?A])
216 (aset standard-display-table ?\e$,1(1\e(B [?B])
217 (aset standard-display-table ?\e$,1(2\e(B [?V])
218 (aset standard-display-table ?\e$,1(3\e(B [?G])
219 (aset standard-display-table ?\e$,1(4\e(B [?D])
220 (aset standard-display-table ?\e$,1(5\e(B [?E])
221 (aset standard-display-table ?\e$,1(!\e(B [?Y ?o])
222 (aset standard-display-table ?\e$,1(6\e(B [?Z ?h])
223 (aset standard-display-table ?\e$,1(7\e(B [?Z])
224 (aset standard-display-table ?\e$,1(8\e(B [?I])
225 (aset standard-display-table ?\e$,1(9\e(B [?J])
226 (aset standard-display-table ?\e$,1(:\e(B [?K])
227 (aset standard-display-table ?\e$,1(;\e(B [?L])
228 (aset standard-display-table ?\e$,1(<\e(B [?M])
229 (aset standard-display-table ?\e$,1(=\e(B [?N])
230 (aset standard-display-table ?\e$,1(>\e(B [?O])
231 (aset standard-display-table ?\e$,1(?\e(B [?P])
232 (aset standard-display-table ?\e$,1(@\e(B [?R])
233 (aset standard-display-table ?\e$,1(A\e(B [?S])
234 (aset standard-display-table ?\e$,1(B\e(B [?T])
235 (aset standard-display-table ?\e$,1(C\e(B [?U])
236 (aset standard-display-table ?\e$,1(D\e(B [?F])
237 (aset standard-display-table ?\e$,1(E\e(B [?K ?h])
238 (aset standard-display-table ?\e$,1(F\e(B [?T ?s])
239 (aset standard-display-table ?\e$,1(G\e(B [?C ?h])
240 (aset standard-display-table ?\e$,1(H\e(B [?S ?h])
241 (aset standard-display-table ?\e$,1(I\e(B [?S ?c ?h])
242 (aset standard-display-table ?\e$,1(J\e(B [?~])
243 (aset standard-display-table ?\e$,1(K\e(B [?Y])
244 (aset standard-display-table ?\e$,1(L\e(B [?'])
245 (aset standard-display-table ?\e$,1(M\e(B [?E ?'])
246 (aset standard-display-table ?\e$,1(N\e(B [?Y ?u])
247 (aset standard-display-table ?\e$,1(O\e(B [?Y ?a])
249 (aset standard-display-table ?\e$,1(t\e(B [?i ?e])
250 (aset standard-display-table ?\e$,1(w\e(B [?i])
251 (aset standard-display-table ?\e$,1(~\e(B [?u])
252 (aset standard-display-table ?\e$,1(r\e(B [?d ?j])
253 (aset standard-display-table ?\e$,1({\e(B [?c ?h ?j])
254 (aset standard-display-table ?\e$,1(s\e(B [?g ?j])
255 (aset standard-display-table ?\e$,1(u\e(B [?s])
256 (aset standard-display-table ?\e$,1(|\e(B [?k])
257 (aset standard-display-table ?\e$,1(v\e(B [?i])
258 (aset standard-display-table ?\e$,1(x\e(B [?j])
259 (aset standard-display-table ?\e$,1(y\e(B [?l ?j])
260 (aset standard-display-table ?\e$,1(z\e(B [?n ?j])
261 (aset standard-display-table ?\e$,1(\x7f\e(B [?d ?z])
263 (aset standard-display-table ?\e$,1($\e(B [?Y ?e])
264 (aset standard-display-table ?\e$,1('\e(B [?Y ?i])
265 (aset standard-display-table ?\e$,1(.\e(B [?U])
266 (aset standard-display-table ?\e$,1("\e(B [?D ?j
])
267 (aset standard-display-table ?
\e$
,1(+\e(B [?C ?h ?j
])
268 (aset standard-display-table ?
\e$
,1(#\e(B [?G ?j
])
269 (aset standard-display-table ?
\e$
,1(%
\e(B [?S
])
270 (aset standard-display-table ?
\e$
,1(,\e(B [?K
])
271 (aset standard-display-table ?
\e$
,1(&\e(B [?I
])
272 (aset standard-display-table ?
\e$
,1((\e(B [?J
])
273 (aset standard-display-table ?
\e$
,1()\e(B [?L ?j
])
274 (aset standard-display-table ?
\e$
,1(*\e(B [?N ?j
])
275 (aset standard-display-table ?
\e$
,1(/\e(B [?D ?j
])
277 (when (equal cyrillic-language
"Bulgarian")
278 (aset standard-display-table ?
\e,Li
\e(B [?s ?h ?t
])
279 (aset standard-display-table ?
\e,LI
\e(B [?S ?h ?t
])
280 (aset standard-display-table ?
\e,Ln
\e(B [?i ?u
])
281 (aset standard-display-table ?
\e,LN
\e(B [?I ?u
])
282 (aset standard-display-table ?
\e,Lo
\e(B [?i ?a
])
283 (aset standard-display-table ?
\e,LO
\e(B [?I ?a
])
285 (aset standard-display-table ?
\e$
,1(i\e(B [?s ?h ?t
])
286 (aset standard-display-table ?
\e$
,1(I\e(B [?S ?h ?t
])
287 (aset standard-display-table ?
\e$
,1(n\e(B [?i ?u
])
288 (aset standard-display-table ?
\e$
,1(N\e(B [?I ?u
])
289 (aset standard-display-table ?
\e$
,1(o\e(B [?i ?a
])
290 (aset standard-display-table ?
\e$
,1(O\e(B [?I ?a
]))
292 (when (equal cyrillic-language
"Ukrainian") ; based on the official
293 ; transliteration table
294 (aset standard-display-table ?
\e,LX
\e(B [?y
])
295 (aset standard-display-table ?
\e,L8
\e(B [?Y
])
296 (aset standard-display-table ?
\e,LY
\e(B [?i
])
297 (aset standard-display-table ?
\e,L9
\e(B [?Y
])
298 (aset standard-display-table ?
\e,Ln
\e(B [?i ?u
])
299 (aset standard-display-table ?
\e,Lo
\e(B [?i ?a
])
301 (aset standard-display-table ?
\e$
,1(X\e(B [?y
])
302 (aset standard-display-table ?
\e$
,1(8\e(B [?Y
])
303 (aset standard-display-table ?
\e$
,1(Y\e(B [?i
])
304 (aset standard-display-table ?
\e$
,1(9\e(B [?Y
])
305 (aset standard-display-table ?
\e$
,1(n\e(B [?i ?u
])
306 (aset standard-display-table ?
\e$
,1(o\e(B [?i ?a
]))))
309 (provide 'cyril-util
)
312 ;; coding: iso-2022-7bit
315 ;;; arch-tag: f6d9dd5d-685c-45d6-a5d8-1e2178228b7e
316 ;;; cyril-util.el ends here