Backport 2010-03-25T08:48:52Z!mituharu@math.s.chiba-u.ac.jp from trunk
[emacs.git] / lisp / language / cyril-util.el
blob0968746642c13a08344a8b34dde3bbb221689663
1 ;;; cyril-util.el --- utilities for Cyrillic scripts
3 ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008, 2009, 2010 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 of the License, or
13 ;; (at your option) any later version.
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. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Commentary:
25 ;;; Code:
27 ;; Fixme: are the next two useful?
29 ;;;###autoload
30 (defun cyrillic-encode-koi8-r-char (char)
31 "Return KOI8-R external character code of CHAR if appropriate."
32 (encode-char char 'koi8-r))
34 ;;;###autoload
35 (defun cyrillic-encode-alternativnyj-char (char)
36 "Return ALTERNATIVNYJ external character code of CHAR if appropriate."
37 (encode-char char 'alternativnyj))
40 ;; Display
42 ;; Written by Valery Alexeev <valery@math.uga.edu>.
44 (defvar cyrillic-language-alist
45 (list '("Belorussian") '("Bulgarian") '("Macedonian")
46 '("Russian") '("Serbo-Croatian") '("Ukrainian"))
47 "List of known cyrillic languages.")
49 ;;;###autoload
50 (defun standard-display-cyrillic-translit (&optional cyrillic-language)
51 "Display a cyrillic buffer using a transliteration.
52 For readability, the table is slightly
53 different from the one used for the input method `cyrillic-translit'.
55 The argument is a string which specifies which language you are using;
56 that affects the choice of transliterations slightly.
57 Possible values are listed in `cyrillic-language-alist'.
58 If the argument is t, we use the default cyrillic transliteration.
59 If the argument is nil, we return the display table to its standard state."
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))))
67 (or standard-display-table
68 (setq standard-display-table (make-display-table)))
70 (if (equal cyrillic-language "")
71 (setq cyrillic-language nil))
73 (if (null cyrillic-language)
74 (setq standard-display-table (make-display-table))
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])
81 (aset standard-display-table ?\e,Lq\e(B [?y ?o])
82 (aset standard-display-table ?\e,LV\e(B [?z ?h])
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])
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])
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 [?'])
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])
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])
115 (aset standard-display-table ?\e,L!\e(B [?Y ?o])
116 (aset standard-display-table ?\e,L6\e(B [?Z ?h])
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])
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])
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 [?'])
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])
143 (aset standard-display-table ?\e,Lt\e(B [?i ?e])
144 (aset standard-display-table ?\e,Lw\e(B [?i])
145 (aset standard-display-table ?\e,L~\e(B [?u])
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])
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])
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\x7f\e(B [?d ?z])
157 (aset standard-display-table ?\e,L$\e(B [?Y ?e])
158 (aset standard-display-table ?\e,L'\e(B [?Y ?i])
159 (aset standard-display-table ?\e,L.\e(B [?U])
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])
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])
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])
171 (when (equal cyrillic-language "Bulgarian")
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])
177 (aset standard-display-table ?\e,LO\e(B [?I ?a]))
179 (when (equal cyrillic-language "Ukrainian") ; based on the official
180 ; transliteration table
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])
185 (aset standard-display-table ?\e,Ln\e(B [?i ?u])
186 (aset standard-display-table ?\e,Lo\e(B [?i ?a]))))
189 (provide 'cyril-util)
191 ;; Local Variables:
192 ;; coding: iso-2022-7bit
193 ;; End:
195 ;; arch-tag: f6d9dd5d-685c-45d6-a5d8-1e2178228b7e
196 ;;; cyril-util.el ends here