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