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