("UTF-8"): Add preferred charsets.
[bpt/emacs.git] / lisp / language / cyril-util.el
CommitLineData
60370d40 1;;; cyril-util.el --- utilities for Cyrillic scripts
d6c7b552 2
d4877ac1 3;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005,
38141d20 4;; 2006, 2007, 2008 Free Software Foundation, Inc.
d6c7b552
KH
5
6;; Keywords: mule, multilingual, Cyrillic
7
8;; This file is part of GNU Emacs.
9
4936186e 10;; GNU Emacs is free software: you can redistribute it and/or modify
d6c7b552 11;; it under the terms of the GNU General Public License as published by
4936186e
GM
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
d6c7b552
KH
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
4936186e 21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
d6c7b552 22
60370d40
PJ
23;;; Commentary:
24
d6c7b552
KH
25;;; Code:
26
e65186d5
DL
27;; Fixme: are the next two useful?
28
ce58d9b4
KH
29;;;###autoload
30(defun cyrillic-encode-koi8-r-char (char)
31 "Return KOI8-R external character code of CHAR if appropriate."
c603680d 32 (encode-char char 'koi8-r))
ce58d9b4
KH
33
34;;;###autoload
35(defun cyrillic-encode-alternativnyj-char (char)
36 "Return ALTERNATIVNYJ external character code of CHAR if appropriate."
c603680d 37 (encode-char char 'alternativnyj))
ce58d9b4 38
71ed4992 39\f
a1970a1d 40;; Display
71ed4992
RS
41
42;; Written by Valery Alexeev <valery@math.uga.edu>.
43
7286c88e 44(defvar cyrillic-language-alist
a1970a1d 45 (list '("Belorussian") '("Bulgarian") '("Macedonian")
f58bb396 46 '("Russian") '("Serbo-Croatian") '("Ukrainian"))
a1970a1d 47 "List of known cyrillic languages.")
7286c88e 48
7286c88e
KH
49;;;###autoload
50(defun standard-display-cyrillic-translit (&optional cyrillic-language)
71ed4992
RS
51 "Display a cyrillic buffer using a transliteration.
52For readability, the table is slightly
53different from the one used for the input method `cyrillic-translit'.
54
7286c88e 55The argument is a string which specifies which language you are using;
71ed4992 56that affects the choice of transliterations slightly.
a1970a1d 57Possible values are listed in `cyrillic-language-alist'.
7286c88e 58If the argument is t, we use the default cyrillic transliteration.
71ed4992 59If the argument is nil, we return the display table to its standard state."
2631431f
RS
60 (interactive
61 (list
62 (let* ((completion-ignore-case t))
63 (completing-read
64 "Cyrillic language (default nil): "
65 cyrillic-language-alist nil t nil nil nil))))
66
67 (or standard-display-table
68 (setq standard-display-table (make-display-table)))
7286c88e
KH
69
70 (if (equal cyrillic-language "")
71 (setq cyrillic-language nil))
72
71ed4992
RS
73 (if (null cyrillic-language)
74 (setq standard-display-table (make-display-table))
7286c88e
KH
75 (aset standard-display-table ?\e,LP\e(B [?a])
76 (aset standard-display-table ?\e,LQ\e(B [?b])
77 (aset standard-display-table ?\e,LR\e(B [?v])
78 (aset standard-display-table ?\e,LS\e(B [?g])
79 (aset standard-display-table ?\e,LT\e(B [?d])
80 (aset standard-display-table ?\e,LU\e(B [?e])
e29bddc1
JB
81 (aset standard-display-table ?\e,Lq\e(B [?y ?o])
82 (aset standard-display-table ?\e,LV\e(B [?z ?h])
7286c88e
KH
83 (aset standard-display-table ?\e,LW\e(B [?z])
84 (aset standard-display-table ?\e,LX\e(B [?i])
85 (aset standard-display-table ?\e,LY\e(B [?j])
86 (aset standard-display-table ?\e,LZ\e(B [?k])
87 (aset standard-display-table ?\e,L[\e(B [?l])
88 (aset standard-display-table ?\e,L\\e(B [?m])
89 (aset standard-display-table ?\e,L]\e(B [?n])
90 (aset standard-display-table ?\e,L^\e(B [?o])
91 (aset standard-display-table ?\e,L_\e(B [?p])
92 (aset standard-display-table ?\e,L`\e(B [?r])
93 (aset standard-display-table ?\e,La\e(B [?s])
94 (aset standard-display-table ?\e,Lb\e(B [?t])
95 (aset standard-display-table ?\e,Lc\e(B [?u])
96 (aset standard-display-table ?\e,Ld\e(B [?f])
e29bddc1
JB
97 (aset standard-display-table ?\e,Le\e(B [?k ?h])
98 (aset standard-display-table ?\e,Lf\e(B [?t ?s])
99 (aset standard-display-table ?\e,Lg\e(B [?c ?h])
100 (aset standard-display-table ?\e,Lh\e(B [?s ?h])
101 (aset standard-display-table ?\e,Li\e(B [?s ?c ?h])
7286c88e
KH
102 (aset standard-display-table ?\e,Lj\e(B [?~])
103 (aset standard-display-table ?\e,Lk\e(B [?y])
104 (aset standard-display-table ?\e,Ll\e(B [?'])
e29bddc1
JB
105 (aset standard-display-table ?\e,Lm\e(B [?e ?'])
106 (aset standard-display-table ?\e,Ln\e(B [?y ?u])
107 (aset standard-display-table ?\e,Lo\e(B [?y ?a])
a1506d29 108
7286c88e
KH
109 (aset standard-display-table ?\e,L0\e(B [?A])
110 (aset standard-display-table ?\e,L1\e(B [?B])
111 (aset standard-display-table ?\e,L2\e(B [?V])
112 (aset standard-display-table ?\e,L3\e(B [?G])
113 (aset standard-display-table ?\e,L4\e(B [?D])
114 (aset standard-display-table ?\e,L5\e(B [?E])
e29bddc1
JB
115 (aset standard-display-table ?\e,L!\e(B [?Y ?o])
116 (aset standard-display-table ?\e,L6\e(B [?Z ?h])
7286c88e
KH
117 (aset standard-display-table ?\e,L7\e(B [?Z])
118 (aset standard-display-table ?\e,L8\e(B [?I])
119 (aset standard-display-table ?\e,L9\e(B [?J])
120 (aset standard-display-table ?\e,L:\e(B [?K])
121 (aset standard-display-table ?\e,L;\e(B [?L])
122 (aset standard-display-table ?\e,L<\e(B [?M])
123 (aset standard-display-table ?\e,L=\e(B [?N])
124 (aset standard-display-table ?\e,L>\e(B [?O])
125 (aset standard-display-table ?\e,L?\e(B [?P])
126 (aset standard-display-table ?\e,L@\e(B [?R])
127 (aset standard-display-table ?\e,LA\e(B [?S])
128 (aset standard-display-table ?\e,LB\e(B [?T])
129 (aset standard-display-table ?\e,LC\e(B [?U])
130 (aset standard-display-table ?\e,LD\e(B [?F])
e29bddc1
JB
131 (aset standard-display-table ?\e,LE\e(B [?K ?h])
132 (aset standard-display-table ?\e,LF\e(B [?T ?s])
133 (aset standard-display-table ?\e,LG\e(B [?C ?h])
134 (aset standard-display-table ?\e,LH\e(B [?S ?h])
135 (aset standard-display-table ?\e,LI\e(B [?S ?c ?h])
7286c88e
KH
136 (aset standard-display-table ?\e,LJ\e(B [?~])
137 (aset standard-display-table ?\e,LK\e(B [?Y])
138 (aset standard-display-table ?\e,LL\e(B [?'])
e29bddc1
JB
139 (aset standard-display-table ?\e,LM\e(B [?E ?'])
140 (aset standard-display-table ?\e,LN\e(B [?Y ?u])
141 (aset standard-display-table ?\e,LO\e(B [?Y ?a])
a1970a1d 142
e29bddc1 143 (aset standard-display-table ?\e,Lt\e(B [?i ?e])
7286c88e
KH
144 (aset standard-display-table ?\e,Lw\e(B [?i])
145 (aset standard-display-table ?\e,L~\e(B [?u])
e29bddc1
JB
146 (aset standard-display-table ?\e,Lr\e(B [?d ?j])
147 (aset standard-display-table ?\e,L{\e(B [?c ?h ?j])
148 (aset standard-display-table ?\e,Ls\e(B [?g ?j])
7286c88e
KH
149 (aset standard-display-table ?\e,Lu\e(B [?s])
150 (aset standard-display-table ?\e,L|\e(B [?k])
151 (aset standard-display-table ?\e,Lv\e(B [?i])
152 (aset standard-display-table ?\e,Lx\e(B [?j])
e29bddc1
JB
153 (aset standard-display-table ?\e,Ly\e(B [?l ?j])
154 (aset standard-display-table ?\e,Lz\e(B [?n ?j])
155 (aset standard-display-table ?\e,L\7f\e(B [?d ?z])
a1970a1d 156
e29bddc1
JB
157 (aset standard-display-table ?\e,L$\e(B [?Y ?e])
158 (aset standard-display-table ?\e,L'\e(B [?Y ?i])
7286c88e 159 (aset standard-display-table ?\e,L.\e(B [?U])
e29bddc1
JB
160 (aset standard-display-table ?\e,L"\e(B [?D ?j])
161 (aset standard-display-table ?\e,L+\e(B [?C ?h ?j])
162 (aset standard-display-table ?\e,L#\e(B [?G ?j])
7286c88e
KH
163 (aset standard-display-table ?\e,L%\e(B [?S])
164 (aset standard-display-table ?\e,L,\e(B [?K])
165 (aset standard-display-table ?\e,L&\e(B [?I])
166 (aset standard-display-table ?\e,L(\e(B [?J])
e29bddc1
JB
167 (aset standard-display-table ?\e,L)\e(B [?L ?j])
168 (aset standard-display-table ?\e,L*\e(B [?N ?j])
169 (aset standard-display-table ?\e,L/\e(B [?D ?j])
a1970a1d 170
7286c88e 171 (when (equal cyrillic-language "Bulgarian")
e29bddc1
JB
172 (aset standard-display-table ?\e,Li\e(B [?s ?h ?t])
173 (aset standard-display-table ?\e,LI\e(B [?S ?h ?t])
174 (aset standard-display-table ?\e,Ln\e(B [?i ?u])
175 (aset standard-display-table ?\e,LN\e(B [?I ?u])
176 (aset standard-display-table ?\e,Lo\e(B [?i ?a])
8f924df7 177 (aset standard-display-table ?\e,LO\e(B [?I ?a]))
a1970a1d
RS
178
179 (when (equal cyrillic-language "Ukrainian") ; based on the official
71ed4992 180 ; transliteration table
7286c88e
KH
181 (aset standard-display-table ?\e,LX\e(B [?y])
182 (aset standard-display-table ?\e,L8\e(B [?Y])
183 (aset standard-display-table ?\e,LY\e(B [?i])
184 (aset standard-display-table ?\e,L9\e(B [?Y])
e29bddc1 185 (aset standard-display-table ?\e,Ln\e(B [?i ?u])
8f924df7 186 (aset standard-display-table ?\e,Lo\e(B [?i ?a]))))
d6c7b552 187
d6c7b552 188;;
9e9af2e9 189(provide 'cyril-util)
d6c7b552 190
7286c88e 191;; Local Variables:
e7509bdd 192;; coding: iso-2022-7bit
7286c88e 193;; End:
60370d40 194
cbee283d 195;; arch-tag: f6d9dd5d-685c-45d6-a5d8-1e2178228b7e
60370d40 196;;; cyril-util.el ends here