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