1 ;;; cyril-util.el --- utilities for Cyrillic scripts
3 ;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
5 ;; Keywords: mule, multilingual, Cyrillic
7 ;; This file is part of GNU Emacs.
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 3 of the License, or
12 ;; (at your option) any later version.
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.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
26 ;; Fixme: are the next two useful?
29 (defun cyrillic-encode-koi8-r-char (char)
30 "Return KOI8-R external character code of CHAR if appropriate."
31 (encode-char char
'koi8-r
))
34 (defun cyrillic-encode-alternativnyj-char (char)
35 "Return ALTERNATIVNYJ external character code of CHAR if appropriate."
36 (encode-char char
'alternativnyj
))
41 ;; Written by Valery Alexeev <valery@math.uga.edu>.
43 (defvar cyrillic-language-alist
44 (list '("Belarusian") '("Bulgarian") '("Macedonian")
45 '("Russian") '("Serbo-Croatian") '("Ukrainian"))
46 "List of known cyrillic languages.")
49 (defun standard-display-cyrillic-translit (&optional cyrillic-language
)
50 "Display a cyrillic buffer using a transliteration.
51 For readability, the table is slightly
52 different from the one used for the input method `cyrillic-translit'.
54 The argument is a string which specifies which language you are using;
55 that affects the choice of transliterations slightly.
56 Possible values are listed in `cyrillic-language-alist'.
57 If the argument is t, we use the default cyrillic transliteration.
58 If the argument is nil, we return the display table to its standard state."
61 (let* ((completion-ignore-case t
))
63 "Cyrillic language (default nil): "
64 cyrillic-language-alist nil t nil nil nil
))))
66 (or standard-display-table
67 (setq standard-display-table
(make-display-table)))
69 (if (equal cyrillic-language
"")
70 (setq cyrillic-language nil
))
72 (if (null cyrillic-language
)
73 (setq standard-display-table
(make-display-table))
74 (aset standard-display-table ?а
[?a
])
75 (aset standard-display-table ?б
[?b
])
76 (aset standard-display-table ?в
[?v
])
77 (aset standard-display-table ?г
[?g
])
78 (aset standard-display-table ?д
[?d
])
79 (aset standard-display-table ?е
[?e
])
80 (aset standard-display-table ?ё
[?y ?o
])
81 (aset standard-display-table ?ж
[?z ?h
])
82 (aset standard-display-table ?з
[?z
])
83 (aset standard-display-table ?и
[?i
])
84 (aset standard-display-table ?й
[?j
])
85 (aset standard-display-table ?к
[?k
])
86 (aset standard-display-table ?л
[?l
])
87 (aset standard-display-table ?м
[?m
])
88 (aset standard-display-table ?н
[?n
])
89 (aset standard-display-table ?о
[?o
])
90 (aset standard-display-table ?п
[?p
])
91 (aset standard-display-table ?р
[?r
])
92 (aset standard-display-table ?с
[?s
])
93 (aset standard-display-table ?т
[?t
])
94 (aset standard-display-table ?у
[?u
])
95 (aset standard-display-table ?ф
[?f
])
96 (aset standard-display-table ?х
[?k ?h
])
97 (aset standard-display-table ?ц
[?t ?s
])
98 (aset standard-display-table ?ч
[?c ?h
])
99 (aset standard-display-table ?ш
[?s ?h
])
100 (aset standard-display-table ?щ
[?s ?c ?h
])
101 (aset standard-display-table ?ъ
[?~
])
102 (aset standard-display-table ?ы
[?y
])
103 (aset standard-display-table ?ь
[?
'])
104 (aset standard-display-table ?э
[?e ?
'])
105 (aset standard-display-table ?ю
[?y ?u
])
106 (aset standard-display-table ?я
[?y ?a
])
108 (aset standard-display-table ?А
[?A
])
109 (aset standard-display-table ?Б
[?B
])
110 (aset standard-display-table ?В
[?V
])
111 (aset standard-display-table ?Г
[?G
])
112 (aset standard-display-table ?Д
[?D
])
113 (aset standard-display-table ?Е
[?E
])
114 (aset standard-display-table ?Ё
[?Y ?o
])
115 (aset standard-display-table ?Ж
[?Z ?h
])
116 (aset standard-display-table ?З
[?Z
])
117 (aset standard-display-table ?И
[?I
])
118 (aset standard-display-table ?Й
[?J
])
119 (aset standard-display-table ?К
[?K
])
120 (aset standard-display-table ?Л
[?L
])
121 (aset standard-display-table ?М
[?M
])
122 (aset standard-display-table ?Н
[?N
])
123 (aset standard-display-table ?О
[?O
])
124 (aset standard-display-table ?П
[?P
])
125 (aset standard-display-table ?Р
[?R
])
126 (aset standard-display-table ?С
[?S
])
127 (aset standard-display-table ?Т
[?T
])
128 (aset standard-display-table ?У
[?U
])
129 (aset standard-display-table ?Ф
[?F
])
130 (aset standard-display-table ?Х
[?K ?h
])
131 (aset standard-display-table ?Ц
[?T ?s
])
132 (aset standard-display-table ?Ч
[?C ?h
])
133 (aset standard-display-table ?Ш
[?S ?h
])
134 (aset standard-display-table ?Щ
[?S ?c ?h
])
135 (aset standard-display-table ?Ъ
[?~
])
136 (aset standard-display-table ?Ы
[?Y
])
137 (aset standard-display-table ?Ь
[?
'])
138 (aset standard-display-table ?Э
[?E ?
'])
139 (aset standard-display-table ?Ю
[?Y ?u
])
140 (aset standard-display-table ?Я
[?Y ?a
])
142 (aset standard-display-table ?є
[?i ?e
])
143 (aset standard-display-table ?ї
[?i
])
144 (aset standard-display-table ?ў
[?u
])
145 (aset standard-display-table ?ђ
[?d ?j
])
146 (aset standard-display-table ?ћ
[?c ?h ?j
])
147 (aset standard-display-table ?ѓ
[?g ?j
])
148 (aset standard-display-table ?ѕ
[?s
])
149 (aset standard-display-table ?ќ
[?k
])
150 (aset standard-display-table ?і
[?i
])
151 (aset standard-display-table ?ј
[?j
])
152 (aset standard-display-table ?љ
[?l ?j
])
153 (aset standard-display-table ?њ
[?n ?j
])
154 (aset standard-display-table ?џ
[?d ?z
])
156 (aset standard-display-table ?Є
[?Y ?e
])
157 (aset standard-display-table ?Ї
[?Y ?i
])
158 (aset standard-display-table ?Ў
[?U
])
159 (aset standard-display-table ?Ђ
[?D ?j
])
160 (aset standard-display-table ?Ћ
[?C ?h ?j
])
161 (aset standard-display-table ?Ѓ
[?G ?j
])
162 (aset standard-display-table ?Ѕ
[?S
])
163 (aset standard-display-table ?Ќ
[?K
])
164 (aset standard-display-table ?І
[?I
])
165 (aset standard-display-table ?Ј
[?J
])
166 (aset standard-display-table ?Љ
[?L ?j
])
167 (aset standard-display-table ?Њ
[?N ?j
])
168 (aset standard-display-table ?Џ
[?D ?j
])
170 (when (equal cyrillic-language
"Bulgarian")
171 (aset standard-display-table ?щ
[?s ?h ?t
])
172 (aset standard-display-table ?Щ
[?S ?h ?t
])
173 (aset standard-display-table ?ю
[?i ?u
])
174 (aset standard-display-table ?Ю
[?I ?u
])
175 (aset standard-display-table ?я
[?i ?a
])
176 (aset standard-display-table ?Я
[?I ?a
]))
178 (when (equal cyrillic-language
"Ukrainian") ; based on the official
179 ; transliteration table
180 (aset standard-display-table ?и
[?y
])
181 (aset standard-display-table ?И
[?Y
])
182 (aset standard-display-table ?й
[?i
])
183 (aset standard-display-table ?Й
[?Y
])
184 (aset standard-display-table ?ю
[?i ?u
])
185 (aset standard-display-table ?я
[?i ?a
]))))
188 (provide 'cyril-util
)
194 ;;; cyril-util.el ends here