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) "quail-ethio")
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 "quail-ethio"
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)
195 ("lWe" ["
\e$(3!.%n
\e(B"])
196 ("lWu" ["
\e$(3!.%r
\e(B"])
197 ("lWi" ["
\e$(3!.%o
\e(B"])
198 ("lWE" ["
\e$(3!.%q
\e(B"])
199 ("lW'" ["
\e$(3!.%r
\e(B"])
210 ("LWe" ["
\e$(3!.%n
\e(B"])
211 ("LWu" ["
\e$(3!.%r
\e(B"])
212 ("LWi" ["
\e$(3!.%o
\e(B"])
213 ("LWE" ["
\e$(3!.%q
\e(B"])
214 ("LW'" ["
\e$(3!.%r
\e(B"])
225 ("HWe" ["
\e$(3!6%n
\e(B"])
226 ("HWu" ["
\e$(3!6%r
\e(B"])
227 ("HWi" ["
\e$(3!6%o
\e(B"])
228 ("HWE" ["
\e$(3!6%q
\e(B"])
229 ("HW'" ["
\e$(3!6%r
\e(B"])
273 ("`sWa" ?
\e$(3!H
\e(B)
274 ("`sWe" ["
\e$(3!F%n
\e(B"])
275 ("`sWu" ["
\e$(3!F%r
\e(B"])
276 ("`sWi" ["
\e$(3!F%o
\e(B"])
277 ("`sWE" ["
\e$(3!F%q
\e(B"])
278 ("`sW'" ["
\e$(3!F%r
\e(B"])
288 ("s2Wa" ?
\e$(3!H
\e(B)
289 ("s2We" ["
\e$(3!F%n
\e(B"])
290 ("s2Wu" ["
\e$(3!F%r
\e(B"])
291 ("s2Wi" ["
\e$(3!F%o
\e(B"])
292 ("s2WE" ["
\e$(3!F%q
\e(B"])
293 ("s2W'" ["
\e$(3!F%r
\e(B"])
303 ("ssWa" ?
\e$(3!H
\e(B)
304 ("ssWe" ["
\e$(3!F%n
\e(B"])
305 ("ssWu" ["
\e$(3!F%r
\e(B"])
306 ("ssWi" ["
\e$(3!F%o
\e(B"])
307 ("ssWE" ["
\e$(3!F%q
\e(B"])
308 ("ssW'" ["
\e$(3!F%r
\e(B"])
321 ("rWe" ["
\e$(3!N%n
\e(B"])
322 ("rWu" ["
\e$(3!N%r
\e(B"])
323 ("rWi" ["
\e$(3!N%o
\e(B"])
324 ("rWE" ["
\e$(3!N%q
\e(B"])
325 ("rW'" ["
\e$(3!N%r
\e(B"])
337 ("RWe" ["
\e$(3!N%n
\e(B"])
338 ("RWu" ["
\e$(3!N%r
\e(B"])
339 ("RWi" ["
\e$(3!N%o
\e(B"])
340 ("RWE" ["
\e$(3!N%q
\e(B"])
341 ("RW'" ["
\e$(3!N%r
\e(B"])
352 ("sWe" ["
\e$(3!V%n
\e(B"])
353 ("sWu" ["
\e$(3!V%r
\e(B"])
354 ("sWi" ["
\e$(3!V%o
\e(B"])
355 ("sWE" ["
\e$(3!V%q
\e(B"])
356 ("sW'" ["
\e$(3!V%r
\e(B"])
367 ("xWe" ["
\e$(3!^%n
\e(B"])
368 ("xWu" ["
\e$(3!^%r
\e(B"])
369 ("xWi" ["
\e$(3!^%o
\e(B"])
370 ("xWE" ["
\e$(3!^%q
\e(B"])
371 ("xW'" ["
\e$(3!^%r
\e(B"])
466 ("vWe" ["
\e$(3"0%n
\e(B"])
467 ("vWu" ["
\e$(3"0%r
\e(B"])
468 ("vWi" ["
\e$(3"0%o
\e(B"])
469 ("vWE" ["
\e$(3"0%q
\e(B"])
470 ("vW'" ["
\e$(3"0%r
\e(B"])
481 ("VWe" ["
\e$(3"0%n
\e(B"])
482 ("VWu" ["
\e$(3"0%r
\e(B"])
483 ("VWi" ["
\e$(3"0%o
\e(B"])
484 ("VWE" ["
\e$(3"0%q
\e(B"])
485 ("VW'" ["
\e$(3"0%r
\e(B"])
496 ("tWe" ["
\e$(3"8%n
\e(B"])
497 ("tWu" ["
\e$(3"8%r
\e(B"])
498 ("tWi" ["
\e$(3"8%o
\e(B"])
499 ("tWE" ["
\e$(3"8%q
\e(B"])
500 ("tW'" ["
\e$(3"8%r
\e(B"])
511 ("cWe" ["
\e$(3"@%n
\e(B"])
512 ("cWu" ["
\e$(3"@%r
\e(B"])
513 ("cWi" ["
\e$(3"@%o
\e(B"])
514 ("cWE" ["
\e$(3"@%q
\e(B"])
515 ("cW'" ["
\e$(3"@%r
\e(B"])
524 ("`hWe" ?
\e$(3"K
\e(B)
525 ("`hWu" ?
\e$(3"P
\e(B)
526 ("`hWi" ?
\e$(3"M
\e(B)
528 ("`hWa" ?
\e$(3"N
\e(B)
529 ("`hWE" ?
\e$(3"O
\e(B)
530 ("`hW'" ?
\e$(3"P
\e(B)
539 ("h2We" ?
\e$(3"K
\e(B)
540 ("h2Wu" ?
\e$(3"P
\e(B)
541 ("h2Wi" ?
\e$(3"M
\e(B)
543 ("h2Wa" ?
\e$(3"N
\e(B)
544 ("h2WE" ?
\e$(3"O
\e(B)
545 ("h2W'" ?
\e$(3"P
\e(B)
554 ("hhWe" ?
\e$(3"K
\e(B)
555 ("hhWu" ?
\e$(3"P
\e(B)
556 ("hhWi" ?
\e$(3"M
\e(B)
558 ("hhWa" ?
\e$(3"N
\e(B)
559 ("hhWE" ?
\e$(3"O
\e(B)
560 ("hhW'" ?
\e$(3"P
\e(B)
571 ("nWe" ["
\e$(3"X%n
\e(B"])
572 ("nWu" ["
\e$(3"X%r
\e(B"])
573 ("nWi" ["
\e$(3"X%o
\e(B"])
574 ("nWE" ["
\e$(3"X%q
\e(B"])
575 ("nW'" ["
\e$(3"X%r
\e(B"])
586 ("NWe" ["
\e$(3"`%n
\e(B"])
587 ("NWu" ["
\e$(3"`%r
\e(B"])
588 ("NWi" ["
\e$(3"`%o
\e(B"])
589 ("NWE" ["
\e$(3"`%q
\e(B"])
590 ("NW'" ["
\e$(3"`%r
\e(B"])
717 ("zWe" ["
\e$(3#B%n
\e(B"])
718 ("zWu" ["
\e$(3#B%r
\e(B"])
719 ("zWi" ["
\e$(3#B%o
\e(B"])
720 ("zWE" ["
\e$(3#B%q
\e(B"])
721 ("zW'" ["
\e$(3#B%r
\e(B"])
732 ("ZWe" ["
\e$(3#J%n
\e(B"])
733 ("ZWu" ["
\e$(3#J%r
\e(B"])
734 ("ZWi" ["
\e$(3#J%o
\e(B"])
735 ("ZWE" ["
\e$(3#J%q
\e(B"])
736 ("ZW'" ["
\e$(3#J%r
\e(B"])
747 ("yWe" ["
\e$(3#R%n
\e(B"])
748 ("yWu" ["
\e$(3#R%r
\e(B"])
749 ("yWi" ["
\e$(3#R%o
\e(B"])
750 ("yWE" ["
\e$(3#R%q
\e(B"])
751 ("yW'" ["
\e$(3#R%r
\e(B"])
762 ("YWe" ["
\e$(3#R%n
\e(B"])
763 ("YWu" ["
\e$(3#R%r
\e(B"])
764 ("YWi" ["
\e$(3#R%o
\e(B"])
765 ("YWE" ["
\e$(3#R%q
\e(B"])
766 ("YW'" ["
\e$(3#R%r
\e(B"])
777 ("dWe" ["
\e$(3#Z%n
\e(B"])
778 ("dWu" ["
\e$(3#Z%r
\e(B"])
779 ("dWi" ["
\e$(3#Z%o
\e(B"])
780 ("dWE" ["
\e$(3#Z%q
\e(B"])
781 ("dW'" ["
\e$(3#Z%r
\e(B"])
792 ("DWe" ["
\e$(3#b%n
\e(B"])
793 ("DWu" ["
\e$(3#b%r
\e(B"])
794 ("DWi" ["
\e$(3#b%o
\e(B"])
795 ("DWE" ["
\e$(3#b%q
\e(B"])
796 ("DW'" ["
\e$(3#b%r
\e(B"])
807 ("jWe" ["
\e$(3#j%n
\e(B"])
808 ("jWu" ["
\e$(3#j%r
\e(B"])
809 ("jWi" ["
\e$(3#j%o
\e(B"])
810 ("jWE" ["
\e$(3#j%q
\e(B"])
811 ("jW'" ["
\e$(3#j%r
\e(B"])
822 ("JWe" ["
\e$(3#j%n
\e(B"])
823 ("JWu" ["
\e$(3#j%r
\e(B"])
824 ("JWi" ["
\e$(3#j%o
\e(B"])
825 ("JWE" ["
\e$(3#j%q
\e(B"])
826 ("JW'" ["
\e$(3#j%r
\e(B"])
891 ("tWe" ["
\e$(3$,%n
\e(B"])
892 ("tWu" ["
\e$(3$,%r
\e(B"])
893 ("tWi" ["
\e$(3$,%o
\e(B"])
894 ("tWE" ["
\e$(3$,%q
\e(B"])
895 ("tW'" ["
\e$(3$,%r
\e(B"])
906 ("CWe" ["
\e$(3$4%n
\e(B"])
907 ("CWu" ["
\e$(3$4%r
\e(B"])
908 ("CWi" ["
\e$(3$4%o
\e(B"])
909 ("CWE" ["
\e$(3$4%q
\e(B"])
910 ("CW'" ["
\e$(3$4%r
\e(B"])
921 ("PWe" ["
\e$(3$<%n
\e(B"])
922 ("PWu" ["
\e$(3$<%r
\e(B"])
923 ("PWi" ["
\e$(3$<%o
\e(B"])
924 ("PWE" ["
\e$(3$<%q
\e(B"])
925 ("PW'" ["
\e$(3$<%r
\e(B"])
936 ("SWe" ["
\e$(3$D%n
\e(B"])
937 ("SWu" ["
\e$(3$D%r
\e(B"])
938 ("SWi" ["
\e$(3$D%o
\e(B"])
939 ("SWE" ["
\e$(3$D%q
\e(B"])
940 ("SW'" ["
\e$(3$D%r
\e(B"])
950 ("`SWa" ?
\e$(3$F
\e(B)
951 ("`SWe" ["
\e$(3$L%n
\e(B"])
952 ("`SWu" ["
\e$(3$L%r
\e(B"])
953 ("`SWi" ["
\e$(3$L%o
\e(B"])
954 ("`SWE" ["
\e$(3$L%q
\e(B"])
955 ("`SW'" ["
\e$(3$L%r
\e(B"])
965 ("S2Wa" ?
\e$(3$F
\e(B)
966 ("S2We" ["
\e$(3$L%n
\e(B"])
967 ("S2Wu" ["
\e$(3$L%r
\e(B"])
968 ("S2Wi" ["
\e$(3$L%o
\e(B"])
969 ("S2WE" ["
\e$(3$L%q
\e(B"])
970 ("S2W'" ["
\e$(3$L%r
\e(B"])
980 ("SSWa" ?
\e$(3$F
\e(B)
981 ("SSWe" ["
\e$(3$L%n
\e(B"])
982 ("SSWu" ["
\e$(3$L%r
\e(B"])
983 ("SSWi" ["
\e$(3$L%o
\e(B"])
984 ("SSWE" ["
\e$(3$L%q
\e(B"])
985 ("SW'" ["
\e$(3$L%r
\e(B"])
1000 ("fW'" ?
\e$(3%d
\e(B)
1002 ("fYa" ?
\e$(3$a
\e(B)
1011 ("FWe" ?
\e$(3%4
\e(B)
1012 ("FWu" ?
\e$(3%d
\e(B)
1013 ("FWi" ?
\e$(3%D
\e(B)
1015 ("FWa" ?
\e$(3$V
\e(B)
1016 ("FWE" ?
\e$(3%T
\e(B)
1017 ("FW'" ?
\e$(3%d
\e(B)
1019 ("FYa" ?
\e$(3$a
\e(B)
1028 ("pWe" ?
\e$(3%5
\e(B)
1029 ("pWu" ?
\e$(3%e
\e(B)
1030 ("pWi" ?
\e$(3%E
\e(B)
1032 ("pWa" ?
\e$(3$^
\e(B)
1033 ("pWE" ?
\e$(3%U
\e(B)
1034 ("pW'" ?
\e$(3%e
\e(B)
1052 (":|:" ?
\e$(3$o
\e(B)
1060 ("wWe" ?
\e$(3%n
\e(B)
1061 ("wWu" ?
\e$(3%r
\e(B)
1062 ("wWi" ?
\e$(3%o
\e(B)
1064 ("wWa" ?
\e$(3%p
\e(B)
1065 ("wWE" ?
\e$(3%q
\e(B)
1066 ("wW'" ?
\e$(3%r
\e(B)
1083 ("`10" ?
\e$(3$y
\e(B)
1084 ("`20" ?
\e$(3$z
\e(B)
1085 ("`30" ?
\e$(3${
\e(B)
1086 ("`40" ?
\e$(3$|
\e(B)
1087 ("`50" ?
\e$(3$}
\e(B)
1088 ("`60" ?
\e$(3$~
\e(B)
1089 ("`70" ?
\e$(3%!
\e(B)
1090 ("`80" ?
\e$(3%"
\e(B)
1091 ("`90" ?
\e$(3%#
\e(B)
1092 ("`100" ?
\e$(3%$
\e(B)
1093 ("`1000" ["
\e$(3$y%$
\e(B"])
1094 ("`10000" ?
\e$(3%%
\e(B)
1097 ;; The translation of `a' depends on the language (Tigrigna or Amharic).
1098 (add-hook 'quail-mode-hook
1101 (if (ethio-prefer-amharic-p) ?
\e$(3"c
\e(B ?
\e$(3"f
\e(B)
1104 ;;; quail/ethiopic.el ends here