1 ;; quail/ethiopic.el --- Quail package for inputting Ethiopic characters
3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Keywords: multilingual, input method, ethiopic
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;; Author: TAKAHASHI Naoto <ntakahas@etl.go.jp>
33 ;; Ethiopic word separator vs. ASCII space
36 (defvar ethio-prefer-ascii-space t)
37 (make-variable-buffer-local 'ethio-prefer-ascii-space)
39 (defun ethio-toggle-space nil
40 "Toggle ASCII space and Ethiopic separator for keyboard input."
42 (setq ethio-prefer-ascii-space
43 (not ethio-prefer-ascii-space))
44 (force-mode-line-update))
46 (defun ethio-insert-space (arg)
47 "Insert ASCII spaces or Ethiopic word separators depending on context.
49 If the current word separator (indicated in mode-line) is the ASCII space,
50 insert an ASCII space. With ARG, insert that many ASCII spaces.
52 If the current word separator is the colon-like Ethiopic word
53 separator and the point is preceded by `an Ethiopic punctuation mark
54 followed by zero or more ASCII spaces', then insert also an ASCII
55 space. With ARG, insert that many ASCII spaces.
57 Otherwise, insert a colon-like Ethiopic word separator. With ARG, insert that
58 many Ethiopic word separators."
62 (ethio-prefer-ascii-space
65 (skip-chars-backward " ")
66 (memq (preceding-char)
67 '(?
\e$(3$h
\e(B ?
\e$(3$i
\e(B ?
\e$(3$j
\e(B ?
\e$(3$k
\e(B ?
\e$(3$l
\e(B ?
\e$(3$m
\e(B ?
\e$(3$n
\e(B ?
\e$(3$o
\e(B ?
\e$(3%t
\e(B ?
\e$(3%u
\e(B ?
\e$(3%v
\e(B ?
\e$(3%w
\e(B ?
\e$(3%x
\e(B)))
70 (insert-char ?
\e$(3$h
\e(B arg))))
72 (defun ethio-insert-ethio-space (arg)
73 "Insert the Ethiopic word delimiter (the colon-like character).
74 With ARG, insert that many delimiters."
76 (insert-char ?
\e$(3$h
\e(B arg))
79 ;; Ethiopic punctuation vs. ASCII punctuation
82 (defvar ethio-prefer-ascii-punctuation nil)
83 (make-variable-buffer-local 'ethio-prefer-ascii-punctuation)
85 (defun ethio-toggle-punctuation nil
86 "Toggle Ethiopic punctuations and ASCII punctuations for keyboard input."
88 (setq ethio-prefer-ascii-punctuation
89 (not ethio-prefer-ascii-punctuation))
90 (let* ((keys '("." ".." "..." "," ",," ";" ";;" ":" "::" ":::" "*" "**"))
92 (if ethio-prefer-ascii-punctuation
93 '(?. [".."] ["..."] ?, [",,"] ?\; [";;"] ?: ["::"] [":::"] ?* ["**"])
94 '(?
\e$(3$i
\e(B ?
\e$(3%u
\e(B ?. ?
\e$(3$j
\e(B ?, ?
\e$(3$k
\e(B ?\; ?
\e$(3$h
\e(B ?
\e$(3$i
\e(B ?: ?* ?
\e$(3$o
\e(B))))
96 (quail-defrule (car keys) (car puncs) "ethiopic")
99 (force-mode-line-update)))
105 (defun ethio-gemination nil
106 "Compose the character before the point with the Ethiopic gemination mark.
107 If the characater is already composed, decompose it and remove the gemination
111 ((eq (char-charset (preceding-char)) 'ethiopic)
112 (insert "
\e$(3%s
\e(B")
114 (save-excursion (backward-char 2) (point))
117 ((eq (char-charset (preceding-char)) 'leading-code-composition)
119 (save-excursion (backward-char 1) (point))
121 (delete-backward-char 1))
126 ;; The package "ethiopic"
129 (quail-define-package
130 "ethiopic" "Ethiopic"
132 (ethio-prefer-ascii-space "_" "
\e$(3$h
\e(B")
133 (ethio-prefer-ascii-punctuation "." "
\e$(3$i
\e(B"))
134 t " KEYS AND FUNCTIONS
136 [F2] or `M-x ethio-toggle-space'
137 Toggles space characters for keyboard input. The current mode is
138 indicated in mode-line, whether by `_' (ASCII space) or `
\e$(3$h
\e(B'
139 (Ethiopic colon-like word separator). Even in the `
\e$(3$h
\e(B' mode, an
140 ASCII space is inserted if the point is preceded by `an Ethiopic
141 punctuation followed by zero or more ASCII spaces'.
143 [F3] or `M-x ethio-toggle-punctuation'
144 Toggles ASCII punctuations and Ethiopic punctuations for keyboard input.
145 The current mode is indicated by `.' (ASCII) or `
\e$(3$i
\e(B' (Ethiopic).
147 C-^ or `M-x ethio-insert-ethio-space
148 Always insert an Ethiopic word separator `
\e$(3$h
\e(B'. With a prefix number,
149 insert that many word separators.
151 C-' or ethio-gemination
152 Compose the character before the point with the Ethiopic gemination mark.
153 If the characater is already composed, decompose it and remove the
156 '(([f2] . ethio-toggle-space)
157 ([f3] . ethio-toggle-punctuation)
158 (" " . ethio-insert-space)
159 ([?\C-^] . ethio-insert-ethio-space)
160 ([?\C-'] . ethio-gemination))
163 ;; These keys should work even if translation region is not active.
164 (define-key quail-mode-map [f2] 'ethio-toggle-space)
165 (define-key quail-mode-map [f3] 'ethio-toggle-punctuation)
166 (define-key quail-mode-map " " 'ethio-insert-space)
167 (define-key quail-mode-map [?\C-^] 'ethio-insert-ethio-space)
168 (define-key quail-mode-map [?\C-'] 'ethio-gemination)
169 (define-key quail-mode-map [?\S- ] 'ethio-insert-ethio-space)
196 ("lWe" ["
\e$(3!.%n
\e(B"])
197 ("lWu" ["
\e$(3!.%r
\e(B"])
198 ("lWi" ["
\e$(3!.%o
\e(B"])
199 ("lWE" ["
\e$(3!.%q
\e(B"])
200 ("lW'" ["
\e$(3!.%r
\e(B"])
211 ("LWe" ["
\e$(3!.%n
\e(B"])
212 ("LWu" ["
\e$(3!.%r
\e(B"])
213 ("LWi" ["
\e$(3!.%o
\e(B"])
214 ("LWE" ["
\e$(3!.%q
\e(B"])
215 ("LW'" ["
\e$(3!.%r
\e(B"])
226 ("HWe" ["
\e$(3!6%n
\e(B"])
227 ("HWu" ["
\e$(3!6%r
\e(B"])
228 ("HWi" ["
\e$(3!6%o
\e(B"])
229 ("HWE" ["
\e$(3!6%q
\e(B"])
230 ("HW'" ["
\e$(3!6%r
\e(B"])
274 ("`sWa" ?
\e$(3!H
\e(B)
275 ("`sWe" ["
\e$(3!F%n
\e(B"])
276 ("`sWu" ["
\e$(3!F%r
\e(B"])
277 ("`sWi" ["
\e$(3!F%o
\e(B"])
278 ("`sWE" ["
\e$(3!F%q
\e(B"])
279 ("`sW'" ["
\e$(3!F%r
\e(B"])
289 ("s2Wa" ?
\e$(3!H
\e(B)
290 ("s2We" ["
\e$(3!F%n
\e(B"])
291 ("s2Wu" ["
\e$(3!F%r
\e(B"])
292 ("s2Wi" ["
\e$(3!F%o
\e(B"])
293 ("s2WE" ["
\e$(3!F%q
\e(B"])
294 ("s2W'" ["
\e$(3!F%r
\e(B"])
304 ("ssWa" ?
\e$(3!H
\e(B)
305 ("ssWe" ["
\e$(3!F%n
\e(B"])
306 ("ssWu" ["
\e$(3!F%r
\e(B"])
307 ("ssWi" ["
\e$(3!F%o
\e(B"])
308 ("ssWE" ["
\e$(3!F%q
\e(B"])
309 ("ssW'" ["
\e$(3!F%r
\e(B"])
322 ("rWe" ["
\e$(3!N%n
\e(B"])
323 ("rWu" ["
\e$(3!N%r
\e(B"])
324 ("rWi" ["
\e$(3!N%o
\e(B"])
325 ("rWE" ["
\e$(3!N%q
\e(B"])
326 ("rW'" ["
\e$(3!N%r
\e(B"])
338 ("RWe" ["
\e$(3!N%n
\e(B"])
339 ("RWu" ["
\e$(3!N%r
\e(B"])
340 ("RWi" ["
\e$(3!N%o
\e(B"])
341 ("RWE" ["
\e$(3!N%q
\e(B"])
342 ("RW'" ["
\e$(3!N%r
\e(B"])
353 ("sWe" ["
\e$(3!V%n
\e(B"])
354 ("sWu" ["
\e$(3!V%r
\e(B"])
355 ("sWi" ["
\e$(3!V%o
\e(B"])
356 ("sWE" ["
\e$(3!V%q
\e(B"])
357 ("sW'" ["
\e$(3!V%r
\e(B"])
368 ("xWe" ["
\e$(3!^%n
\e(B"])
369 ("xWu" ["
\e$(3!^%r
\e(B"])
370 ("xWi" ["
\e$(3!^%o
\e(B"])
371 ("xWE" ["
\e$(3!^%q
\e(B"])
372 ("xW'" ["
\e$(3!^%r
\e(B"])
467 ("vWe" ["
\e$(3"0%n
\e(B"])
468 ("vWu" ["
\e$(3"0%r
\e(B"])
469 ("vWi" ["
\e$(3"0%o
\e(B"])
470 ("vWE" ["
\e$(3"0%q
\e(B"])
471 ("vW'" ["
\e$(3"0%r
\e(B"])
482 ("VWe" ["
\e$(3"0%n
\e(B"])
483 ("VWu" ["
\e$(3"0%r
\e(B"])
484 ("VWi" ["
\e$(3"0%o
\e(B"])
485 ("VWE" ["
\e$(3"0%q
\e(B"])
486 ("VW'" ["
\e$(3"0%r
\e(B"])
497 ("tWe" ["
\e$(3"8%n
\e(B"])
498 ("tWu" ["
\e$(3"8%r
\e(B"])
499 ("tWi" ["
\e$(3"8%o
\e(B"])
500 ("tWE" ["
\e$(3"8%q
\e(B"])
501 ("tW'" ["
\e$(3"8%r
\e(B"])
512 ("cWe" ["
\e$(3"@%n
\e(B"])
513 ("cWu" ["
\e$(3"@%r
\e(B"])
514 ("cWi" ["
\e$(3"@%o
\e(B"])
515 ("cWE" ["
\e$(3"@%q
\e(B"])
516 ("cW'" ["
\e$(3"@%r
\e(B"])
525 ("`hWe" ?
\e$(3"K
\e(B)
526 ("`hWu" ?
\e$(3"P
\e(B)
527 ("`hWi" ?
\e$(3"M
\e(B)
529 ("`hWa" ?
\e$(3"N
\e(B)
530 ("`hWE" ?
\e$(3"O
\e(B)
531 ("`hW'" ?
\e$(3"P
\e(B)
540 ("h2We" ?
\e$(3"K
\e(B)
541 ("h2Wu" ?
\e$(3"P
\e(B)
542 ("h2Wi" ?
\e$(3"M
\e(B)
544 ("h2Wa" ?
\e$(3"N
\e(B)
545 ("h2WE" ?
\e$(3"O
\e(B)
546 ("h2W'" ?
\e$(3"P
\e(B)
555 ("hhWe" ?
\e$(3"K
\e(B)
556 ("hhWu" ?
\e$(3"P
\e(B)
557 ("hhWi" ?
\e$(3"M
\e(B)
559 ("hhWa" ?
\e$(3"N
\e(B)
560 ("hhWE" ?
\e$(3"O
\e(B)
561 ("hhW'" ?
\e$(3"P
\e(B)
572 ("nWe" ["
\e$(3"X%n
\e(B"])
573 ("nWu" ["
\e$(3"X%r
\e(B"])
574 ("nWi" ["
\e$(3"X%o
\e(B"])
575 ("nWE" ["
\e$(3"X%q
\e(B"])
576 ("nW'" ["
\e$(3"X%r
\e(B"])
587 ("NWe" ["
\e$(3"`%n
\e(B"])
588 ("NWu" ["
\e$(3"`%r
\e(B"])
589 ("NWi" ["
\e$(3"`%o
\e(B"])
590 ("NWE" ["
\e$(3"`%q
\e(B"])
591 ("NW'" ["
\e$(3"`%r
\e(B"])
718 ("zWe" ["
\e$(3#B%n
\e(B"])
719 ("zWu" ["
\e$(3#B%r
\e(B"])
720 ("zWi" ["
\e$(3#B%o
\e(B"])
721 ("zWE" ["
\e$(3#B%q
\e(B"])
722 ("zW'" ["
\e$(3#B%r
\e(B"])
733 ("ZWe" ["
\e$(3#J%n
\e(B"])
734 ("ZWu" ["
\e$(3#J%r
\e(B"])
735 ("ZWi" ["
\e$(3#J%o
\e(B"])
736 ("ZWE" ["
\e$(3#J%q
\e(B"])
737 ("ZW'" ["
\e$(3#J%r
\e(B"])
748 ("yWe" ["
\e$(3#R%n
\e(B"])
749 ("yWu" ["
\e$(3#R%r
\e(B"])
750 ("yWi" ["
\e$(3#R%o
\e(B"])
751 ("yWE" ["
\e$(3#R%q
\e(B"])
752 ("yW'" ["
\e$(3#R%r
\e(B"])
763 ("YWe" ["
\e$(3#R%n
\e(B"])
764 ("YWu" ["
\e$(3#R%r
\e(B"])
765 ("YWi" ["
\e$(3#R%o
\e(B"])
766 ("YWE" ["
\e$(3#R%q
\e(B"])
767 ("YW'" ["
\e$(3#R%r
\e(B"])
778 ("dWe" ["
\e$(3#Z%n
\e(B"])
779 ("dWu" ["
\e$(3#Z%r
\e(B"])
780 ("dWi" ["
\e$(3#Z%o
\e(B"])
781 ("dWE" ["
\e$(3#Z%q
\e(B"])
782 ("dW'" ["
\e$(3#Z%r
\e(B"])
793 ("DWe" ["
\e$(3#b%n
\e(B"])
794 ("DWu" ["
\e$(3#b%r
\e(B"])
795 ("DWi" ["
\e$(3#b%o
\e(B"])
796 ("DWE" ["
\e$(3#b%q
\e(B"])
797 ("DW'" ["
\e$(3#b%r
\e(B"])
808 ("jWe" ["
\e$(3#j%n
\e(B"])
809 ("jWu" ["
\e$(3#j%r
\e(B"])
810 ("jWi" ["
\e$(3#j%o
\e(B"])
811 ("jWE" ["
\e$(3#j%q
\e(B"])
812 ("jW'" ["
\e$(3#j%r
\e(B"])
823 ("JWe" ["
\e$(3#j%n
\e(B"])
824 ("JWu" ["
\e$(3#j%r
\e(B"])
825 ("JWi" ["
\e$(3#j%o
\e(B"])
826 ("JWE" ["
\e$(3#j%q
\e(B"])
827 ("JW'" ["
\e$(3#j%r
\e(B"])
892 ("tWe" ["
\e$(3$,%n
\e(B"])
893 ("tWu" ["
\e$(3$,%r
\e(B"])
894 ("tWi" ["
\e$(3$,%o
\e(B"])
895 ("tWE" ["
\e$(3$,%q
\e(B"])
896 ("tW'" ["
\e$(3$,%r
\e(B"])
907 ("CWe" ["
\e$(3$4%n
\e(B"])
908 ("CWu" ["
\e$(3$4%r
\e(B"])
909 ("CWi" ["
\e$(3$4%o
\e(B"])
910 ("CWE" ["
\e$(3$4%q
\e(B"])
911 ("CW'" ["
\e$(3$4%r
\e(B"])
922 ("PWe" ["
\e$(3$<%n
\e(B"])
923 ("PWu" ["
\e$(3$<%r
\e(B"])
924 ("PWi" ["
\e$(3$<%o
\e(B"])
925 ("PWE" ["
\e$(3$<%q
\e(B"])
926 ("PW'" ["
\e$(3$<%r
\e(B"])
937 ("SWe" ["
\e$(3$D%n
\e(B"])
938 ("SWu" ["
\e$(3$D%r
\e(B"])
939 ("SWi" ["
\e$(3$D%o
\e(B"])
940 ("SWE" ["
\e$(3$D%q
\e(B"])
941 ("SW'" ["
\e$(3$D%r
\e(B"])
951 ("`SWa" ?
\e$(3$F
\e(B)
952 ("`SWe" ["
\e$(3$L%n
\e(B"])
953 ("`SWu" ["
\e$(3$L%r
\e(B"])
954 ("`SWi" ["
\e$(3$L%o
\e(B"])
955 ("`SWE" ["
\e$(3$L%q
\e(B"])
956 ("`SW'" ["
\e$(3$L%r
\e(B"])
966 ("S2Wa" ?
\e$(3$F
\e(B)
967 ("S2We" ["
\e$(3$L%n
\e(B"])
968 ("S2Wu" ["
\e$(3$L%r
\e(B"])
969 ("S2Wi" ["
\e$(3$L%o
\e(B"])
970 ("S2WE" ["
\e$(3$L%q
\e(B"])
971 ("S2W'" ["
\e$(3$L%r
\e(B"])
981 ("SSWa" ?
\e$(3$F
\e(B)
982 ("SSWe" ["
\e$(3$L%n
\e(B"])
983 ("SSWu" ["
\e$(3$L%r
\e(B"])
984 ("SSWi" ["
\e$(3$L%o
\e(B"])
985 ("SSWE" ["
\e$(3$L%q
\e(B"])
986 ("SW'" ["
\e$(3$L%r
\e(B"])
1000 ("fWE" ?
\e$(3%T
\e(B)
1001 ("fW'" ?
\e$(3%d
\e(B)
1003 ("fYa" ?
\e$(3$a
\e(B)
1012 ("FWe" ?
\e$(3%4
\e(B)
1013 ("FWu" ?
\e$(3%d
\e(B)
1014 ("FWi" ?
\e$(3%D
\e(B)
1016 ("FWa" ?
\e$(3$V
\e(B)
1017 ("FWE" ?
\e$(3%T
\e(B)
1018 ("FW'" ?
\e$(3%d
\e(B)
1020 ("FYa" ?
\e$(3$a
\e(B)
1029 ("pWe" ?
\e$(3%5
\e(B)
1030 ("pWu" ?
\e$(3%e
\e(B)
1031 ("pWi" ?
\e$(3%E
\e(B)
1033 ("pWa" ?
\e$(3$^
\e(B)
1034 ("pWE" ?
\e$(3%U
\e(B)
1035 ("pW'" ?
\e$(3%e
\e(B)
1053 (":|:" ?
\e$(3$o
\e(B)
1061 ("wWe" ?
\e$(3%n
\e(B)
1062 ("wWu" ?
\e$(3%r
\e(B)
1063 ("wWi" ?
\e$(3%o
\e(B)
1065 ("wWa" ?
\e$(3%p
\e(B)
1066 ("wWE" ?
\e$(3%q
\e(B)
1067 ("wW'" ?
\e$(3%r
\e(B)
1084 ("`10" ?
\e$(3$y
\e(B)
1085 ("`20" ?
\e$(3$z
\e(B)
1086 ("`30" ?
\e$(3${
\e(B)
1087 ("`40" ?
\e$(3$|
\e(B)
1088 ("`50" ?
\e$(3$}
\e(B)
1089 ("`60" ?
\e$(3$~
\e(B)
1090 ("`70" ?
\e$(3%!
\e(B)
1091 ("`80" ?
\e$(3%"
\e(B)
1092 ("`90" ?
\e$(3%#
\e(B)
1093 ("`100" ?
\e$(3%$
\e(B)
1094 ("`1000" ["
\e$(3$y%$
\e(B"])
1095 ("`2000" ["
\e$(3$z%$
\e(B"])
1096 ("`3000" ["
\e$(3${%$
\e(B"])
1097 ("`4000" ["
\e$(3$|%$
\e(B"])
1098 ("`5000" ["
\e$(3$}%$
\e(B"])
1099 ("`6000" ["
\e$(3$~%$
\e(B"])
1100 ("`7000" ["
\e$(3%!%$
\e(B"])
1101 ("`8000" ["
\e$(3%"%$
\e(B"])
1102 ("`9000" ["
\e$(3%#%$
\e(B"])
1103 ("`10000" ?
\e$(3%%
\e(B)
1104 ("`20000" ["
\e$(3$q%%
\e(B"])
1105 ("`30000" ["
\e$(3$r%%
\e(B"])
1106 ("`40000" ["
\e$(3$s%%
\e(B"])
1107 ("`50000" ["
\e$(3$t%%
\e(B"])
1108 ("`60000" ["
\e$(3$u%%
\e(B"])
1109 ("`70000" ["
\e$(3$v%%
\e(B"])
1110 ("`80000" ["
\e$(3$w%%
\e(B"])
1111 ("`90000" ["
\e$(3$x%%
\e(B"])
1112 ("`100000" ["
\e$(3$y%%
\e(B"])
1113 ("`200000" ["
\e$(3$z%%
\e(B"])
1114 ("`300000" ["
\e$(3${%%
\e(B"])
1115 ("`400000" ["
\e$(3$|%%
\e(B"])
1116 ("`500000" ["
\e$(3$}%%
\e(B"])
1117 ("`600000" ["
\e$(3$~%%
\e(B"])
1118 ("`700000" ["
\e$(3%!%%
\e(B"])
1119 ("`800000" ["
\e$(3%"%%
\e(B"])
1120 ("`900000" ["
\e$(3%#%%
\e(B"])
1121 ("`1000000" ["
\e$(3%$%%
\e(B"])
1124 ;; The translation of `a' depends on the language (Tigrigna or Amharic).
1125 (add-hook 'quail-mode-hook
1128 (if (ethio-prefer-amharic-p) ?
\e$(3"c
\e(B ?
\e$(3"f
\e(B)
1131 ;;; quail/ethiopic.el ends here