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