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