Mercurial > emacs
annotate lisp/language/ethio-util.el @ 37645:3fa9dd549e89
(archive-int-to-mode): Construct the string directly.
(archive-mode): Use capitalize.
(archive-unique-fname): Use make-temp-file.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 09 May 2001 20:28:23 +0000 |
parents | b82a6fbaae16 |
children | b174db545cfd |
rev | line source |
---|---|
36683
b82a6fbaae16
Add coding: iso-2022-7bit tag.
Kenichi Handa <handa@m17n.org>
parents:
36536
diff
changeset
|
1 ;;; ethio-util.el --- utilities for Ethiopic -*- coding: iso-2022-7bit; -*- |
17052 | 2 |
36426
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
3 ;; Copyright (C) 1997, 2001 Electrotechnical Laboratory, JAPAN. |
18377
8b4a66c66dd6
Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
18306
diff
changeset
|
4 ;; Licensed to the Free Software Foundation. |
17052 | 5 |
17299 | 6 ;; Keywords: mule, multilingual, Ethiopic |
17052 | 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 | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
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 | |
17314
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17299
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17299
diff
changeset
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17299
diff
changeset
|
23 ;; Boston, MA 02111-1307, USA. |
17299 | 24 |
36426
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
25 ;; Author: TAKAHASHI Naoto <ntakahas@m17n.org> |
17052 | 26 |
27 ;;; Code: | |
28 | |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
29 ;; Information for exiting Ethiopic environment. |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
30 (defvar exit-ethiopic-environment-data nil) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
31 |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17774
diff
changeset
|
32 ;;;###autoload |
22987
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22519
diff
changeset
|
33 (defun setup-ethiopic-environment-internal () |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
34 (let ((key-bindings '((" " . ethio-insert-space) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
35 ([?\S- ] . ethio-insert-ethio-space) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
36 ([?\C-'] . ethio-gemination) |
36426
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
37 |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
38 ;; these old bindings conflict |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
39 ;; with Emacs' binding policy |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
40 |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
41 ;; ([f2] . ethio-toggle-space) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
42 ;; ([S-f2] . ethio-replace-space) ; as requested |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
43 ;; ([f3] . ethio-toggle-punctuation) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
44 ;; ([f4] . ethio-sera-to-fidel-buffer) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
45 ;; ([S-f4] . ethio-sera-to-fidel-region) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
46 ;; ([C-f4] . ethio-sera-to-fidel-mail-or-marker) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
47 ;; ([f5] . ethio-fidel-to-sera-buffer) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
48 ;; ([S-f5] . ethio-fidel-to-sera-region) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
49 ;; ([C-f5] . ethio-fidel-to-sera-mail-or-marker) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
50 ;; ([f6] . ethio-modify-vowel) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
51 ;; ([f7] . ethio-replace-space) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
52 ;; ([f8] . ethio-input-special-character) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
53 |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
54 ;; this is the rewritten bindings |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
55 |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
56 ([f3] . ethio-fidel-to-sera-buffer) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
57 ([S-f3] . ethio-fidel-to-sera-region) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
58 ([C-f3] . ethio-fidel-to-sera-mail-or-marker) |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
59 ([f4] . ethio-sera-to-fidel-buffer) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
60 ([S-f4] . ethio-sera-to-fidel-region) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
61 ([C-f4] . ethio-sera-to-fidel-mail-or-marker) |
36426
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
62 ([S-f5] . ethio-toggle-punctuation) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
63 ([S-f6] . ethio-modify-vowel) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
64 ([S-f7] . ethio-replace-space) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
65 ([S-f8] . ethio-input-special-character) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
66 ([C-f9] . ethio-toggle-space) |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
67 ([S-f9] . ethio-replace-space) ; as requested |
abbed5d59665
(setup-ethiopic-environment-internal): Change bindings of functions
Kenichi Handa <handa@m17n.org>
parents:
28906
diff
changeset
|
68 )) |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
69 kb) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
70 (while key-bindings |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
71 (setq kb (car (car key-bindings))) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
72 (setq exit-ethiopic-environment-data |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
73 (cons (cons kb (global-key-binding kb)) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
74 exit-ethiopic-environment-data)) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
75 (global-set-key kb (cdr (car key-bindings))) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
76 (setq key-bindings (cdr key-bindings)))) |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17774
diff
changeset
|
77 |
24844
ab5f0d0f5e9a
(setup-ethiopic-environment-internal):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
78 (add-hook 'quail-activate-hook 'ethio-select-a-translation) |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
79 (add-hook 'find-file-hooks 'ethio-find-file) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
80 (add-hook 'write-file-hooks 'ethio-write-file) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
81 (add-hook 'after-save-hook 'ethio-find-file)) |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17774
diff
changeset
|
82 |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
83 (defun exit-ethiopic-environment () |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
84 "Exit Ethiopic language environment" |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
85 (while exit-ethiopic-environment-data |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
86 (global-set-key (car (car exit-ethiopic-environment-data)) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
87 (cdr (car exit-ethiopic-environment-data))) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
88 (setq exit-ethiopic-environment-data |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
89 (cdr exit-ethiopic-environment-data))) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
90 |
24844
ab5f0d0f5e9a
(setup-ethiopic-environment-internal):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
91 (remove-hook 'quail-activate-hook 'ethio-select-a-translation) |
22519
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
92 (remove-hook 'find-file-hooks 'ethio-find-file) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
93 (remove-hook 'write-file-hooks 'ethio-write-file) |
a4913922e131
Delete codes for ethio-mode, which
Kenichi Handa <handa@m17n.org>
parents:
21871
diff
changeset
|
94 (remove-hook 'after-save-hook 'ethio-find-file)) |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17774
diff
changeset
|
95 |
17052 | 96 ;; |
97 ;; ETHIOPIC UTILITY FUNCTIONS | |
98 ;; | |
99 | |
17299 | 100 ;; If the filename ends in ".sera", editing is done in fidel |
101 ;; but file I/O is done in SERA. | |
102 ;; | |
103 ;; If the filename ends in ".java", editing is done in fidel | |
104 ;; but file I/O is done in the \uXXXX style, where XXXX is | |
105 ;; the Unicode codepoint for the Ethiopic character. | |
106 ;; | |
107 ;; If the filename ends in ".tex", editing is done in fidel | |
108 ;; but file I/O is done in EthioTeX format. | |
109 ;; | |
17052 | 110 ;; To automatically convert Ethiopic text to SERA format when sending mail, |
17299 | 111 ;; (add-hook 'mail-send-hook 'ethio-fidel-to-sera-mail) |
17052 | 112 ;; |
113 ;; To automatically convert SERA format to Ethiopic when receiving mail, | |
17299 | 114 ;; (add-hook 'rmail-show-message-hook 'ethio-sera-to-fidel-mail) |
17052 | 115 ;; |
116 ;; To automatically convert Ethiopic text to SERA format when posting news, | |
17299 | 117 ;; (add-hook 'news-inews-hook 'ethio-fidel-to-sera-mail) |
118 | |
119 ;; | |
120 ;; users' preference | |
17052 | 121 ;; |
17299 | 122 |
123 (defvar ethio-primary-language 'tigrigna | |
124 "*Symbol that defines the primary language in SERA --> FIDEL conversion. | |
125 The value should be one of: `tigrigna', `amharic' or `english'.") | |
126 | |
127 (defvar ethio-secondary-language 'english | |
128 "*Symbol that defines the secondary language in SERA --> FIDEL conversion. | |
129 The value should be one of: `tigrigna', `amharic' or `english'.") | |
130 | |
131 (defvar ethio-use-colon-for-colon nil | |
132 "*Non-nil means associate ASCII colon with Ethiopic colon. | |
133 If nil, associate ASCII colon with Ethiopic word separator, i.e., two | |
134 vertically stacked dots. All SERA <--> FIDEL converters refer this | |
135 variable.") | |
136 | |
137 (defvar ethio-use-three-dot-question nil | |
138 "*Non-nil means associate ASCII question mark with Ethiopic old style question mark (three vertically stacked dots). | |
139 If nil, associate ASCII question mark with Ethiopic stylised question | |
140 mark. All SERA <--> FIDEL converters refer this variable.") | |
141 | |
142 (defvar ethio-quote-vowel-always nil | |
143 "*Non-nil means always put an apostrophe before an isolated vowel (except at word initial) in FIDEL --> SERA conversion. | |
144 If nil, put an apostrophe only between a sixth-form consonant and an | |
145 isolated vowel.") | |
146 | |
147 (defvar ethio-W-sixth-always nil | |
148 "*Non-nil means convert the Wu-form of a 12-form consonant to \"W'\" instead of \"Wu\" in FIDEL --> SERA conversion.") | |
149 | |
150 (defvar ethio-numeric-reduction 0 | |
151 "*Degree of reduction in converting Ethiopic digits into Arabic digits. | |
152 Should be 0, 1 or 2. | |
153 For example, ({10}{9}{100}{80}{7}) is converted into: | |
154 `10`9`100`80`7 if `ethio-numeric-reduction' is 0, | |
155 `109100807 if `ethio-numeric-reduction' is 1, | |
156 `10900807 if `ethio-numeric-reduction' is 2.") | |
157 | |
158 (defvar ethio-implicit-period-conversion t | |
159 "*Non-nil means replacing the Ethiopic dot at the end of an Ethiopic sentence | |
160 with an Ethiopic full stop.") | |
161 | |
162 (defvar ethio-java-save-lowercase nil | |
163 "*Non-nil means save Ethiopic characters in lowercase hex numbers to Java files. | |
164 If nil, use uppercases.") | |
17052 | 165 |
166 ;; | |
167 ;; SERA to FIDEL | |
168 ;; | |
17299 | 169 |
170 (defconst ethio-sera-to-fidel-table | |
17052 | 171 [ |
172 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil | |
173 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil | |
17299 | 174 ;;; SP |
175 (" " | |
176 (?: (if ethio-use-colon-for-colon " $(3$l(B" "$(3$h(B") | |
177 (32 (if ethio-use-colon-for-colon " $(3$l(B " "$(3$h(B")) | |
178 (?- " $(3$m(B") | |
179 (?: " $(3$i(B") | |
180 (?| (if ethio-use-colon-for-colon " $(3$l(B|" " $(3$h(B|") | |
181 (?: " $(3$o(B")))) | |
182 | |
183 ;;; ! " # $ % & ' | |
184 nil nil nil nil nil nil ("" (?' "$(3%s(B")) | |
185 ;;; ( ) * + , - . | |
186 nil nil nil nil ("$(3$j(B") ("-" (?: "$(3$l(B")) ("$(3%u(B") | |
187 ;;; / 0 1 2 3 4 5 6 7 8 9 | |
188 nil nil nil nil nil nil nil nil nil nil nil | |
189 ;;; : | |
190 ((if ethio-use-colon-for-colon "$(3$l(B" "$(3$h(B") | |
191 (32 (if ethio-use-colon-for-colon "$(3$l(B " "$(3$h(B")) | |
192 (?- "$(3$m(B") | |
193 (?: "$(3$i(B") | |
194 (?| (if ethio-use-colon-for-colon "$(3$l(B|" "$(3$h(B|") | |
195 (?: "$(3$o(B"))) | |
196 ;;; ; < = > | |
197 ("$(3$k(B") ("<" (?< "$(3%v(B")) nil (">" (?> "$(3%w(B")) | |
198 ;;; ? | |
199 ((if ethio-use-three-dot-question "$(3$n(B" "$(3%x(B")) | |
200 ;;; @ | |
201 nil | |
17052 | 202 ;;; A |
17299 | 203 ("$(3"f(B" (?2 "$(3#8(B")) |
17052 | 204 ;;; B |
17299 | 205 ("$(3"((B" (?e "$(3"#(B") (?u "$(3"$(B") (?i "$(3"%(B") (?a "$(3"&(B") (?E "$(3"'(B") (?o "$(3")(B") |
206 (?W "$(3%b(B" (?e "$(3%2(B") (?u "$(3%b(B") (?i "$(3%B(B") (?a "$(3"*(B") (?E "$(3%R(B"))) | |
17052 | 207 ;;; C |
17299 | 208 ("$(3$4(B" (?e "$(3$/(B") (?u "$(3$0(B") (?i "$(3$1(B") (?a "$(3$2(B") (?E "$(3$3(B") (?o "$(3$5(B") |
209 (?W "$(3$6(B" (?a "$(3$6(B") | |
210 (?e "$(3$4%n(B") (?u "$(3$4%r(B") (?i "$(3$4%o(B") (?E "$(3$4%q(B"))) | |
17052 | 211 ;;; D |
17299 | 212 ("$(3#b(B" (?e "$(3#](B") (?u "$(3#^(B") (?i "$(3#_(B") (?a "$(3#`(B") (?E "$(3#a(B") (?o "$(3#c(B") |
213 (?W "$(3#d(B" (?a "$(3#d(B") | |
214 (?e "$(3#b%n(B") (?u "$(3#b%r(B") (?i "$(3#b%o(B") (?E "$(3#b%q(B"))) | |
17052 | 215 ;;; E |
17299 | 216 ("$(3"g(B" (?2 "$(3#9(B")) |
17052 | 217 ;;; F |
17299 | 218 ("$(3$T(B" (?e "$(3$O(B") (?u "$(3$P(B") (?i "$(3$Q(B") (?a "$(3$R(B") (?E "$(3$S(B") (?o "$(3$U(B") |
219 (?W "$(3%d(B" (?e "$(3%4(B") (?u "$(3%d(B") (?i "$(3%D(B") (?a "$(3$V(B") (?E "$(3%T(B")) | |
220 (?Y "$(3$a(B" (?a "$(3$a(B"))) | |
17052 | 221 ;;; G |
17299 | 222 ("$(3$$(B" (?e "$(3#}(B") (?u "$(3#~(B") (?i "$(3$!(B") (?a "$(3$"(B") (?E "$(3$#(B") (?o "$(3$%(B") |
223 (?W "$(3%c(B" (?e "$(3%3(B") (?u "$(3%c(B") (?i "$(3%C(B") (?a "$(3$&(B") (?E "$(3%S(B"))) | |
17052 | 224 ;;; H |
17299 | 225 ("$(3!6(B" (?e "$(3!1(B") (?u "$(3!2(B") (?i "$(3!3(B") (?a "$(3!4(B") (?E "$(3!5(B") (?o "$(3!7(B") |
226 (?W "$(3!8(B" (?a "$(3!8(B") | |
227 (?e "$(3!6%n(B") (?u "$(3!6%r(B") (?i "$(3!6%o(B") (?E "$(3!6%q(B"))) | |
17052 | 228 ;;; I |
17299 | 229 ("$(3"h(B" (?2 "$(3#:(B")) |
17052 | 230 ;;; J |
17299 | 231 ("$(3#j(B" (?e "$(3#e(B") (?u "$(3#f(B") (?i "$(3#g(B") (?a "$(3#h(B") (?E "$(3#i(B") (?o "$(3#k(B") |
232 (?W "$(3#l(B" (?a "$(3#l(B") | |
233 (?e "$(3#j%n(B") (?u "$(3#j%r(B") (?i "$(3#j%o(B") (?E "$(3#j%q(B"))) | |
17052 | 234 ;;; K |
17299 | 235 ("$(3#"(B" (?e "$(3"{(B") (?u "$(3"|(B") (?i "$(3"}(B") (?a "$(3"~(B") (?E "$(3#!(B") (?o "$(3##(B") |
236 (?W "$(3#*(B" (?e "$(3#%(B") (?u "$(3#*(B") (?i "$(3#'(B") (?a "$(3#((B") (?E "$(3#)(B"))) | |
17052 | 237 ;;; L |
17299 | 238 ("$(3!.(B" (?e "$(3!)(B") (?u "$(3!*(B") (?i "$(3!+(B") (?a "$(3!,(B") (?E "$(3!-(B") (?o "$(3!/(B") |
239 (?W "$(3!0(B" (?a "$(3!0(B") | |
240 (?e "$(3!.%n(B") (?u "$(3!.%r(B") (?i "$(3!.%o(B") (?E "$(3!.%q(B"))) | |
17052 | 241 ;;; M |
17299 | 242 ("$(3!>(B" (?e "$(3!9(B") (?u "$(3!:(B") (?i "$(3!;(B") (?a "$(3!<(B") (?E "$(3!=(B") (?o "$(3!?(B") |
243 (?W "$(3%a(B" (?e "$(3%1(B") (?u "$(3%a(B") (?i "$(3%A(B") (?a "$(3!@(B") (?E "$(3%Q(B")) | |
244 (?Y "$(3$_(B" (?a "$(3$_(B"))) | |
17052 | 245 ;;; N |
17299 | 246 ("$(3"`(B" (?e "$(3"[(B") (?u "$(3"\(B") (?i "$(3"](B") (?a "$(3"^(B") (?E "$(3"_(B") (?o "$(3"a(B") |
247 (?W "$(3"b(B" (?a "$(3"b(B") | |
248 (?e "$(3"`%n(B") (?u "$(3"`%r(B") (?i "$(3"`%o(B") (?E "$(3"`%q(B"))) | |
17052 | 249 ;;; O |
17299 | 250 ("$(3"i(B" (?2 "$(3#;(B")) |
17052 | 251 ;;; P |
17299 | 252 ("$(3$<(B" (?e "$(3$7(B") (?u "$(3$8(B") (?i "$(3$9(B") (?a "$(3$:(B") (?E "$(3$;(B") (?o "$(3$=(B") |
253 (?W "$(3$>(B" (?a "$(3$>(B") | |
254 (?e "$(3$<%n(B") (?u "$(3$<%r(B") (?i "$(3$<%o(B") (?E "$(3$<%q(B"))) | |
17052 | 255 ;;; Q |
17299 | 256 ("$(3!v(B" (?e "$(3!q(B") (?u "$(3!r(B") (?i "$(3!s(B") (?a "$(3!t(B") (?E "$(3!u(B") (?o "$(3!w(B") |
257 (?W "$(3!~(B" (?e "$(3!y(B") (?u "$(3!~(B") (?i "$(3!{(B") (?a "$(3!|(B") (?E "$(3!}(B"))) | |
17052 | 258 ;;; R |
17299 | 259 ("$(3!N(B" (?e "$(3!I(B") (?u "$(3!J(B") (?i "$(3!K(B") (?a "$(3!L(B") (?E "$(3!M(B") (?o "$(3!O(B") |
260 (?W "$(3!P(B" (?a "$(3!P(B") | |
261 (?e "$(3!N%n(B") (?u "$(3!N%r(B") (?i "$(3!N%o(B") (?E "$(3!N%q(B")) | |
262 (?Y "$(3$`(B" (?a "$(3$`(B"))) | |
17052 | 263 ;;; S |
17299 | 264 ("$(3$D(B" (?e "$(3$?(B") (?u "$(3$@(B") (?i "$(3$A(B") (?a "$(3$B(B") (?E "$(3$C(B") (?o "$(3$E(B") |
265 (?W "$(3$F(B" (?a "$(3$F(B") | |
266 (?e "$(3$D%n(B") (?u "$(3$D%r(B") (?i "$(3$D%o(B") (?E "$(3$D%q(B")) | |
267 (?2 "$(3$L(B" | |
268 (?e "$(3$G(B") (?u "$(3$H(B") (?i "$(3$I(B") (?a "$(3$J(B") (?E "$(3$K(B") (?o "$(3$M(B") | |
269 (?W "$(3$F(B" (?a "$(3$F(B") | |
270 (?e "$(3$L%n(B") (?u "$(3$L%r(B") (?i "$(3$L%o(B") (?E "$(3$L%q(B")))) | |
17052 | 271 ;;; T |
17299 | 272 ("$(3$,(B" (?e "$(3$'(B") (?u "$(3$((B") (?i "$(3$)(B") (?a "$(3$*(B") (?E "$(3$+(B") (?o "$(3$-(B") |
273 (?W "$(3$.(B" (?a "$(3$.(B") | |
274 (?e "$(3$,%n(B") (?u "$(3$,%r(B") (?i "$(3$,%o(B") (?E "$(3$,%q(B"))) | |
17052 | 275 ;;; U |
17299 | 276 ("$(3"d(B" (?2 "$(3#6(B")) |
17052 | 277 ;;; V |
17299 | 278 ("$(3"0(B" (?e "$(3"+(B") (?u "$(3",(B") (?i "$(3"-(B") (?a "$(3".(B") (?E "$(3"/(B") (?o "$(3"1(B") |
279 (?W "$(3"2(B" (?a "$(3"2(B") | |
280 (?e "$(3"0%n(B") (?u "$(3"0%r(B") (?i "$(3"0%o(B") (?E "$(3"0%q(B"))) | |
17052 | 281 ;;; W |
17299 | 282 ("$(3%r(B" (?e "$(3%n(B") (?u "$(3%r(B") (?i "$(3%o(B") (?a "$(3%p(B") (?E "$(3%q(B")) |
17052 | 283 ;;; X |
17299 | 284 ("$(3%N(B" (?e "$(3%I(B") (?u "$(3%J(B") (?i "$(3%K(B") (?a "$(3%L(B") (?E "$(3%M(B") (?o "$(3%O(B")) |
17052 | 285 ;;; Y |
17299 | 286 ("$(3#R(B" (?e "$(3#M(B") (?u "$(3#N(B") (?i "$(3#O(B") (?a "$(3#P(B") (?E "$(3#Q(B") (?o "$(3#S(B") |
287 (?W "$(3#T(B" (?a "$(3#T(B") | |
288 (?e "$(3#R%n(B") (?u "$(3#R%r(B") (?i "$(3#R%o(B") (?E "$(3#R%q(B"))) | |
17052 | 289 ;;; Z |
17299 | 290 ("$(3#J(B" (?e "$(3#E(B") (?u "$(3#F(B") (?i "$(3#G(B") (?a "$(3#H(B") (?E "$(3#I(B") (?o "$(3#K(B") |
291 (?W "$(3#L(B" (?a "$(3#L(B") | |
292 (?e "$(3#J%n(B") (?u "$(3#J%r(B") (?i "$(3#J%o(B") (?E "$(3#J%q(B"))) | |
17052 | 293 ;;; [ \ ] ^ _ |
294 nil nil nil nil nil | |
295 ;;; ` | |
17299 | 296 ("" |
297 (?: "$(3$h(B") | |
298 (?? (if ethio-use-three-dot-question "$(3%x(B" "$(3$n(B")) | |
299 (?! "$(3%t(B") | |
300 (?e "$(3#5(B") (?u "$(3#6(B") (?U "$(3#6(B") (?i "$(3#7(B") (?a "$(3#8(B") (?A "$(3#8(B") | |
301 (?E "$(3#9(B") (?I "$(3#:(B") (?o "$(3#;(B") (?O "$(3#;(B") | |
302 (?g "$(3%^(B" | |
303 (?e "$(3%Y(B") (?u "$(3%Z(B") (?i "$(3%[(B") (?a "$(3%\(B") (?E "$(3%](B") (?o "$(3%_(B")) | |
304 (?h "$(3"H(B" | |
305 (?e "$(3"C(B") (?u "$(3"D(B") (?i "$(3"E(B") (?a "$(3"F(B") (?E "$(3"G(B") (?o "$(3"I(B") | |
306 (?W "$(3"P(B" (?e "$(3"K(B") (?u "$(3"P(B") (?i "$(3"M(B") (?a "$(3"N(B") (?E "$(3"O(B"))) | |
307 (?k "$(3%>(B" | |
308 (?e "$(3%9(B") (?u "$(3%:(B") (?i "$(3%;(B") (?a "$(3%<(B") (?E "$(3%=(B") (?o "$(3%?(B")) | |
309 (?s "$(3!F(B" | |
310 (?e "$(3!A(B") (?u "$(3!B(B") (?i "$(3!C(B") (?a "$(3!D(B") (?E "$(3!E(B") (?o "$(3!G(B") | |
311 (?W "$(3!H(B" (?a "$(3!H(B") | |
312 (?e "$(3!F%n(B") (?u "$(3!F%r(B") (?i "$(3!F%o(B") (?E "$(3!F%q(B"))) | |
313 (?S "$(3$L(B" | |
314 (?e "$(3$G(B") (?u "$(3$H(B") (?i "$(3$I(B") (?a "$(3$J(B") (?E "$(3$K(B") (?o "$(3$M(B") | |
315 (?W "$(3$F(B" (?a "$(3$F(B") | |
316 (?e "$(3$L%n(B") (?u "$(3$L%r(B") (?i "$(3$L%o(B") (?E "$(3$L%q(B"))) | |
317 (?q "$(3%.(B" (?e "$(3%)(B") (?u "$(3%*(B") (?i "$(3%+(B") (?a "$(3%,(B") (?E "$(3%-(B") (?o "$(3%/(B"))) | |
17052 | 318 ;;; a |
17299 | 319 ("$(3"f(B" (?2 "$(3#8(B")) |
17052 | 320 ;;; b |
17299 | 321 ("$(3"((B" (?e "$(3"#(B") (?u "$(3"$(B") (?i "$(3"%(B") (?a "$(3"&(B") (?E "$(3"'(B") (?o "$(3")(B") |
322 (?W "$(3%b(B" (?e "$(3%2(B") (?u "$(3%b(B") (?i "$(3%B(B") (?a "$(3"*(B") (?E "$(3%R(B"))) | |
17052 | 323 ;;; c |
17299 | 324 ("$(3"@(B" (?e "$(3";(B") (?u "$(3"<(B") (?i "$(3"=(B") (?a "$(3">(B") (?E "$(3"?(B") (?o "$(3"A(B") |
325 (?W "$(3"B(B" (?a "$(3"B(B") | |
326 (?e "$(3"@%n(B") (?u "$(3"@%r(B") (?i "$(3"@%o(B") (?E "$(3"@%q(B"))) | |
17052 | 327 ;;; d |
17299 | 328 ("$(3#Z(B" (?e "$(3#U(B") (?u "$(3#V(B") (?i "$(3#W(B") (?a "$(3#X(B") (?E "$(3#Y(B") (?o "$(3#[(B") |
329 (?W "$(3#\(B" (?a "$(3#\(B") | |
330 (?e "$(3#Z%o(B") (?u "$(3#Z%r(B") (?i "$(3#Z%p(B") (?E "$(3#Z%q(B"))) | |
17052 | 331 ;;; e |
17299 | 332 ("$(3"c(B" (?2 "$(3#5(B") (?a "$(3"j(B")) |
17052 | 333 ;;; f |
17299 | 334 ("$(3$T(B" (?e "$(3$O(B") (?u "$(3$P(B") (?i "$(3$Q(B") (?a "$(3$R(B") (?E "$(3$S(B") (?o "$(3$U(B") |
335 (?W "$(3%d(B" (?e "$(3%4(B") (?u "$(3%d(B") (?i "$(3%D(B") (?a "$(3$V(B") (?E "$(3%T(B")) | |
336 (?Y "$(3$a(B" (?a "$(3$a(B"))) | |
17052 | 337 ;;; g |
17299 | 338 ("$(3#r(B" (?e "$(3#m(B") (?u "$(3#n(B") (?i "$(3#o(B") (?a "$(3#p(B") (?E "$(3#q(B") (?o "$(3#s(B") |
339 (?W "$(3#z(B" (?e "$(3#u(B") (?u "$(3#z(B") (?i "$(3#w(B") (?a "$(3#x(B") (?E "$(3#y(B")) | |
340 (?2 "$(3%^(B" (?e "$(3%Y(B") (?u "$(3%Z(B") (?i "$(3%[(B") (?a "$(3%\(B") (?E "$(3%](B") (?o "$(3%_(B"))) | |
17052 | 341 ;;; h |
17299 | 342 ("$(3!&(B" (?e "$(3!!(B") (?u "$(3!"(B") (?i "$(3!#(B") (?a "$(3!$(B") (?E "$(3!%(B") (?o "$(3!'(B") |
343 (?W "$(3"P(B" (?e "$(3"K(B") (?u "$(3"P(B") (?i "$(3"M(B") (?a "$(3"N(B") (?E "$(3"O(B")) | |
344 (?2 "$(3"H(B" (?e "$(3"C(B") (?u "$(3"D(B") (?i "$(3"E(B") (?a "$(3"F(B") (?E "$(3"G(B") (?o "$(3"I(B") | |
345 (?W "$(3"P(B" (?e "$(3"K(B") (?u "$(3"P(B") (?i "$(3"M(B") (?a "$(3"N(B") (?E "$(3"O(B")))) | |
17052 | 346 ;;; i |
17299 | 347 ("$(3"e(B" (?2 "$(3#7(B")) |
17052 | 348 ;;; j |
17299 | 349 ("$(3#j(B" (?e "$(3#e(B") (?u "$(3#f(B") (?i "$(3#g(B") (?a "$(3#h(B") (?E "$(3#i(B") (?o "$(3#k(B") |
350 (?W "$(3#l(B" (?a "$(3#l(B") | |
351 (?e "$(3#j%n(B") (?u "$(3#j%r(B") (?i "$(3#j%o(B") (?E "$(3#j%q(B"))) | |
17052 | 352 ;;; k |
17299 | 353 ("$(3"p(B" (?e "$(3"k(B") (?u "$(3"l(B") (?i "$(3"m(B") (?a "$(3"n(B") (?E "$(3"o(B") (?o "$(3"q(B") |
354 (?W "$(3"x(B" (?e "$(3"s(B") (?u "$(3"x(B") (?i "$(3"u(B") (?a "$(3"v(B") (?E "$(3"w(B")) | |
355 (?2 "$(3%>(B" (?e "$(3%9(B") (?u "$(3%:(B") (?i "$(3%;(B") (?a "$(3%<(B") (?E "$(3%=(B") (?o "$(3%?(B"))) | |
17052 | 356 ;;; l |
17299 | 357 ("$(3!.(B" (?e "$(3!)(B") (?u "$(3!*(B") (?i "$(3!+(B") (?a "$(3!,(B") (?E "$(3!-(B") (?o "$(3!/(B") |
358 (?W "$(3!0(B" (?a "$(3!0(B") | |
359 (?e "$(3!.%n(B") (?u "$(3!.%r(B") (?i "$(3!.%o(B") (?E "$(3!.%q(B"))) | |
17052 | 360 ;;; m |
17299 | 361 ("$(3!>(B" (?e "$(3!9(B") (?u "$(3!:(B") (?i "$(3!;(B") (?a "$(3!<(B") (?E "$(3!=(B") (?o "$(3!?(B") |
362 (?W "$(3%a(B" (?e "$(3%1(B") (?u "$(3%a(B") (?i "$(3%A(B") (?a "$(3!@(B") (?E "$(3%Q(B")) | |
363 (?Y "$(3$_(B" (?a "$(3$_(B"))) | |
17052 | 364 ;;; n |
17299 | 365 ("$(3"X(B" (?e "$(3"S(B") (?u "$(3"T(B") (?i "$(3"U(B") (?a "$(3"V(B") (?E "$(3"W(B") (?o "$(3"Y(B") |
366 (?W "$(3"Z(B" (?a "$(3"Z(B") | |
367 (?e "$(3"X%n(B") (?u "$(3"X%r(B") (?i "$(3"X%o(B") (?E "$(3"X%q(B"))) | |
17052 | 368 ;;; o |
17299 | 369 ("$(3"i(B" (?2 "$(3#;(B")) |
17052 | 370 ;;; p |
17299 | 371 ("$(3$\(B" (?e "$(3$W(B") (?u "$(3$X(B") (?i "$(3$Y(B") (?a "$(3$Z(B") (?E "$(3$[(B") (?o "$(3$](B") |
372 (?W "$(3%e(B" (?e "$(3%5(B") (?u "$(3%e(B") (?i "$(3%E(B") (?a "$(3$^(B") (?E "$(3%U(B"))) | |
17052 | 373 ;;; q |
17299 | 374 ("$(3!f(B" (?e "$(3!a(B") (?u "$(3!b(B") (?i "$(3!c(B") (?a "$(3!d(B") (?E "$(3!e(B") (?o "$(3!g(B") |
375 (?W "$(3!n(B" (?e "$(3!i(B") (?u "$(3!n(B") (?i "$(3!k(B") (?a "$(3!l(B") (?E "$(3!m(B")) | |
376 (?2 "$(3%.(B" (?e "$(3%)(B") (?u "$(3%*(B") (?i "$(3%+(B") (?a "$(3%,(B") (?E "$(3%-(B") (?o "$(3%/(B"))) | |
17052 | 377 ;;; r |
17299 | 378 ("$(3!N(B" (?e "$(3!I(B") (?u "$(3!J(B") (?i "$(3!K(B") (?a "$(3!L(B") (?E "$(3!M(B") (?o "$(3!O(B") |
379 (?W "$(3!P(B" (?a "$(3!P(B") | |
380 (?e "$(3!N%n(B") (?u "$(3!N%r(B") (?i "$(3!N%o(B") (?E "$(3!N%q(B")) | |
381 (?Y "$(3$`(B" (?a "$(3$`(B"))) | |
17052 | 382 ;;; s |
17299 | 383 ("$(3!V(B" (?e "$(3!Q(B") (?u "$(3!R(B") (?i "$(3!S(B") (?a "$(3!T(B") (?E "$(3!U(B") (?o "$(3!W(B") |
384 (?W "$(3!X(B" (?a "$(3!X(B") | |
385 (?e "$(3!V%n(B") (?u "$(3!V%r(B") (?i "$(3!V%o(B") (?E "$(3!V%q(B")) | |
386 (?2 "$(3!F(B" (?e "$(3!A(B") (?u "$(3!B(B") (?i "$(3!C(B") (?a "$(3!D(B") (?E "$(3!E(B") (?o "$(3!G(B") | |
387 (?W "$(3!H(B" (?a "$(3!H(B") | |
388 (?e "$(3!F%n(B") (?u "$(3!F%r(B") (?i "$(3!F%o(B") (?E "$(3!F%q(B")))) | |
17052 | 389 ;;; t |
17299 | 390 ("$(3"8(B" (?e "$(3"3(B") (?u "$(3"4(B") (?i "$(3"5(B") (?a "$(3"6(B") (?E "$(3"7(B") (?o "$(3"9(B") |
391 (?W "$(3":(B" (?a "$(3":(B") | |
392 (?e "$(3"8%n(B") (?u "$(3"8%r(B") (?i "$(3"8%o(B") (?E "$(3"8%q(B"))) | |
17052 | 393 ;;; u |
17299 | 394 ("$(3"d(B" (?2 "$(3#6(B")) |
17052 | 395 ;;; v |
17299 | 396 ("$(3"0(B" (?e "$(3"+(B") (?u "$(3",(B") (?i "$(3"-(B") (?a "$(3".(B") (?E "$(3"/(B") (?o "$(3"1(B") |
397 (?W "$(3"2(B" (?a "$(3"2(B") | |
398 (?e "$(3"0%n(B") (?u "$(3"0%r(B") (?i "$(3"0%o(B") (?E "$(3"0%q(B"))) | |
17052 | 399 ;;; w |
17299 | 400 ("$(3#2(B" (?e "$(3#-(B") (?u "$(3#.(B") (?i "$(3#/(B") (?a "$(3#0(B") (?E "$(3#1(B") (?o "$(3#3(B") |
401 (?W "$(3%p(B" (?e "$(3%n(B") (?u "$(3%r(B") (?i "$(3%o(B") (?a "$(3%p(B") (?E "$(3%q(B"))) | |
17052 | 402 ;;; x |
17299 | 403 ("$(3!^(B" (?e "$(3!Y(B") (?u "$(3!Z(B") (?i "$(3![(B") (?a "$(3!\(B") (?E "$(3!](B") (?o "$(3!_(B") |
404 (?W "$(3!`(B" (?a "$(3!`(B") | |
405 (?e "$(3!^%n(B") (?u "$(3!^%r(B") (?i "$(3!^%o(B") (?E "$(3!^%q(B"))) | |
17052 | 406 ;;; y |
17299 | 407 ("$(3#R(B" (?e "$(3#M(B") (?u "$(3#N(B") (?i "$(3#O(B") (?a "$(3#P(B") (?E "$(3#Q(B") (?o "$(3#S(B") |
408 (?W "$(3#T(B" (?a "$(3#T(B") | |
409 (?e "$(3#R%n(B") (?u "$(3#R%r(B") (?i "$(3#R%o(B") (?E "$(3#R%q(B"))) | |
17052 | 410 ;;; z |
17299 | 411 ("$(3#B(B" (?e "$(3#=(B") (?u "$(3#>(B") (?i "$(3#?(B") (?a "$(3#@(B") (?E "$(3#A(B") (?o "$(3#C(B") |
412 (?W "$(3#D(B" (?a "$(3#D(B") | |
413 (?e "$(3#B%n(B") (?u "$(3#B%r(B") (?i "$(3#B%o(B") (?E "$(3#B%q(B"))) | |
414 ;;; { | } ~ DEL | |
415 nil nil nil nil nil | |
17052 | 416 ]) |
417 | |
418 ;;;###autoload | |
17299 | 419 (defun ethio-sera-to-fidel-region (beg end &optional secondary force) |
420 "Convert the characters in region from SERA to FIDEL. | |
421 The variable `ethio-primary-language' specifies the primary language | |
422 and `ethio-secondary-language' specifies the secondary. | |
17052 | 423 |
17299 | 424 If the 3rd parameter SECONDARY is given and non-nil, assume the region |
425 begins begins with the secondary language; otherwise with the primary | |
426 language. | |
17052 | 427 |
17299 | 428 If the 4th parameter FORCE is given and non-nil, perform conversion |
429 even if the buffer is read-only. | |
430 | |
431 See also the descriptions of the variables | |
19646
175c12fff246
(ethio-sera-to-fidel-region,
Kenichi Handa <handa@m17n.org>
parents:
19426
diff
changeset
|
432 `ethio-use-colon-for-colon' and |
17299 | 433 `ethio-use-three-dot-question'." |
17052 | 434 |
435 (interactive "r\nP") | |
17299 | 436 (save-restriction |
437 (narrow-to-region beg end) | |
438 (ethio-sera-to-fidel-buffer secondary force))) | |
17052 | 439 |
440 ;;;###autoload | |
17299 | 441 (defun ethio-sera-to-fidel-buffer (&optional secondary force) |
442 "Convert the current buffer from SERA to FIDEL. | |
443 | |
444 The variable `ethio-primary-language' specifies the primary | |
445 language and `ethio-secondary-language' specifies the secondary. | |
17052 | 446 |
17299 | 447 If the 1st optional parameter SECONDARY is non-nil, assume the buffer |
448 begins with the secondary language; otherwise with the primary | |
449 language. | |
17052 | 450 |
17299 | 451 If the 2nd optional parametr FORCE is non-nil, perform conversion even if the |
452 buffer is read-only. | |
453 | |
454 See also the descriptions of the variables | |
19646
175c12fff246
(ethio-sera-to-fidel-region,
Kenichi Handa <handa@m17n.org>
parents:
19426
diff
changeset
|
455 `ethio-use-colon-for-colon' and |
17299 | 456 `ethio-use-three-dot-question'." |
17052 | 457 |
458 (interactive "P") | |
17299 | 459 |
17052 | 460 (if (and buffer-read-only |
461 (not force) | |
462 (not (y-or-n-p "Buffer is read-only. Force to convert? "))) | |
463 (error "")) | |
17299 | 464 |
465 (let ((ethio-primary-language ethio-primary-language) | |
466 (ethio-secondary-language ethio-secondary-language) | |
467 (ethio-use-colon-for-colon ethio-use-colon-for-colon) | |
468 (ethio-use-three-dot-question ethio-use-three-dot-question) | |
469 ;; The above four variables may be changed temporary | |
470 ;; by tilde escapes during conversion. So we bind them to other | |
471 ;; variables but of the same names. | |
472 (buffer-read-only nil) | |
473 (case-fold-search nil) | |
474 current-language | |
475 next-language) | |
476 | |
477 (setq current-language | |
478 (if secondary | |
479 ethio-secondary-language | |
480 ethio-primary-language)) | |
481 | |
17052 | 482 (goto-char (point-min)) |
17299 | 483 |
17052 | 484 (while (not (eobp)) |
17299 | 485 (setq next-language |
486 (cond | |
487 ((eq current-language 'english) | |
488 (ethio-sera-to-fidel-english)) | |
489 ((eq current-language 'amharic) | |
490 (ethio-sera-to-fidel-ethio 'amharic)) | |
491 ((eq current-language 'tigrigna) | |
492 (ethio-sera-to-fidel-ethio 'tigrigna)) | |
493 (t ; we don't know what to do | |
494 (ethio-sera-to-fidel-english)))) | |
17052 | 495 |
17299 | 496 (setq current-language |
497 (cond | |
17052 | 498 |
17299 | 499 ;; when language tag is explicitly specified |
500 ((not (eq next-language 'toggle)) | |
501 next-language) | |
17052 | 502 |
17299 | 503 ;; found a toggle in a primary language section |
504 ((eq current-language ethio-primary-language) | |
505 ethio-secondary-language) | |
17052 | 506 |
17299 | 507 ;; found a toggle in a secondary, third, fourth, ... |
508 ;; language section | |
509 (t | |
510 ethio-primary-language)))) | |
17052 | 511 |
17299 | 512 ;; If ethio-implicit-period-conversion is non-nil, the |
513 ;; Ethiopic dot "$(3%u(B" at the end of an Ethiopic sentence is | |
514 ;; replaced with the Ethiopic full stop "$(3$i(B". | |
515 (if ethio-implicit-period-conversion | |
516 (progn | |
517 (goto-char (point-min)) | |
518 (while (re-search-forward "\\([$(3!!(B-$(3$a%)(B-$(3%e%n(B-$(3%r%s(B]\\)$(3%u(B\\([ \t]\\)" | |
519 nil t) | |
520 (replace-match "\\1$(3$i(B\\2")) | |
521 (goto-char (point-min)) | |
522 (while (re-search-forward "\\([$(3!!(B-$(3$a%)(B-$(3%e%n(B-$(3%r%s(B]\\)$(3%u(B$" nil t) | |
523 (replace-match "\\1$(3$i(B")))) | |
17052 | 524 |
17299 | 525 ;; gemination |
526 (goto-char (point-min)) | |
527 (while (re-search-forward "\\ce$(3%s(B" nil 0) | |
528 (compose-region | |
529 (save-excursion (backward-char 2) (point)) | |
530 (point))) | |
531 )) | |
532 | |
533 (defun ethio-sera-to-fidel-english nil | |
534 "Handle English section in SERA to FIDEL conversion. | |
535 Conversion stops when a language switch is found. Then delete that | |
536 switch and return the name of the new language as a symbol." | |
537 (let ((new-language nil)) | |
538 | |
539 (while (and (not (eobp)) (null new-language)) | |
540 (cond | |
17052 | 541 |
17299 | 542 ;; if no more "\", nothing to do. |
543 ((not (search-forward "\\" nil 0))) | |
544 | |
545 ;; hereafter point is put after a "\". | |
546 ;; first delete that "\", then check the following chars | |
547 | |
548 ;; "\\" : leave the second "\" | |
549 ((progn | |
550 (delete-backward-char 1) | |
551 (= (following-char) ?\\ )) | |
552 (forward-char 1)) | |
553 | |
554 ;; "\ " : delete the following " " | |
555 ((= (following-char) 32) | |
556 (delete-char 1) | |
557 (setq new-language 'toggle)) | |
17052 | 558 |
17299 | 559 ;; a language flag |
560 ((setq new-language (ethio-process-language-flag))) | |
561 | |
562 ;; just a "\" : not special sequence. | |
563 (t | |
564 (setq new-language 'toggle)))) | |
565 | |
566 new-language)) | |
17052 | 567 |
17299 | 568 (defun ethio-sera-to-fidel-ethio (lang) |
569 "Handle Ethiopic section in SERA to FIDEL conversion. | |
570 Conversion stops when a language switch is found. Then delete that | |
571 switch and return the name of the new language as a symbol. | |
572 | |
573 The parameter LANG (symbol, either `amharic' or `tigrigna') affects | |
574 the conversion of \"a\"." | |
575 | |
576 (let ((new-language nil) | |
577 (verbatim nil) | |
578 start table table2 ch) | |
17052 | 579 |
17299 | 580 (setcar (aref ethio-sera-to-fidel-table ?a) |
581 (if (eq lang 'tigrigna) "$(3"f(B" "$(3"c(B")) | |
582 | |
583 (while (and (not (eobp)) (null new-language)) | |
584 (setq ch (following-char)) | |
585 (cond | |
17052 | 586 |
17299 | 587 ;; skip from "<" to ">" (or from "&" to ";") if in w3-mode |
588 ((and (boundp 'sera-being-called-by-w3) | |
589 sera-being-called-by-w3 | |
590 (or (= ch ?<) (= ch ?&))) | |
591 (search-forward (if (= ch ?<) ">" ";") | |
592 nil 0)) | |
593 | |
594 ;; leave non-ASCII characters as they are | |
595 ((>= ch 128) | |
596 (forward-char 1)) | |
17052 | 597 |
17299 | 598 ;; ethiopic digits |
599 ((looking-at "`[1-9][0-9]*") | |
600 (delete-char 1) | |
601 (ethio-convert-digit)) | |
17052 | 602 |
17299 | 603 ;; if not seeing a "\", do sera to fidel conversion |
604 ((/= ch ?\\ ) | |
605 (setq start (point)) | |
606 (forward-char 1) | |
607 (setq table (aref ethio-sera-to-fidel-table ch)) | |
608 (while (setq table2 (cdr (assoc (following-char) table))) | |
609 (setq table table2) | |
610 (forward-char 1)) | |
611 (if (setq ch (car table)) | |
612 (progn | |
613 (delete-region start (point)) | |
614 (if (stringp ch) | |
615 (insert ch) | |
616 (insert (eval ch)))))) | |
17052 | 617 |
17299 | 618 ;; if control reaches here, we must be looking at a "\" |
17052 | 619 |
17299 | 620 ;; verbatim mode |
621 (verbatim | |
622 (if (looking-at "\\\\~! ?") | |
623 | |
624 ;; "\~!" or "\~! ". switch to non-verbatim mode | |
625 (progn | |
626 (replace-match "") | |
627 (setq verbatim nil)) | |
17052 | 628 |
17299 | 629 ;; "\" but not "\~!" nor "\~! ". skip the current "\". |
630 (forward-char 1))) | |
631 | |
632 ;; hereafter, non-verbatim mode and looking at a "\" | |
633 ;; first delete that "\", then check the following chars. | |
634 | |
635 ;; "\ " : delete the following " " | |
636 ((progn | |
17052 | 637 (delete-char 1) |
17299 | 638 (setq ch (following-char)) |
639 (= ch 32)) | |
640 (delete-char 1) | |
641 (setq new-language 'toggle)) | |
642 | |
643 ;; "\~!" or "\~! " : switch to verbatim mode | |
644 ((looking-at "~! ?") | |
645 (replace-match "") | |
646 (setq verbatim t)) | |
17052 | 647 |
17299 | 648 ;; a language flag |
649 ((setq new-language (ethio-process-language-flag))) | |
650 | |
651 ;; "\~" but not "\~!" nor a language flag | |
652 ((= ch ?~) | |
653 (delete-char 1) | |
654 (ethio-tilde-escape)) | |
655 | |
656 ;; ASCII punctuation escape. skip | |
657 ((looking-at "\\(,\\|\\.\\|;\\|:\\|'\\|`\\|\?\\|\\\\\\)+") | |
658 (goto-char (match-end 0))) | |
17052 | 659 |
17299 | 660 ;; "\", but not special sequence |
661 (t | |
662 (setq new-language 'toggle)))) | |
663 | |
664 new-language)) | |
665 | |
666 (defun ethio-process-language-flag nil | |
667 "Process a language flag of the form \"~lang\" or \"~lang1~lang2\". | |
17052 | 668 |
17299 | 669 If looking at \"~lang1~lang2\", set `ethio-primary-language' and |
670 `ethio-une-secondary-language' based on \"lang1\" and \"lang2\". | |
671 Then delete the language flag \"~lang1~lang2\" from the buffer. | |
672 Return value is the new primary language. | |
17052 | 673 |
17299 | 674 If looking at \"~lang\", delete that language flag \"~lang\" from the |
675 buffer and return that language. In this case | |
676 `ethio-primary-language' and `ethio-uni-secondary-language' | |
677 are left unchanged. | |
678 | |
679 If an unsupported language flag is found, just return nil without | |
680 changing anything." | |
681 | |
682 (let (lang1 lang2) | |
683 (cond | |
17052 | 684 |
17299 | 685 ;; ~lang1~lang2 |
686 ((and (looking-at | |
687 "~\\([a-z][a-z][a-z]?\\)~\\([a-z][a-z][a-z]?\\)[ \t\n\\]") | |
688 (setq lang1 | |
689 (ethio-flag-to-language | |
690 (buffer-substring (match-beginning 1) (match-end 1)))) | |
691 (setq lang2 | |
692 (ethio-flag-to-language | |
693 (buffer-substring (match-beginning 2) (match-end 2))))) | |
694 (setq ethio-primary-language lang1 | |
695 ethio-secondary-language lang2) | |
696 (delete-region (point) (match-end 2)) | |
697 (if (= (following-char) 32) | |
698 (delete-char 1)) | |
699 ethio-primary-language) | |
700 | |
701 ;; ~lang | |
702 ((and (looking-at "~\\([a-z][a-z][a-z]?\\)[ \t\n\\]") | |
703 (setq lang1 | |
704 (ethio-flag-to-language | |
705 (buffer-substring (match-beginning 1) (match-end 1))))) | |
706 (delete-region (point) (match-end 1)) | |
707 (if (= (following-char) 32) | |
708 (delete-char 1)) | |
709 lang1) | |
710 | |
711 ;; otherwise | |
712 (t | |
713 nil)))) | |
714 | |
715 (defun ethio-tilde-escape nil | |
716 "Handle a SERA tilde escape in Ethiopic section and delete it. | |
717 Delete the escape even it is not recognised." | |
718 | |
719 (let ((p (point)) command) | |
720 (skip-chars-forward "^ \t\n\\\\") | |
721 (setq command (buffer-substring p (point))) | |
722 (delete-region p (point)) | |
723 (if (= (following-char) 32) | |
724 (delete-char 1)) | |
725 | |
726 (cond | |
17052 | 727 |
17299 | 728 ;; \~-: |
729 ((string= command "-:") | |
730 (setq ethio-use-colon-for-colon t)) | |
731 | |
732 ;; \~`: | |
733 ((string= command "`:") | |
734 (setq ethio-use-colon-for-colon nil)) | |
735 | |
736 ;; \~? | |
737 ((string= command "?") | |
738 (setq ethio-use-three-dot-question nil)) | |
739 | |
740 ;; \~`| | |
741 ((string= command "`|") | |
742 (setq ethio-use-three-dot-question t)) | |
743 | |
744 ;; \~e | |
745 ((string= command "e") | |
746 (insert "$(3%j(B")) | |
747 | |
748 ;; \~E | |
749 ((string= command "E") | |
750 (insert "$(3%k(B")) | |
17052 | 751 |
17299 | 752 ;; \~a |
753 ((string= command "a") | |
754 (insert "$(3%l(B")) | |
755 | |
756 ;; \~A | |
757 ((string= command "A") | |
758 (insert "$(3%m(B")) | |
759 | |
760 ;; \~X | |
761 ((string= command "X") | |
762 (insert "$(3%i(B")) | |
763 | |
764 ;; unsupported tilde escape | |
765 (t | |
766 nil)))) | |
767 | |
768 (defun ethio-flag-to-language (flag) | |
769 (cond | |
770 ((or (string= flag "en") (string= flag "eng")) 'english) | |
771 ((or (string= flag "ti") (string= flag "tir")) 'tigrigna) | |
772 ((or (string= flag "am") (string= flag "amh")) 'amharic) | |
773 (t nil))) | |
774 | |
775 (defun ethio-convert-digit nil | |
17052 | 776 "Convert Arabic digits to Ethiopic digits." |
777 (let (ch z) | |
778 (while (and (>= (setq ch (following-char)) ?1) | |
779 (<= ch ?9)) | |
780 (delete-char 1) | |
781 | |
782 ;; count up following zeros | |
783 (setq z 0) | |
784 (while (= (following-char) ?0) | |
785 (delete-char 1) | |
786 (setq z (1+ z))) | |
787 | |
788 (cond | |
789 | |
790 ;; first digit is 10, 20, ..., or 90 | |
791 ((= (mod z 2) 1) | |
17299 | 792 (insert (aref [?$(3$y(B ?$(3$z(B ?$(3${(B ?$(3$|(B ?$(3$}(B ?$(3$~(B ?$(3%!(B ?$(3%"(B ?$(3%#(B] (- ch ?1))) |
17052 | 793 (setq z (1- z))) |
794 | |
795 ;; first digit is 2, 3, ..., or 9 | |
796 ((/= ch ?1) | |
17299 | 797 (insert (aref [?$(3$q(B ?$(3$r(B ?$(3$s(B ?$(3$t(B ?$(3$u(B ?$(3$v(B ?$(3$w(B ?$(3$x(B] (- ch ?2)))) |
17052 | 798 |
799 ;; single 1 | |
800 ((= z 0) | |
17299 | 801 (insert "$(3$p(B"))) |
17052 | 802 |
803 ;; 100 | |
804 (if (= (mod z 4) 2) | |
17299 | 805 (insert "$(3%$(B")) |
17052 | 806 |
807 ;; 10000 | |
17299 | 808 (insert-char ?$(3%%(B (/ z 4))))) |
17052 | 809 |
810 ;;;###autoload | |
19858
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
811 (defun ethio-sera-to-fidel-mail-or-marker (&optional arg) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
812 "Execute ethio-sera-to-fidel-mail or ethio-sera-to-fidel-marker depending on the current major mode. |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
813 If in rmail-mode or in mail-mode, execute the former; otherwise latter." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
814 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
815 (interactive "P") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
816 (if (or (eq major-mode 'rmail-mode) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
817 (eq major-mode 'mail-mode)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
818 (ethio-sera-to-fidel-mail (prefix-numeric-value arg)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
819 (ethio-sera-to-fidel-marker arg))) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
820 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
821 ;;;###autoload |
17299 | 822 (defun ethio-sera-to-fidel-mail (&optional arg) |
823 "Convert SERA to FIDEL to read/write mail and news. | |
17052 | 824 |
825 If the buffer contains the markers \"<sera>\" and \"</sera>\", | |
17299 | 826 convert the segments between them into FIDEL. |
17052 | 827 |
17299 | 828 If invoked interactively and there is no marker, convert the subject field |
829 and the body into FIDEL using `ethio-sera-to-fidel-region'." | |
17052 | 830 |
831 (interactive "p") | |
17299 | 832 (let ((buffer-read-only nil) |
833 border) | |
17052 | 834 (save-excursion |
835 | |
21871
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
836 ;; follow RFC822 rules instead of looking for a fixed separator |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
837 (rfc822-goto-eoh) |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
838 (forward-line 1) |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
839 (setq border (point)) |
17299 | 840 |
841 ;; note that the point is placed at the border | |
842 (if (or (re-search-forward "^<sera>$" nil t) | |
843 (progn | |
844 (goto-char (point-min)) | |
845 (re-search-forward "^Subject: <sera>" border t))) | |
17052 | 846 |
17299 | 847 ;; there are markers |
848 (progn | |
849 ;; we start with the body so that the border will not change | |
850 ;; use "^<sera>\n" instead of "^<sera>$" not to leave a blank line | |
851 (goto-char border) | |
852 (while (re-search-forward "^<sera>\n" nil t) | |
853 (replace-match "") | |
854 (ethio-sera-to-fidel-region | |
855 (point) | |
856 (progn | |
857 (if (re-search-forward "^</sera>\n" nil 0) | |
858 (replace-match "")) | |
859 (point)))) | |
860 ;; now process the subject | |
861 (goto-char (point-min)) | |
862 (if (re-search-forward "^Subject: <sera>" border t) | |
863 (ethio-sera-to-fidel-region | |
864 (progn (delete-backward-char 6) (point)) | |
865 (progn | |
866 (if (re-search-forward "</sera>$" (line-end-position) 0) | |
867 (replace-match "")) | |
868 (point))))) | |
17052 | 869 |
17299 | 870 ;; in case there are no marks but invoked interactively |
871 (if arg | |
872 (progn | |
873 (ethio-sera-to-fidel-region border (point-max)) | |
874 (goto-char (point-min)) | |
875 (if (re-search-forward "^Subject: " border t) | |
876 (ethio-sera-to-fidel-region (point) (line-end-position)))))) | |
17052 | 877 |
878 ;; adjust the rmail marker | |
879 (if (eq major-mode 'rmail-mode) | |
880 (set-marker | |
881 (aref rmail-message-vector (1+ rmail-current-message)) | |
882 (point-max)))))) | |
883 | |
884 ;;;###autoload | |
17299 | 885 (defun ethio-sera-to-fidel-marker (&optional force) |
886 "Convert the regions surrounded by \"<sera>\" and \"</sera>\" from SERA to FIDEL. | |
887 Assume that each region begins with `ethio-primary-language'. | |
888 The markers \"<sera>\" and \"</sera>\" themselves are not deleted." | |
889 (interactive "P") | |
17052 | 890 (if (and buffer-read-only |
17299 | 891 (not force) |
17052 | 892 (not (y-or-n-p "Buffer is read-only. Force to convert? "))) |
893 (error "")) | |
894 (save-excursion | |
895 (goto-char (point-min)) | |
896 (while (re-search-forward "<sera>" nil t) | |
17299 | 897 (ethio-sera-to-fidel-region |
17052 | 898 (point) |
899 (if (re-search-forward "</sera>" nil t) | |
900 (match-beginning 0) | |
901 (point-max)) | |
902 nil | |
903 'force)))) | |
904 | |
905 ;; | |
906 ;; FIDEL to SERA | |
907 ;; | |
908 | |
17299 | 909 (defconst ethio-fidel-to-sera-map |
910 [ "he" "hu" "hi" "ha" "hE" "h" "ho" "" ;; 0 - 7 | |
911 "le" "lu" "li" "la" "lE" "l" "lo" "lWa" ;; 8 | |
912 "He" "Hu" "Hi" "Ha" "HE" "H" "Ho" "HWa" ;; 16 | |
913 "me" "mu" "mi" "ma" "mE" "m" "mo" "mWa" ;; 24 | |
914 "`se" "`su" "`si" "`sa" "`sE" "`s" "`so" "`sWa" ;; 32 | |
915 "re" "ru" "ri" "ra" "rE" "r" "ro" "rWa" ;; 40 | |
916 "se" "su" "si" "sa" "sE" "s" "so" "sWa" ;; 48 | |
917 "xe" "xu" "xi" "xa" "xE" "x" "xo" "xWa" ;; 56 | |
918 "qe" "qu" "qi" "qa" "qE" "q" "qo" "" ;; 64 | |
919 "qWe" "" "qWi" "qWa" "qWE" "qW'" "" "" ;; 72 | |
920 "Qe" "Qu" "Qi" "Qa" "QE" "Q" "Qo" "" ;; 80 | |
921 "QWe" "" "QWi" "QWa" "QWE" "QW'" "" "" ;; 88 | |
922 "be" "bu" "bi" "ba" "bE" "b" "bo" "bWa" ;; 96 | |
923 "ve" "vu" "vi" "va" "vE" "v" "vo" "vWa" ;; 104 | |
924 "te" "tu" "ti" "ta" "tE" "t" "to" "tWa" ;; 112 | |
925 "ce" "cu" "ci" "ca" "cE" "c" "co" "cWa" ;; 120 | |
926 "`he" "`hu" "`hi" "`ha" "`hE" "`h" "`ho" "" ;; 128 | |
927 "hWe" "" "hWi" "hWa" "hWE" "hW'" "" "" ;; 136 | |
928 "ne" "nu" "ni" "na" "nE" "n" "no" "nWa" ;; 144 | |
929 "Ne" "Nu" "Ni" "Na" "NE" "N" "No" "NWa" ;; 152 | |
930 "e" "u" "i" "A" "E" "I" "o" "ea" ;; 160 | |
931 "ke" "ku" "ki" "ka" "kE" "k" "ko" "" ;; 168 | |
932 "kWe" "" "kWi" "kWa" "kWE" "kW'" "" "" ;; 176 | |
933 "Ke" "Ku" "Ki" "Ka" "KE" "K" "Ko" "" ;; 184 | |
934 "KWe" "" "KWi" "KWa" "KWE" "KW'" "" "" ;; 192 | |
935 "we" "wu" "wi" "wa" "wE" "w" "wo" "" ;; 200 | |
936 "`e" "`u" "`i" "`a" "`E" "`I" "`o" "" ;; 208 | |
937 "ze" "zu" "zi" "za" "zE" "z" "zo" "zWa" ;; 216 | |
938 "Ze" "Zu" "Zi" "Za" "ZE" "Z" "Zo" "ZWa" ;; 224 | |
939 "ye" "yu" "yi" "ya" "yE" "y" "yo" "yWa" ;; 232 | |
940 "de" "du" "di" "da" "dE" "d" "do" "dWa" ;; 240 | |
941 "De" "Du" "Di" "Da" "DE" "D" "Do" "DWa" ;; 248 | |
942 "je" "ju" "ji" "ja" "jE" "j" "jo" "jWa" ;; 256 | |
943 "ge" "gu" "gi" "ga" "gE" "g" "go" "" ;; 264 | |
944 "gWe" "" "gWi" "gWa" "gWE" "gW'" "" "" ;; 272 | |
945 "Ge" "Gu" "Gi" "Ga" "GE" "G" "Go" "GWa" ;; 280 | |
946 "Te" "Tu" "Ti" "Ta" "TE" "T" "To" "TWa" ;; 288 | |
947 "Ce" "Cu" "Ci" "Ca" "CE" "C" "Co" "CWa" ;; 296 | |
948 "Pe" "Pu" "Pi" "Pa" "PE" "P" "Po" "PWa" ;; 304 | |
949 "Se" "Su" "Si" "Sa" "SE" "S" "So" "SWa" ;; 312 | |
950 "`Se" "`Su" "`Si" "`Sa" "`SE" "`S" "`So" "" ;; 320 | |
951 "fe" "fu" "fi" "fa" "fE" "f" "fo" "fWa" ;; 328 | |
952 "pe" "pu" "pi" "pa" "pE" "p" "po" "pWa" ;; 336 | |
953 "mYa" "rYa" "fYa" "" "" "" "" "" ;; 344 | |
954 " " " : " "::" "," ";" "-:" ":-" "`?" ;; 352 | |
955 ":|:" "1" "2" "3" "4" "5" "6" "7" ;; 360 | |
956 "8" "9" "10" "20" "30" "40" "50" "60" ;; 368 | |
957 "70" "80" "90" "100" "10000" "" "" "" ;; 376 | |
958 "`qe" "`qu" "`qi" "`qa" "`qE" "`q" "`qo" "" ;; 384 | |
959 "mWe" "bWe" "GWe" "fWe" "pWe" "" "" "" ;; 392 | |
960 "`ke" "`ku" "`ki" "`ka" "`kE" "`k" "`ko" "" ;; 400 | |
961 "mWi" "bWi" "GWi" "fWi" "pWi" "" "" "" ;; 408 | |
962 "Xe" "Xu" "Xi" "Xa" "XE" "X" "Xo" "" ;; 416 | |
963 "mWE" "bWE" "GWE" "fWE" "pWE" "" "" "" ;; 424 | |
964 "`ge" "`gu" "`gi" "`ga" "`gE" "`g" "`go" "" ;; 432 | |
965 "mW'" "bW'" "GW'" "fW'" "pW'" "" "" "" ;; 440 | |
966 "\\~X " "\\~e " "\\~E " "\\~a " "\\~A " "wWe" "wWi" "wWa" ;; 448 | |
967 "wWE" "wW'" "''" "`!" "." "<<" ">>" "?" ]) ;; 456 | |
17052 | 968 |
17299 | 969 (defun ethio-prefer-amharic-p nil |
970 (or (eq ethio-primary-language 'amharic) | |
971 (and (not (eq ethio-primary-language 'tigrigna)) | |
972 (eq ethio-secondary-language 'amharic)))) | |
17052 | 973 |
17299 | 974 (defun ethio-language-to-flag (lang) |
975 (cond | |
976 ((eq lang 'english) "eng") | |
977 ((eq lang 'tigrigna) "tir") | |
978 ((eq lang 'amharic) "amh") | |
979 (t ""))) | |
17052 | 980 |
981 ;;;###autoload | |
17299 | 982 (defun ethio-fidel-to-sera-region (begin end &optional secondary force) |
983 "Replace all the FIDEL characters in the region to the SERA format. | |
984 The variable `ethio-primary-language' specifies the primary | |
985 language and `ethio-secondary-language' specifies the secondary. | |
17052 | 986 |
17299 | 987 If the 3dr parameter SECONDARY is given and non-nil, try to convert |
988 the region so that it begins in the secondary language; otherwise with | |
989 the primary language. | |
17052 | 990 |
17299 | 991 If the 4th parameter FORCE is given and non-nil, convert even if the |
992 buffer is read-only. | |
993 | |
994 See also the descriptions of the variables | |
19646
175c12fff246
(ethio-sera-to-fidel-region,
Kenichi Handa <handa@m17n.org>
parents:
19426
diff
changeset
|
995 `ethio-use-colon-for-colon', `ethio-use-three-dot-question', |
17299 | 996 `ethio-quote-vowel-always' and `ethio-numeric-reduction'." |
17052 | 997 |
998 (interactive "r\nP") | |
17299 | 999 (save-restriction |
1000 (narrow-to-region begin end) | |
1001 (ethio-fidel-to-sera-buffer secondary force))) | |
17052 | 1002 |
1003 ;;;###autoload | |
17299 | 1004 (defun ethio-fidel-to-sera-buffer (&optional secondary force) |
1005 "Replace all the FIDEL characters in the current buffer to the SERA format. | |
1006 The variable `ethio-primary-language' specifies the primary | |
1007 language and `ethio-secondary-language' specifies the secondary. | |
17052 | 1008 |
17299 | 1009 If the 1st optional parameter SECONDARY is non-nil, try to convert the |
1010 region so that it begins in the secondary language; otherwise with the | |
1011 primary language. | |
17052 | 1012 |
17299 | 1013 If the 2nd optional parameter FORCE is non-nil, convert even if the |
17052 | 1014 buffer is read-only. |
1015 | |
17299 | 1016 See also the descriptions of the variables |
19646
175c12fff246
(ethio-sera-to-fidel-region,
Kenichi Handa <handa@m17n.org>
parents:
19426
diff
changeset
|
1017 `ethio-use-colon-for-colon', `ethio-use-three-dot-question', |
17299 | 1018 `ethio-quote-vowel-always' and `ethio-numeric-reduction'." |
17052 | 1019 |
1020 (interactive "P") | |
1021 (if (and buffer-read-only | |
1022 (not force) | |
1023 (not (y-or-n-p "Buffer is read-only. Force to convert? "))) | |
1024 (error "")) | |
1025 | |
17299 | 1026 (let ((buffer-read-only nil) |
1027 (case-fold-search nil) | |
1028 (lonec nil) ;; t means previous char was a lone consonant | |
1029 (fidel nil) ;; t means previous char was a FIDEL | |
1030 (digit nil) ;; t means previous char was an Ethiopic digit | |
1031 (flag (if (ethio-prefer-amharic-p) "\\~amh " "\\~tir ")) | |
1032 mode ch) | |
1033 | |
1034 ;; user's preference in transcription | |
1035 (if ethio-use-colon-for-colon | |
1036 (progn | |
1037 (aset ethio-fidel-to-sera-map 353 "`:") | |
1038 (aset ethio-fidel-to-sera-map 357 ":")) | |
1039 (aset ethio-fidel-to-sera-map 353 " : ") | |
1040 (aset ethio-fidel-to-sera-map 357 "-:")) | |
17052 | 1041 |
17299 | 1042 (if ethio-use-three-dot-question |
1043 (progn | |
1044 (aset ethio-fidel-to-sera-map 359 "?") | |
1045 (aset ethio-fidel-to-sera-map 463 "`?")) | |
1046 (aset ethio-fidel-to-sera-map 359 "`?") | |
1047 (aset ethio-fidel-to-sera-map 463 "?")) | |
1048 | |
1049 (mapcar | |
1050 '(lambda (x) | |
1051 (aset (aref ethio-fidel-to-sera-map x) | |
1052 2 | |
1053 (if ethio-W-sixth-always ?' ?u))) | |
1054 '(77 93 141 181 197 277 440 441 442 443 444 457)) | |
1055 | |
1056 (if (ethio-prefer-amharic-p) | |
1057 (aset ethio-fidel-to-sera-map 160 "a") | |
1058 (aset ethio-fidel-to-sera-map 160 "e")) | |
1059 ;; end of user's preference | |
1060 | |
1061 ;; first, decompose geminated characters | |
1062 (decompose-region (point-min) (point-max)) | |
1063 | |
1064 ;; main conversion routine | |
17052 | 1065 (goto-char (point-min)) |
1066 (while (not (eobp)) | |
1067 (setq ch (following-char)) | |
1068 | |
17299 | 1069 (cond ; ethiopic, english, neutral |
17052 | 1070 |
17299 | 1071 ;; ethiopic character. must go to ethiopic mode, if not in it. |
1072 ((eq (char-charset ch) 'ethiopic) | |
1073 (setq ch (ethio-char-to-ethiocode ch)) | |
1074 (delete-char 1) | |
1075 (if (not (eq mode 'ethiopic)) | |
1076 (progn | |
1077 (insert flag) | |
1078 (setq mode 'ethiopic))) | |
1079 | |
1080 (cond ; fidel, punc, digit | |
17052 | 1081 |
17299 | 1082 ;; fidels |
1083 ((or (<= ch 346) ; he - fYa | |
1084 (and (>= ch 384) (<= ch 444)) ; `qe - pw | |
1085 (and (>= ch 453) (<= ch 457))) ; wWe - wW | |
1086 (if (and (memq ch '(160 161 162 163 164 166 167)) ; (e - ea) | |
1087 (or lonec | |
1088 (and ethio-quote-vowel-always | |
1089 fidel))) | |
1090 (insert "'")) | |
1091 (insert (aref ethio-fidel-to-sera-map ch)) | |
1092 (setq lonec (ethio-lone-consonant-p ch) | |
1093 fidel t | |
1094 digit nil)) | |
1095 | |
1096 ;; punctuations or icons | |
1097 ((or (and (>= ch 353) (<= ch 360)) ; : - :|: | |
1098 (>= ch 458) ; '' - ? | |
1099 (and (>= ch 448) (<= ch 452))) ; \~X \~e \~E \~a \~A | |
1100 (insert (aref ethio-fidel-to-sera-map ch)) | |
1101 (setq lonec nil | |
1102 fidel nil | |
1103 digit nil)) | |
1104 | |
1105 ;; now CH must be an ethiopic digit | |
17052 | 1106 |
17299 | 1107 ;; reduction = 0 or not preceded by Ethiopic number(s) |
1108 ((or (= ethio-numeric-reduction 0) | |
1109 (not digit)) | |
1110 (insert "`" (aref ethio-fidel-to-sera-map ch)) | |
1111 (setq lonec nil | |
1112 fidel nil | |
1113 digit t)) | |
17052 | 1114 |
17299 | 1115 ;; reduction = 2 and following 10s, 100s, 10000s |
1116 ((and (= ethio-numeric-reduction 2) | |
1117 (memq ch '(370 379 380))) | |
1118 (insert (substring (aref ethio-fidel-to-sera-map ch) 1)) | |
1119 (setq lonec nil | |
1120 fidel nil | |
1121 digit t)) | |
1122 | |
1123 ;; ordinary following digits | |
1124 (t | |
1125 (insert (aref ethio-fidel-to-sera-map ch)) | |
1126 (setq lonec nil | |
1127 fidel nil | |
1128 digit t)))) | |
17052 | 1129 |
17299 | 1130 ;; english character. must go to english mode, if not in it. |
1131 ((or (and (>= ch ?a) (<= ch ?z)) | |
1132 (and (>= ch ?A) (<= ch ?Z))) | |
1133 (if (not (eq mode 'english)) | |
1134 (insert "\\~eng ")) | |
1135 (forward-char 1) | |
1136 (setq mode 'english | |
1137 lonec nil | |
1138 fidel nil | |
1139 digit nil)) | |
1140 | |
1141 ;; ch can appear both in ethiopic section and in english section. | |
1142 (t | |
17052 | 1143 |
17299 | 1144 ;; we must decide the mode, if not decided yet |
1145 (if (null mode) | |
1146 (progn | |
1147 (setq mode | |
1148 (if secondary | |
1149 ethio-secondary-language | |
1150 ethio-primary-language)) | |
1151 (if (eq mode 'english) | |
1152 (insert "\\~eng ") | |
1153 (insert flag) | |
1154 (setq mode 'ethiopic)))) ; tigrigna & amharic --> ethiopic | |
17052 | 1155 |
17299 | 1156 (cond ; \ , eng-mode , punc , w3 , other |
17052 | 1157 |
1158 ;; backslash is always quoted | |
1159 ((= ch ?\\ ) | |
17299 | 1160 (insert "\\") |
1161 (forward-char 1)) | |
17052 | 1162 |
17299 | 1163 ;; nothing to do if in english mode |
1164 ((eq mode 'english) | |
1165 (forward-char 1)) | |
1166 | |
1167 ;; now we must be in ethiopic mode and seeing a non-"\" | |
17052 | 1168 |
17299 | 1169 ;; ascii punctuations in ethiopic mode |
1170 ((looking-at "[,.;:'`?]+") | |
1171 (insert "\\") | |
1172 (goto-char (1+ (match-end 0)))) ; because we inserted one byte (\) | |
17052 | 1173 |
17299 | 1174 ;; skip from "<" to ">" (or from "&" to ";") if called from w3 |
1175 ((and (boundp 'sera-being-called-by-w3) | |
1176 sera-being-called-by-w3 | |
1177 (or (= ch ?<) (= ch ?&))) | |
1178 (search-forward (if (= ch ?<) ">" ";") | |
1179 nil 0)) | |
17052 | 1180 |
17299 | 1181 ;; neutral character. no need to quote. just skip it. |
1182 (t | |
1183 (forward-char 1))) | |
1184 | |
17052 | 1185 (setq lonec nil |
1186 fidel nil | |
1187 digit nil))) | |
17299 | 1188 ;; end of main conversion routine |
1189 ))) | |
17052 | 1190 |
17299 | 1191 (defun ethio-lone-consonant-p (ethiocode) |
1192 "If ETHIOCODE is an Ethiopic lone consonant, return t." | |
1193 (or (and (< ethiocode 344) (= (% ethiocode 8) 5)) | |
1194 | |
1195 ;; `q `k X `g mW bW GW fW pW wW | |
1196 (memq ethiocode '(389 405 421 437 440 441 442 443 444 457)))) | |
17052 | 1197 |
1198 ;;;###autoload | |
19858
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1199 (defun ethio-fidel-to-sera-mail-or-marker (&optional arg) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1200 "Execute ethio-fidel-to-sera-mail or ethio-fidel-to-sera-marker depending on the current major mode. |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1201 If in rmail-mode or in mail-mode, execute the former; otherwise latter." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1202 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1203 (interactive "P") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1204 (if (or (eq major-mode 'rmail-mode) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1205 (eq major-mode 'mail-mode)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1206 (ethio-fidel-to-sera-mail) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1207 (ethio-fidel-to-sera-marker arg))) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1208 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1209 ;;;###autoload |
17299 | 1210 (defun ethio-fidel-to-sera-mail nil |
1211 "Convert FIDEL to SERA to read/write mail and news. | |
17052 | 1212 |
17299 | 1213 If the body contains at least one Ethiopic character, |
1214 1) insert the string \"<sera>\" at the beginning of the body, | |
1215 2) insert \"</sera>\" at the end of the body, and | |
1216 3) convert the body into SERA. | |
1217 | |
1218 The very same procedure applies to the subject field, too." | |
17052 | 1219 |
1220 (interactive) | |
17299 | 1221 (let ((buffer-read-only nil) |
1222 border) | |
1223 (save-excursion | |
17052 | 1224 |
21871
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
1225 ;; follow RFC822 rules instead of looking for a fixed separator |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
1226 (rfc822-goto-eoh) |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
1227 (forward-line 1) |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
1228 (setq border (point)) |
594b894aada5
(ethio-sera-to-fidel-mail): Use rfc822-goto-eoh.
Richard M. Stallman <rms@gnu.org>
parents:
19858
diff
changeset
|
1229 |
17299 | 1230 ;; process body first not to change the border |
1231 ;; note that the point is already at the border | |
1232 (if (re-search-forward "\\ce" nil t) | |
1233 (progn | |
1234 (ethio-fidel-to-sera-region border (point-max)) | |
1235 (goto-char border) | |
1236 (insert "<sera>") | |
1237 (goto-char (point-max)) | |
1238 (insert "</sera>"))) | |
17052 | 1239 |
17299 | 1240 ;; process subject |
1241 (goto-char (point-min)) | |
1242 (if (re-search-forward "^Subject: " border t) | |
1243 (let ((beg (point)) | |
1244 (end (line-end-position))) | |
1245 (if (re-search-forward "\\ce" end t) | |
1246 (progn | |
1247 (ethio-fidel-to-sera-region beg end) | |
1248 (goto-char beg) | |
1249 (insert "<sera>") | |
1250 (end-of-line) | |
1251 (insert "</sera>"))))) | |
17052 | 1252 |
17299 | 1253 ;; adjust the rmail marker |
1254 (if (eq major-mode 'rmail-mode) | |
1255 (set-marker | |
1256 (aref rmail-message-vector (1+ rmail-current-message)) | |
1257 (point-max)))))) | |
17052 | 1258 |
1259 ;;;###autoload | |
17299 | 1260 (defun ethio-fidel-to-sera-marker (&optional force) |
1261 "Convert the regions surrounded by \"<sera>\" and \"</sera>\" from FIDEL to SERA. | |
1262 The markers \"<sera>\" and \"</sera>\" themselves are not deleted." | |
17052 | 1263 |
17299 | 1264 (interactive "P") |
17052 | 1265 (if (and buffer-read-only |
17299 | 1266 (not force) |
17052 | 1267 (not (y-or-n-p "Buffer is read-only. Force to convert? "))) |
1268 (error "")) | |
1269 (save-excursion | |
1270 (goto-char (point-min)) | |
17299 | 1271 (while (re-search-forward "<sera>" nil t) |
1272 (ethio-fidel-to-sera-region | |
17052 | 1273 (point) |
17299 | 1274 (if (re-search-forward "</sera>" nil t) |
17052 | 1275 (match-beginning 0) |
1276 (point-max)) | |
1277 nil | |
1278 'force)))) | |
1279 | |
1280 ;; | |
1281 ;; vowel modification | |
1282 ;; | |
1283 | |
1284 ;;;###autoload | |
17299 | 1285 (defun ethio-modify-vowel nil |
17052 | 1286 "Modify the vowel of the FIDEL that is under the cursor." |
1287 (interactive) | |
17299 | 1288 (let ((ch (following-char)) |
1289 (composite nil) ; geminated or not | |
1290 newch base vowel modulo) | |
1291 | |
1292 (cond | |
1293 ;; in case of gemination | |
1294 ((eq (char-charset ch) 'composition) | |
1295 (setq ch (string-to-char (decompose-composite-char ch)) | |
1296 composite t)) | |
1297 ;; neither gemination nor fidel | |
1298 ((not (eq (char-charset ch) 'ethiopic)) | |
1299 (error "Not a valid character."))) | |
1300 | |
1301 ;; set frequently referred character features | |
1302 (setq ch (ethio-char-to-ethiocode ch) | |
1303 base (* (/ ch 8) 8) | |
1304 modulo (% ch 8)) | |
1305 | |
1306 (if (or (and (>= ch 344) (<= ch 380)) ;; mYa - `10000 | |
1307 (and (>= ch 448) (<= ch 452)) ;; \~X - \~A | |
1308 (>= ch 458)) ;; private punctuations | |
17052 | 1309 (error "Not a valid character.")) |
17299 | 1310 |
1311 (setq | |
1312 newch | |
1313 (cond | |
1314 | |
1315 ;; first standalone vowels | |
1316 ((= base 160) | |
1317 (if (ethio-prefer-amharic-p) | |
1318 (message "Modify vowel to: [auiAEIoW\"] ") | |
1319 (message "Modify vowel to: [euiAEIoW\"] ")) | |
1320 (setq vowel (read-char)) | |
1321 (cond | |
1322 ((= vowel ?e) 160) | |
1323 ((= vowel ?u) 161) | |
1324 ((= vowel ?i) 162) | |
1325 ((= vowel ?A) 163) | |
1326 ((= vowel ?E) 164) | |
1327 ((= vowel ?I) 165) | |
1328 ((= vowel ?o) 166) | |
1329 ((= vowel ?W) 167) | |
1330 ((= vowel ?a) (if (ethio-prefer-amharic-p) 160 163)) | |
1331 ((= vowel ?\") (setq composite t) ch) | |
1332 (t nil))) | |
1333 | |
1334 ;; second standalone vowels | |
1335 ((= base 208) | |
1336 (message "Modify vowel to: [euiaEIo\"] ") | |
1337 (setq vowel (read-char)) | |
1338 (cond | |
1339 ((= vowel ?e) 208) | |
1340 ((= vowel ?u) 209) | |
1341 ((= vowel ?i) 210) | |
1342 ((= vowel ?a) 211) | |
1343 ((= vowel ?E) 212) | |
1344 ((= vowel ?I) 213) | |
1345 ((= vowel ?o) 214) | |
1346 ((= vowel ?\") (setq composite t) ch) | |
1347 (t nil))) | |
1348 | |
1349 ;; 12-form consonants, *W* form | |
1350 ((memq base '(72 88 136 176 192 272)) ; qW QW hW kW KW gW | |
1351 (message "Modify vowel to: [euiaE'\"] ") | |
1352 (setq vowel (read-char)) | |
1353 (cond | |
1354 ((= vowel ?e) base) | |
1355 ((= vowel ?u) (+ base 5)) | |
1356 ((= vowel ?i) (+ base 2)) | |
1357 ((= vowel ?a) (+ base 3)) | |
1358 ((= vowel ?E) (+ base 4)) | |
1359 ((= vowel ?') (+ base 5)) | |
1360 ((= vowel ?\") (setq composite t) ch) | |
1361 (t nil))) | |
1362 | |
1363 ;; extended 12-form consonants, mWa bWa GWa fWa pWa | |
1364 ((= ch 31) ; mWa | |
1365 (message "Modify vowel to: [euiaE'\"] ") | |
1366 (setq vowel (read-char)) | |
1367 (cond | |
1368 ((= vowel ?e) 392) | |
1369 ((= vowel ?u) 440) | |
1370 ((= vowel ?i) 408) | |
1371 ((= vowel ?a) ch) | |
1372 ((= vowel ?E) 424) | |
1373 ((= vowel ?') 440) | |
1374 ((= vowel ?\") (setq composite t) ch) | |
1375 (t nil))) | |
1376 ((= ch 103) ; bWa | |
1377 (message "Modify vowel to: [euiaE'\"] ") | |
1378 (setq vowel (read-char)) | |
1379 (cond | |
1380 ((= vowel ?e) 393) | |
1381 ((= vowel ?u) 441) | |
1382 ((= vowel ?i) 409) | |
1383 ((= vowel ?a) ch) | |
1384 ((= vowel ?E) 425) | |
1385 ((= vowel ?') 441) | |
1386 ((= vowel ?\") (setq composite t) ch) | |
1387 (t nil))) | |
1388 ((= ch 287) ; GWa | |
1389 (message "Modify vowel to: [euiaE'\"] ") | |
1390 (setq vowel (read-char)) | |
1391 (cond | |
1392 ((= vowel ?e) 394) | |
1393 ((= vowel ?u) 442) | |
1394 ((= vowel ?i) 410) | |
1395 ((= vowel ?a) ch) | |
1396 ((= vowel ?E) 426) | |
1397 ((= vowel ?') 442) | |
1398 ((= vowel ?\") (setq composite t) ch) | |
1399 (t nil))) | |
1400 ((= ch 335) ; fWa | |
1401 (message "Modify vowel to: [euiaE'\"] ") | |
1402 (setq vowel (read-char)) | |
1403 (cond | |
1404 ((= vowel ?e) 395) | |
1405 ((= vowel ?u) 443) | |
1406 ((= vowel ?i) 411) | |
1407 ((= vowel ?a) ch) | |
1408 ((= vowel ?E) 427) | |
1409 ((= vowel ?') 443) | |
1410 ((= vowel ?\") (setq composite t) ch) | |
1411 (t nil))) | |
1412 ((= ch 343) ; pWa | |
1413 (message "Modify vowel to: [euiaE'\"] ") | |
1414 (setq vowel (read-char)) | |
1415 (cond | |
1416 ((= vowel ?e) 396) | |
1417 ((= vowel ?u) 444) | |
1418 ((= vowel ?i) 412) | |
1419 ((= vowel ?a) ch) | |
1420 ((= vowel ?E) 428) | |
1421 ((= vowel ?') 444) | |
1422 ((= vowel ?\") (setq composite t) ch) | |
1423 (t nil))) | |
1424 | |
1425 ;; extended 12-form consonatns, mW* bW* GW* fW* pW* | |
1426 ((memq base '(392 408 424 440)) ; *We *Wi *WE *W | |
1427 (message "Modify vowel to: [eiEau'\"] ") | |
1428 (setq vowel (read-char)) | |
1429 (cond | |
1430 ((= vowel ?e) (+ 392 modulo)) | |
1431 ((= vowel ?i) (+ 408 modulo)) | |
1432 ((= vowel ?E) (+ 424 modulo)) | |
1433 ((= vowel ?a) (cond | |
1434 ((= modulo 0) 31) ; mWa | |
1435 ((= modulo 1) 103) ; bWa | |
1436 ((= modulo 2) 287) ; GWa | |
1437 ((= modulo 3) 335) ; fWa | |
1438 ((= modulo 4) 343) ; pWa | |
1439 (t nil))) ; never reach here | |
1440 ((= vowel ?') (+ 440 modulo)) | |
1441 ((= vowel ?u) (+ 440 modulo)) | |
1442 ((= vowel ?\") (setq composite t) ch) | |
1443 (t nil))) | |
1444 | |
1445 ((and (>= ch 453) (<= ch 457)) ; wWe wWi wWa wWE wW | |
1446 (message "Modify vowel to: [eiaE'u\"] ") | |
1447 (setq vowel (read-char)) | |
1448 (cond | |
1449 ((= vowel ?e) 453) | |
1450 ((= vowel ?i) 454) | |
1451 ((= vowel ?a) 455) | |
1452 ((= vowel ?E) 456) | |
1453 ((= vowel ?') 457) | |
1454 ((= vowel ?u) 457) | |
1455 ((= vowel ?\") (setq composite t) ch) | |
1456 (t nil))) | |
1457 | |
1458 ;; 7-form consonants, or | |
1459 ;; first 7 of 8-form consonants | |
1460 ((<= modulo 6) | |
1461 (message "Modify vowel to: [euiaE'o\"] ") | |
1462 (setq vowel (read-char)) | |
1463 (cond | |
1464 ((= vowel ?e) base) | |
1465 ((= vowel ?u) (+ base 1)) | |
1466 ((= vowel ?i) (+ base 2)) | |
1467 ((= vowel ?a) (+ base 3)) | |
1468 ((= vowel ?E) (+ base 4)) | |
1469 ((= vowel ?') (+ base 5)) | |
1470 ((= vowel ?o) (+ base 6)) | |
1471 ((= vowel ?\") (setq composite t) ch) | |
1472 (t nil))) | |
1473 | |
1474 ;; otherwise | |
1475 (t | |
1476 nil))) | |
17052 | 1477 |
1478 (cond | |
1479 | |
17299 | 1480 ;; could not get new character |
1481 ((null newch) | |
1482 (error "Invalid vowel")) | |
1483 | |
1484 ;; vowel changed on a composite Fidel | |
1485 (composite | |
1486 (delete-char 1) | |
1487 (insert | |
1488 (compose-string | |
1489 (concat (char-to-string (ethio-ethiocode-to-char newch)) "$(3%s(B")))) | |
17052 | 1490 |
17299 | 1491 ;; simple vowel modification |
1492 (t | |
1493 (delete-char 1) | |
1494 (insert (ethio-ethiocode-to-char newch)))))) | |
17052 | 1495 |
17299 | 1496 (defun ethio-ethiocode-to-char (ethiocode) |
1497 (make-char | |
1498 'ethiopic | |
1499 (+ (/ ethiocode 94) 33) | |
1500 (+ (mod ethiocode 94) 33))) | |
17052 | 1501 |
17299 | 1502 (defun ethio-char-to-ethiocode (ch) |
17052 | 1503 (and (eq (char-charset ch) 'ethiopic) |
1504 (let ((char-components (split-char ch))) | |
17299 | 1505 (+ (* (- (nth 1 char-components) 33) 94) |
1506 (- (nth 2 char-components) 33))))) | |
17052 | 1507 |
1508 ;; | |
1509 ;; space replacement | |
1510 ;; | |
1511 | |
1512 ;;;###autoload | |
1513 (defun ethio-replace-space (ch begin end) | |
17299 | 1514 "Replace ASCII spaces with Ethiopic word separators in the region. |
1515 | |
1516 In the specified region, replace word separators surrounded by two | |
1517 Ethiopic characters, depending on the first parameter CH, which should | |
1518 be 1, 2, or 3. | |
1519 | |
1520 If CH = 1, word separator will be replaced with an ASCII space. | |
1521 If CH = 2, with two ASCII spaces. | |
1522 If CH = 3, with the Ethiopic colon-like word separator. | |
1523 | |
1524 The second and third parameters BEGIN and END specify the region." | |
1525 | |
17052 | 1526 (interactive "*cReplace spaces to: 1 (sg col), 2 (dbl col), 3 (Ethiopic)\nr") |
1527 (if (not (memq ch '(?1 ?2 ?3))) | |
1528 (error "")) | |
1529 (save-excursion | |
1530 (save-restriction | |
1531 (narrow-to-region begin end) | |
1532 | |
1533 (cond | |
1534 ((= ch ?1) | |
17299 | 1535 ;; an Ethiopic word separator --> an ASCII space |
1536 (goto-char (point-min)) | |
1537 (while (search-forward "$(3$h(B" nil t) | |
1538 (replace-match " " nil t)) | |
17052 | 1539 |
17299 | 1540 ;; two ASCII spaces between Ethiopic characters --> an ASCII space |
1541 (goto-char (point-min)) | |
1542 (while (re-search-forward "\\(\\ce\\) \\(\\ce\\)" nil t) | |
1543 (replace-match "\\1 \\2") | |
1544 (goto-char (match-beginning 2)))) | |
17052 | 1545 |
1546 ((= ch ?2) | |
17299 | 1547 ;; An Ethiopic word separator --> two ASCII spaces |
17052 | 1548 (goto-char (point-min)) |
17299 | 1549 (while (search-forward "$(3$h(B" nil t) |
1550 (replace-match " ")) | |
17052 | 1551 |
17299 | 1552 ;; An ASCII space between Ethiopic characters --> two ASCII spaces |
1553 (goto-char (point-min)) | |
1554 (while (re-search-forward "\\(\\ce\\) \\(\\ce\\)" nil t) | |
1555 (replace-match "\\1 \\2") | |
17052 | 1556 (goto-char (match-beginning 2)))) |
1557 | |
17299 | 1558 (t |
1559 ;; One or two ASCII spaces between Ethiopic characters | |
1560 ;; --> An Ethiopic word separator | |
1561 (goto-char (point-min)) | |
1562 (while (re-search-forward "\\(\\ce\\) ?\\(\\ce\\)" nil t) | |
1563 (replace-match "\\1$(3$h(B\\2") | |
1564 (goto-char (match-beginning 2))) | |
17052 | 1565 |
17299 | 1566 ;; Three or more ASCII spaces between Ethiopic characters |
1567 ;; --> An Ethiopic word separator + (N - 2) ASCII spaces | |
1568 (goto-char (point-min)) | |
1569 (while (re-search-forward "\\(\\ce\\) \\( *\\ce\\)" nil t) | |
1570 (replace-match "\\1$(3$h(B\\2") | |
1571 (goto-char (match-beginning 2)))))))) | |
17052 | 1572 |
1573 ;; | |
17299 | 1574 ;; special icons |
17052 | 1575 ;; |
1576 | |
1577 ;;;###autoload | |
1578 (defun ethio-input-special-character (arg) | |
1579 "Allow the user to input special characters." | |
17299 | 1580 (interactive "*cInput number: 1.$(3%j(B 2.$(3%k(B 3.$(3%l(B 4.$(3%m(B 5.$(3%i(B") |
17052 | 1581 (cond |
1582 ((= arg ?1) | |
17299 | 1583 (insert "$(3%j(B")) |
17052 | 1584 ((= arg ?2) |
17299 | 1585 (insert "$(3%k(B")) |
17052 | 1586 ((= arg ?3) |
17299 | 1587 (insert "$(3%l(B")) |
17052 | 1588 ((= arg ?4) |
17299 | 1589 (insert "$(3%m(B")) |
1590 ((= arg ?5) | |
1591 (insert "$(3%i(B")) | |
17052 | 1592 (t |
1593 (error "")))) | |
1594 | |
1595 ;; | |
17299 | 1596 ;; TeX support |
1597 ;; | |
1598 | |
17774
ade41b936c3e
(fidel-to-tex-map): Name changed to ethio-fidel-to-tex-map.
Kenichi Handa <handa@m17n.org>
parents:
17315
diff
changeset
|
1599 (defconst ethio-fidel-to-tex-map |
17299 | 1600 [ "heG" "huG" "hiG" "haG" "hEG" "hG" "hoG" "" ;; 0 - 7 |
1601 "leG" "luG" "liG" "laG" "lEG" "lG" "loG" "lWaG" ;; 8 | |
1602 "HeG" "HuG" "HiG" "HaG" "HEG" "HG" "HoG" "HWaG" ;; 16 | |
1603 "meG" "muG" "miG" "maG" "mEG" "mG" "moG" "mWaG" ;; 24 | |
1604 "sseG" "ssuG" "ssiG" "ssaG" "ssEG" "ssG" "ssoG" "ssWaG" ;; 32 | |
1605 "reG" "ruG" "riG" "raG" "rEG" "rG" "roG" "rWaG" ;; 40 | |
1606 "seG" "suG" "siG" "saG" "sEG" "sG" "soG" "sWaG" ;; 48 | |
1607 "xeG" "xuG" "xiG" "xaG" "xEG" "xG" "xoG" "xWaG" ;; 56 | |
18306
6148a6f19ded
Provide ethio-util instead of language/ethio-util.
Kenichi Handa <handa@m17n.org>
parents:
17993
diff
changeset
|
1608 "qeG" "quG" "qiG" "qaG" "qEG" "qG" "qoG" "" ;; 64 |
6148a6f19ded
Provide ethio-util instead of language/ethio-util.
Kenichi Handa <handa@m17n.org>
parents:
17993
diff
changeset
|
1609 "qWeG" "" "qWiG" "qWaG" "qWEG" "qWG" "" "" ;; 72 |
17299 | 1610 "QeG" "QuG" "QiG" "QaG" "QEG" "QG" "QoG" "" ;; 80 |
1611 "QWeG" "" "QWiG" "QWaG" "QWEG" "QWG" "" "" ;; 88 | |
1612 "beG" "buG" "biG" "baG" "bEG" "bG" "boG" "bWaG" ;; 96 | |
1613 "veG" "vuG" "viG" "vaG" "vEG" "vG" "voG" "vWaG" ;; 104 | |
1614 "teG" "tuG" "tiG" "taG" "tEG" "tG" "toG" "tWaG" ;; 112 | |
1615 "ceG" "cuG" "ciG" "caG" "cEG" "cG" "coG" "cWaG" ;; 120 | |
1616 "hheG" "hhuG" "hhiG" "hhaG" "hhEG" "hhG" "hhoG" "" ;; 128 | |
1617 "hWeG" "" "hWiG" "hWaG" "hWEG" "hWG" "" "" ;; 136 | |
1618 "neG" "nuG" "niG" "naG" "nEG" "nG" "noG" "nWaG" ;; 144 | |
1619 "NeG" "NuG" "NiG" "NaG" "NEG" "NG" "NoG" "NWaG" ;; 152 | |
18306
6148a6f19ded
Provide ethio-util instead of language/ethio-util.
Kenichi Handa <handa@m17n.org>
parents:
17993
diff
changeset
|
1620 "eG" "uG" "iG" "AG" "EG" "IG" "oG" "eaG" ;; 160 |
17299 | 1621 "keG" "kuG" "kiG" "kaG" "kEG" "kG" "koG" "" ;; 168 |
18306
6148a6f19ded
Provide ethio-util instead of language/ethio-util.
Kenichi Handa <handa@m17n.org>
parents:
17993
diff
changeset
|
1622 "kWeG" "" "kWiG" "kWaG" "kWEG" "kWG" "" "" ;; 176 |
17299 | 1623 "KeG" "KuG" "KiG" "KaG" "KEG" "KG" "KoG" "" ;; 184 |
18306
6148a6f19ded
Provide ethio-util instead of language/ethio-util.
Kenichi Handa <handa@m17n.org>
parents:
17993
diff
changeset
|
1624 "KWeG" "" "KWiG" "KWaG" "KWEG" "KWG" "" "" ;; 192 |
17299 | 1625 "weG" "wuG" "wiG" "waG" "wEG" "wG" "woG" "" ;; 200 |
1626 "eeG" "uuG" "iiG" "aaG" "EEG" "IIG" "ooG" "" ;; 208 | |
1627 "zeG" "zuG" "ziG" "zaG" "zEG" "zG" "zoG" "zWaG" ;; 216 | |
1628 "ZeG" "ZuG" "ZiG" "ZaG" "ZEG" "ZG" "ZoG" "ZWaG" ;; 224 | |
1629 "yeG" "yuG" "yiG" "yaG" "yEG" "yG" "yoG" "yWaG" ;; 232 | |
1630 "deG" "duG" "diG" "daG" "dEG" "dG" "doG" "dWaG" ;; 240 | |
1631 "DeG" "DuG" "DiG" "DaG" "DEG" "DG" "DoG" "DWaG" ;; 248 | |
1632 "jeG" "juG" "jiG" "jaG" "jEG" "jG" "joG" "jWaG" ;; 256 | |
1633 "geG" "guG" "giG" "gaG" "gEG" "gG" "goG" "" ;; 264 | |
1634 "gWeG" "" "gWiG" "gWaG" "gWEG" "gWG" "" "" ;; 272 | |
1635 "GeG" "GuG" "GiG" "GaG" "GEG" "GG" "GoG" "GWaG" ;; 280 | |
1636 "TeG" "TuG" "TiG" "TaG" "TEG" "TG" "ToG" "TWaG" ;; 288 | |
1637 "CeG" "CuG" "CiG" "CaG" "CEG" "CG" "CoG" "CWaG" ;; 296 | |
1638 "PeG" "PuG" "PiG" "PaG" "PEG" "PG" "PoG" "PWaG" ;; 304 | |
1639 "SeG" "SuG" "SiG" "SaG" "SEG" "SG" "SoG" "SWaG" ;; 312 | |
1640 "SSeG" "SSuG" "SSiG" "SSaG" "SSEG" "SSG" "SSoG" "" ;; 320 | |
1641 "feG" "fuG" "fiG" "faG" "fEG" "fG" "foG" "fWaG" ;; 328 | |
1642 "peG" "puG" "piG" "paG" "pEG" "pG" "poG" "pWaG" ;; 336 | |
1643 "mYaG" "rYaG" "fYaG" "" "" "" "" "" ;; 344 | |
1644 "" "spaceG" "periodG" "commaG" ;; 352 | |
1645 "semicolonG" "colonG" "precolonG" "oldqmarkG" ;; 356 | |
1646 "pbreakG" "andG" "huletG" "sostG" "aratG" "amstG" "sadstG" "sabatG" ;; 360 | |
1647 "smntG" "zeteNG" "asrG" "heyaG" "selasaG" "arbaG" "hemsaG" "slsaG" ;; 368 | |
1648 "sebaG" "semanyaG" "zeTanaG" "metoG" "asrxiG" "" "" "" ;; 376 | |
1649 "qqeG" "qquG" "qqiG" "qqaG" "qqEG" "qqG" "qqoG" "" ;; 384 | |
1650 "mWeG" "bWeG" "GWeG" "fWeG" "pWeG" "" "" "" ;; 392 | |
1651 "kkeG" "kkuG" "kkiG" "kkaG" "kkEG" "kkG" "kkoG" "" ;; 400 | |
1652 "mWiG" "bWiG" "GWiG" "fWiG" "pWiG" "" "" "" ;; 408 | |
1653 "XeG" "XuG" "GXiG" "XaG" "XEG" "XG" "XoG" "" ;; 416 | |
1654 "mWEG" "bWEG" "GWEG" "fWEG" "pWEG" "" "" "" ;; 424 | |
1655 "ggeG" "gguG" "ggiG" "ggaG" "ggEG" "ggG" "ggoG" "" ;; 432 | |
1656 "mWG" "bWG" "GWG" "fWG" "pWG" "" "" "" ;; 440 | |
1657 "ornamentG" "flandG" "iflandG" "africaG" ;; 448 | |
1658 "iafricaG" "wWeG" "wWiG" "wWaG" ;; 452 | |
1659 "wWEG" "wWG" "" "slaqG" "dotG" "lquoteG" "rquoteG" "qmarkG" ]) ;; 456 | |
1660 | |
1661 ;; | |
1662 ;; To make tex-to-fidel mapping. | |
1663 ;; The following code makes | |
1664 ;; (get 'ethio-tex-command-he 'ethio-fidel-char) ==> ?$(3!!(B | |
1665 ;; etc. | |
1666 ;; | |
1667 | |
1668 (let ((i 0) str) | |
1669 (while (< i (length ethio-fidel-to-tex-map)) | |
1670 (setq str (aref ethio-fidel-to-tex-map i)) | |
1671 (if (not (string= str "")) | |
1672 (put | |
1673 (intern (concat "ethio-tex-command-" (aref ethio-fidel-to-tex-map i))) | |
1674 'ethio-fidel-char | |
1675 (ethio-ethiocode-to-char i))) | |
1676 (setq i (1+ i)))) | |
1677 | |
1678 ;;;###autoload | |
1679 (defun ethio-fidel-to-tex-buffer nil | |
1680 "Convert each fidel characters in the current buffer into a fidel-tex command. | |
1681 Each command is always surrounded by braces." | |
1682 (interactive) | |
1683 (let ((buffer-read-only nil)) | |
1684 | |
1685 ;; Isolated gemination marks need special treatement | |
1686 (goto-char (point-min)) | |
1687 (while (search-forward "$(3%s(B" nil t) | |
1688 (replace-match "\\geminateG{}" t t)) | |
1689 | |
1690 ;; First, decompose geminations | |
1691 ;; Here we assume that each composed character consists of | |
1692 ;; one Ethiopic character and the Ethiopic gemination mark. | |
1693 (decompose-region (point-min) (point-max)) | |
1694 | |
1695 ;; Special treatment for geminated characters | |
1696 ;; The geminated character (la'') will be "\geminateG{\la}". | |
1697 (goto-char (point-min)) | |
1698 (while (search-forward "$(3%s(B" nil t) | |
1699 (delete-backward-char 1) | |
1700 (backward-char 1) | |
1701 (insert "\\geminateG") | |
1702 (forward-char 1)) | |
1703 | |
1704 ;; Ethiopic characters to TeX macros | |
1705 (goto-char (point-min)) | |
1706 (while (re-search-forward "\\ce" nil t) | |
1707 (insert | |
1708 "{\\" | |
1709 (aref ethio-fidel-to-tex-map | |
1710 (prog1 (ethio-char-to-ethiocode (preceding-char)) | |
1711 (backward-delete-char 1))) | |
1712 "}")) | |
1713 (goto-char (point-min)) | |
1714 (set-buffer-modified-p nil))) | |
1715 | |
1716 ;;;###autoload | |
1717 (defun ethio-tex-to-fidel-buffer nil | |
1718 "Convert fidel-tex commands in the current buffer into fidel chars." | |
1719 (interactive) | |
1720 (let ((buffer-read-only nil) | |
1721 (p) (ch)) | |
1722 | |
1723 ;; Special treatment for gemination | |
1724 ;; "\geminateG{\la}" or "\geminateG{{\la}}" will be "\la$(3%s(B" | |
1725 ;; "\geminateG{}" remains unchanged. | |
1726 (goto-char (point-min)) | |
1727 (while (re-search-forward "\\\\geminateG{\\(\\\\[a-zA-Z]+\\)}" nil t) | |
1728 (replace-match "\\1$(3%s(B")) | |
1729 | |
1730 ;; TeX macros to Ethiopic characters | |
1731 (goto-char (point-min)) | |
1732 (while (search-forward "\\" nil t) | |
1733 (setq p (point)) | |
1734 (skip-chars-forward "a-zA-Z") | |
1735 (setq ch | |
1736 (get (intern (concat "ethio-tex-command-" | |
1737 (buffer-substring p (point)))) | |
1738 'ethio-fidel-char)) | |
1739 (if ch | |
1740 (progn | |
1741 (delete-region (1- p) (point)) ; don't forget the preceding "\" | |
1742 (if (and (= (preceding-char) ?{) | |
1743 (= (following-char) ?})) | |
1744 (progn | |
1745 (backward-delete-char 1) | |
1746 (delete-char 1))) | |
1747 (insert ch)))) | |
1748 | |
1749 ;; compose geminated characters | |
1750 (goto-char (point-min)) | |
1751 (while (re-search-forward "\\ce$(3%s(B" nil 0) | |
1752 (compose-region | |
1753 (save-excursion (backward-char 2) (point)) | |
1754 (point))) | |
1755 | |
1756 ;; Now it's time to convert isolated gemination marks. | |
1757 (goto-char (point-min)) | |
1758 (while (search-forward "\\geminateG{}" nil t) | |
1759 (replace-match "$(3%s(B")) | |
1760 | |
1761 (goto-char (point-min)) | |
1762 (set-buffer-modified-p nil))) | |
1763 | |
1764 ;; | |
1765 ;; Java support | |
1766 ;; | |
1767 | |
1768 ;;;###autoload | |
1769 (defun ethio-fidel-to-java-buffer nil | |
1770 "Convert Ethiopic characters into the Java escape sequences. | |
1771 | |
1772 Each escape sequence is of the form \uXXXX, where XXXX is the | |
1773 character's codepoint (in hex) in Unicode. | |
1774 | |
1775 If `ethio-java-save-lowercase' is non-nil, use [0-9a-f]. | |
1776 Otherwise, [0-9A-F]." | |
1777 (let ((ucode)) | |
1778 | |
1779 ;; first, decompose geminations | |
1780 (decompose-region (point-min) (point-max)) | |
1781 | |
1782 (goto-char (point-min)) | |
1783 (while (re-search-forward "\\ce" nil t) | |
1784 (setq ucode (+ ?\x1200 (ethio-char-to-ethiocode (preceding-char)))) | |
1785 (if (> ucode ?\x13bc) | |
1786 (setq ucode (+ ucode 59952))) | |
1787 (delete-backward-char 1) | |
1788 (if ethio-java-save-lowercase | |
1789 (insert (format "\\u%4x" ucode)) | |
1790 (insert (upcase (format "\\u%4x" ucode))))))) | |
1791 | |
1792 ;;;###autoload | |
1793 (defun ethio-java-to-fidel-buffer nil | |
1794 "Convert the Java escape sequences into corresponding Ethiopic characters." | |
1795 (let ((ucode)) | |
1796 (goto-char (point-min)) | |
1797 (while (re-search-forward "\\\\u\\([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\\)" nil t) | |
1798 (setq ucode | |
1799 (read | |
1800 (concat | |
1801 "?\\x" | |
1802 (buffer-substring (match-beginning 1) (match-end 1))))) | |
1803 (cond | |
1804 ((and (>= ucode ?\x1200) (<= ucode ?\x13bc)) | |
1805 (replace-match "") | |
1806 (insert (ethio-ethiocode-to-char (- ucode ?\x1200)))) | |
1807 ((and (>= ucode ?\xfdf1) (<= ucode ?\xfdff)) | |
1808 (replace-match "") | |
1809 (insert (ethio-ethiocode-to-char (- ucode 64560)))) | |
1810 (t | |
1811 nil))) | |
1812 | |
1813 ;; gemination | |
1814 (goto-char (point-min)) | |
1815 (while (re-search-forward "\\ce$(3%s(B" nil 0) | |
1816 (compose-region | |
1817 (save-excursion (backward-char 2) (point)) | |
1818 (point))) | |
1819 )) | |
1820 | |
1821 ;; | |
1822 ;; file I/O hooks | |
1823 ;; | |
1824 | |
1825 ;;;###autoload | |
1826 (defun ethio-find-file nil | |
1827 "Transcribe file content into Ethiopic dependig on filename suffix." | |
1828 (cond | |
1829 | |
1830 ((string-match "\\.sera$" (buffer-file-name)) | |
1831 (save-excursion | |
1832 (ethio-sera-to-fidel-buffer nil 'force) | |
1833 (set-buffer-modified-p nil))) | |
1834 | |
1835 ((string-match "\\.html$" (buffer-file-name)) | |
1836 (let ((sera-being-called-by-w3 t)) | |
1837 (save-excursion | |
1838 (ethio-sera-to-fidel-marker 'force) | |
1839 (goto-char (point-min)) | |
1840 (while (re-search-forward "&[lr]aquote;" nil t) | |
1841 (if (= (char-after (1+ (match-beginning 0))) ?l) | |
1842 (replace-match "$(3%v(B") | |
1843 (replace-match "$(3%w(B"))) | |
1844 (set-buffer-modified-p nil)))) | |
1845 | |
1846 ((string-match "\\.tex$" (buffer-file-name)) | |
1847 (save-excursion | |
1848 (ethio-tex-to-fidel-buffer) | |
1849 (set-buffer-modified-p nil))) | |
1850 | |
1851 ((string-match "\\.java$" (buffer-file-name)) | |
1852 (save-excursion | |
1853 (ethio-java-to-fidel-buffer) | |
1854 (set-buffer-modified-p nil))) | |
1855 | |
1856 (t | |
1857 nil))) | |
1858 | |
1859 ;;;###autoload | |
1860 (defun ethio-write-file nil | |
1861 "Transcribe Ethiopic characters in ASCII depending on the file extension." | |
1862 (cond | |
1863 | |
1864 ((string-match "\\.sera$" (buffer-file-name)) | |
1865 (save-excursion | |
1866 (ethio-fidel-to-sera-buffer nil 'force) | |
1867 (goto-char (point-min)) | |
1868 (ethio-record-user-preference) | |
1869 (set-buffer-modified-p nil))) | |
1870 | |
1871 ((string-match "\\.html$" (buffer-file-name)) | |
1872 (save-excursion | |
1873 (let ((sera-being-called-by-w3 t) | |
1874 (lq (aref ethio-fidel-to-sera-map 461)) | |
1875 (rq (aref ethio-fidel-to-sera-map 462))) | |
1876 (aset ethio-fidel-to-sera-map 461 "«te;") | |
1877 (aset ethio-fidel-to-sera-map 462 "»te;") | |
1878 (ethio-fidel-to-sera-marker 'force) | |
1879 (goto-char (point-min)) | |
1880 (if (search-forward "<sera>" nil t) | |
1881 (ethio-record-user-preference)) | |
1882 (aset ethio-fidel-to-sera-map 461 lq) | |
1883 (aset ethio-fidel-to-sera-map 462 rq) | |
1884 (set-buffer-modified-p nil)))) | |
1885 | |
1886 ((string-match "\\.tex$" (buffer-file-name)) | |
1887 (save-excursion | |
1888 (ethio-fidel-to-tex-buffer) | |
1889 (set-buffer-modified-p nil))) | |
1890 | |
1891 ((string-match "\\.java$" (buffer-file-name)) | |
1892 (save-excursion | |
1893 (ethio-fidel-to-java-buffer) | |
1894 (set-buffer-modified-p nil))) | |
1895 | |
1896 (t | |
1897 nil))) | |
1898 | |
1899 (defun ethio-record-user-preference nil | |
1900 (if (looking-at "\\\\~\\(tir?\\|amh?\\) ") | |
1901 (goto-char (match-end 0)) | |
1902 (insert (if (ethio-prefer-amharic-p) "\\~amh " "\\~tir "))) | |
1903 (insert (if ethio-use-colon-for-colon "\\~-: " "\\~`: ") | |
1904 (if ethio-use-three-dot-question "\\~`| " "\\~`? "))) | |
1905 | |
19858
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1906 ;; |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1907 ;; Ethiopic word separator vs. ASCII space |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1908 ;; |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1909 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1910 (defvar ethio-prefer-ascii-space t) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1911 (make-variable-buffer-local 'ethio-prefer-ascii-space) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1912 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1913 (defun ethio-toggle-space nil |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1914 "Toggle ASCII space and Ethiopic separator for keyboard input." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1915 (interactive) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1916 (setq ethio-prefer-ascii-space |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1917 (not ethio-prefer-ascii-space)) |
36536
e83b0b55c92b
(ethio-toggle-space): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
36534
diff
changeset
|
1918 (if (equal current-input-method "ethiopic") |
36534
90893f16ebbd
(ethio-toggle-space): Update current-input-method-title if necessary.
Kenichi Handa <handa@m17n.org>
parents:
36426
diff
changeset
|
1919 (setq current-input-method-title (quail-title))) |
19858
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1920 (force-mode-line-update)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1921 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1922 (defun ethio-insert-space (arg) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1923 "Insert ASCII spaces or Ethiopic word separators depending on context. |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1924 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1925 If the current word separator (indicated in mode-line) is the ASCII space, |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1926 insert an ASCII space. With ARG, insert that many ASCII spaces. |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1927 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1928 If the current word separator is the colon-like Ethiopic word |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1929 separator and the point is preceded by `an Ethiopic punctuation mark |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1930 followed by zero or more ASCII spaces', then insert also an ASCII |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1931 space. With ARG, insert that many ASCII spaces. |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1932 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1933 Otherwise, insert a colon-like Ethiopic word separator. With ARG, insert that |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1934 many Ethiopic word separators." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1935 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1936 (interactive "*p") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1937 (cond |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1938 (ethio-prefer-ascii-space |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1939 (insert-char 32 arg)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1940 ((save-excursion |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1941 (skip-chars-backward " ") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1942 (memq (preceding-char) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1943 '(?$(3$h(B ?$(3$i(B ?$(3$j(B ?$(3$k(B ?$(3$l(B ?$(3$m(B ?$(3$n(B ?$(3$o(B ?$(3%t(B ?$(3%u(B ?$(3%v(B ?$(3%w(B ?$(3%x(B))) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1944 (insert-char 32 arg)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1945 (t |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1946 (insert-char ?$(3$h(B arg)))) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1947 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1948 (defun ethio-insert-ethio-space (arg) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1949 "Insert the Ethiopic word delimiter (the colon-like character). |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1950 With ARG, insert that many delimiters." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1951 (interactive "*p") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1952 (insert-char ?$(3$h(B arg)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1953 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1954 ;; |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1955 ;; Ethiopic punctuation vs. ASCII punctuation |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1956 ;; |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1957 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1958 (defvar ethio-prefer-ascii-punctuation nil) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1959 (make-variable-buffer-local 'ethio-prefer-ascii-punctuation) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1960 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1961 (defun ethio-toggle-punctuation nil |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1962 "Toggle Ethiopic punctuations and ASCII punctuations for keyboard input." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1963 (interactive) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1964 (setq ethio-prefer-ascii-punctuation |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1965 (not ethio-prefer-ascii-punctuation)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1966 (let* ((keys '("." ".." "..." "," ",," ";" ";;" ":" "::" ":::" "*" "**")) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1967 (puncs |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1968 (if ethio-prefer-ascii-punctuation |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1969 '(?. [".."] ["..."] ?, [",,"] ?\; [";;"] ?: ["::"] [":::"] ?* ["**"]) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1970 '(?$(3$i(B ?$(3%u(B ?. ?$(3$j(B ?, ?$(3$k(B ?\; ?$(3$h(B ?$(3$i(B ?: ?* ?$(3$o(B)))) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1971 (while keys |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1972 (quail-defrule (car keys) (car puncs) "ethiopic") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1973 (setq keys (cdr keys) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1974 puncs (cdr puncs))) |
36536
e83b0b55c92b
(ethio-toggle-space): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
36534
diff
changeset
|
1975 (if (equal current-input-method "ethiopic") |
36534
90893f16ebbd
(ethio-toggle-space): Update current-input-method-title if necessary.
Kenichi Handa <handa@m17n.org>
parents:
36426
diff
changeset
|
1976 (setq current-input-method-title (quail-title))) |
19858
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1977 (force-mode-line-update))) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1978 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1979 ;; |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1980 ;; Gemination |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1981 ;; |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1982 |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1983 (defun ethio-gemination nil |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1984 "Compose the character before the point with the Ethiopic gemination mark. |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1985 If the characater is already composed, decompose it and remove the gemination |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1986 mark." |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1987 (interactive "*") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1988 (cond |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1989 ((eq (char-charset (preceding-char)) 'ethiopic) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1990 (insert "$(3%s(B") |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1991 (compose-region |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1992 (save-excursion (backward-char 2) (point)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1993 (point)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1994 (forward-char 1)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1995 ((eq (char-charset (preceding-char)) 'leading-code-composition) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1996 (decompose-region |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1997 (save-excursion (backward-char 1) (point)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1998 (point)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
1999 (delete-backward-char 1)) |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
2000 (t |
a13159d471ff
(setup-ethiopic-environment): Don't bind
Kenichi Handa <handa@m17n.org>
parents:
19646
diff
changeset
|
2001 (error "")))) |
17299 | 2002 |
2003 ;; | |
18306
6148a6f19ded
Provide ethio-util instead of language/ethio-util.
Kenichi Handa <handa@m17n.org>
parents:
17993
diff
changeset
|
2004 (provide 'ethio-util) |
17052 | 2005 |
2006 ;;; ethio-util.el ends here |