Mercurial > emacs
annotate leim/quail/japanese.el @ 22654:a9212d075e88
(mule-version): Changed to 4.0.
(mule-version-date): Updated.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 01 Jul 1998 07:16:28 +0000 |
parents | a8d0c3ae93ce |
children | 5fb5debece56 |
rev | line source |
---|---|
18673 | 1 ;;; quail/japanese.el --- Quail package for inputting Japanese |
2 | |
3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN. | |
4 ;; Licensed to the Free Software Foundation. | |
5 | |
6 ;; Keywords: multilingual, input method, Japanese | |
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 | |
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. | |
24 | |
25 ;;; Code: | |
26 | |
27 (require 'quail) | |
28 (require 'kkc) | |
29 | |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
30 ;; Update Quail translation region while considering Japanese bizarre |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
31 ;; translation rules. |
18673 | 32 (defun quail-japanese-update-translation (control-flag) |
33 (cond ((eq control-flag t) | |
34 (insert quail-current-str) | |
35 (quail-terminate-translation)) | |
36 ((null control-flag) | |
37 (if (/= (aref quail-current-key 0) ?q) | |
38 (insert (or quail-current-str quail-current-key)))) | |
39 (t ; i.e. (numberp control-flag) | |
40 (cond ((= (aref quail-current-key 0) ?n) | |
41 (insert ?$B$s(B)) | |
42 ((= (aref quail-current-key 0) (aref quail-current-key 1)) | |
43 (insert ?$B$C(B)) | |
44 (t | |
45 (insert (aref quail-current-key 0)))) | |
46 (setq unread-command-events | |
47 (list (aref quail-current-key control-flag))) | |
48 (quail-terminate-translation)))) | |
49 | |
50 ;; Flag to control the behavior of `quail-japanese-toggle-kana'. | |
51 (defvar quail-japanese-kana-state nil) | |
52 (make-variable-buffer-local 'quail-japanese-kana-state) | |
53 | |
54 ;; Convert Hiragana <-> Katakana in the current translation region. | |
55 (defun quail-japanese-toggle-kana () | |
56 (interactive) | |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
57 (let ((start (overlay-start quail-conv-overlay)) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
58 (end (overlay-end quail-conv-overlay))) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
59 (setq quail-japanese-kana-state |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
60 (if (eq last-command this-command) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
61 (not quail-japanese-kana-state))) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
62 (if quail-japanese-kana-state |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
63 (japanese-hiragana-region start end) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
64 (japanese-katakana-region start end)) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
65 (goto-char (overlay-end quail-conv-overlay)))) |
18673 | 66 |
67 ;; Convert Hiragana in the current translation region to Kanji by KKC | |
68 ;; (Kana Kanji Converter) utility. | |
69 (defun quail-japanese-kanji-kkc () | |
70 (interactive) | |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
71 (let ((from (overlay-start quail-conv-overlay)) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
72 (to (overlay-end quail-conv-overlay)) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
73 newfrom) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
74 (quail-delete-overlays) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
75 (setq overriding-terminal-local-map nil) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
76 (kkc-region from to 'quail-japanese-kkc-mode-exit))) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
77 |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
78 ;; Function to call on exiting KKC mode. ARG is nil if KKC mode is |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
79 ;; exited normally, else ARG is a cons (FROM . TO) where FROM and TO |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
80 ;; specify a region not yet processed. |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
81 (defun quail-japanese-kkc-mode-exit (arg) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
82 (if arg |
19517
a8d0c3ae93ce
(quail-japanese-kkc-mode-exit): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19459
diff
changeset
|
83 (progn |
a8d0c3ae93ce
(quail-japanese-kkc-mode-exit): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19459
diff
changeset
|
84 (setq overriding-terminal-local-map (quail-conversion-keymap)) |
a8d0c3ae93ce
(quail-japanese-kkc-mode-exit): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19459
diff
changeset
|
85 (move-overlay quail-conv-overlay (car arg) (cdr arg))) |
19459
4a7041bb28d2
(quail-japanese-kkc-mode-exit): Run
Kenichi Handa <handa@m17n.org>
parents:
19411
diff
changeset
|
86 (run-hooks 'input-method-after-insert-chunk-hook))) |
18673 | 87 |
88 (defun quail-japanese-self-insert-and-switch-to-alpha (key idx) | |
89 (quail-delete-region) | |
90 (setq unread-command-events (list (aref key (1- idx)))) | |
91 (quail-japanese-switch-package "q" 1)) | |
92 | |
93 (defvar quail-japanese-switch-table | |
94 '((?z . "japanese-zenkaku") | |
95 (?k . "japanese-hankaku-kana") | |
96 (?h . "japanese") | |
97 (?q . ("japanese-ascii")))) | |
98 | |
99 (defvar quail-japanese-package-saved nil) | |
100 (make-variable-buffer-local 'quail-japanese-package-saved) | |
101 (put 'quail-japanese-package-saved 'permanent-local t) | |
102 | |
103 (defun quail-japanese-switch-package (key idx) | |
104 (let ((pkg (cdr (assq (aref key (1- idx)) quail-japanese-switch-table)))) | |
105 (if (null pkg) | |
106 (error "No package to be switched") | |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
107 (setq overriding-terminal-local-map nil) |
18673 | 108 (quail-delete-region) |
109 (if (stringp pkg) | |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
110 (activate-input-method pkg) |
18673 | 111 (if (string= (car pkg) current-input-method) |
112 (if quail-japanese-package-saved | |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
113 (activate-input-method quail-japanese-package-saved)) |
18673 | 114 (setq quail-japanese-package-saved current-input-method) |
19411
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
115 (activate-input-method (car pkg)))))) |
ae9924361448
(quail-japanese-toggle-kana): Don't call
Kenichi Handa <handa@m17n.org>
parents:
18804
diff
changeset
|
116 (throw 'quail-tag nil)) |
18673 | 117 |
118 (quail-define-package | |
119 "japanese" "Japanese" "A$B$"(B" | |
120 nil | |
121 "Romaji -> Hiragana -> Kanji&Kana | |
122 ---- Special key bindings ---- | |
123 qq: toggle between input methods `japanese' and `japanese-ascii' | |
124 qz: use `japanese-zenkaku' package, \"qh\" puts you back to `japanese' | |
18804
05dcf4a48ded
Doc-string of Quail package japanese modified.
Kenichi Handa <handa@m17n.org>
parents:
18673
diff
changeset
|
125 K: toggle converting region between Katakana and Hiragana |
18673 | 126 SPC: convert to Kanji&Kana |
127 z: insert one Japanese symbol according to a key which follows | |
128 " | |
129 nil t t nil nil nil nil nil | |
130 'quail-japanese-update-translation | |
131 '(("K" . quail-japanese-toggle-kana) | |
132 (" " . quail-japanese-kanji-kkc) | |
133 ("\C-m" . quail-no-conversion) | |
134 ([return] . quail-no-conversion)) | |
135 ) | |
136 | |
137 (quail-define-rules | |
138 | |
139 ( "a" "$B$"(B") ( "i" "$B$$(B") ( "u" "$B$&(B") ( "e" "$B$((B") ( "o" "$B$*(B") | |
140 ("ka" "$B$+(B") ("ki" "$B$-(B") ("ku" "$B$/(B") ("ke" "$B$1(B") ("ko" "$B$3(B") | |
141 ("sa" "$B$5(B") ("si" "$B$7(B") ("su" "$B$9(B") ("se" "$B$;(B") ("so" "$B$=(B") | |
142 ("ta" "$B$?(B") ("ti" "$B$A(B") ("tu" "$B$D(B") ("te" "$B$F(B") ("to" "$B$H(B") | |
143 ("na" "$B$J(B") ("ni" "$B$K(B") ("nu" "$B$L(B") ("ne" "$B$M(B") ("no" "$B$N(B") | |
144 ("ha" "$B$O(B") ("hi" "$B$R(B") ("hu" "$B$U(B") ("he" "$B$X(B") ("ho" "$B$[(B") | |
145 ("ma" "$B$^(B") ("mi" "$B$_(B") ("mu" "$B$`(B") ("me" "$B$a(B") ("mo" "$B$b(B") | |
146 ("ya" "$B$d(B") ("yu" "$B$f(B") ("yo" "$B$h(B") | |
147 ("ra" "$B$i(B") ("ri" "$B$j(B") ("ru" "$B$k(B") ("re" "$B$l(B") ("ro" "$B$m(B") | |
148 ("la" "$B$i(B") ("li" "$B$j(B") ("lu" "$B$k(B") ("le" "$B$l(B") ("lo" "$B$m(B") | |
149 ("wa" "$B$o(B") ("wi" "$B$p(B") ("wu" "$B$&(B") ("we" "$B$q(B") ("wo" "$B$r(B") | |
150 ("n'" "$B$s(B") | |
151 ("ga" "$B$,(B") ("gi" "$B$.(B") ("gu" "$B$0(B") ("ge" "$B$2(B") ("go" "$B$4(B") | |
152 ("za" "$B$6(B") ("zi" "$B$8(B") ("zu" "$B$:(B") ("ze" "$B$<(B") ("zo" "$B$>(B") | |
153 ("da" "$B$@(B") ("di" "$B$B(B") ("du" "$B$E(B") ("de" "$B$G(B") ("do" "$B$I(B") | |
154 ("ba" "$B$P(B") ("bi" "$B$S(B") ("bu" "$B$V(B") ("be" "$B$Y(B") ("bo" "$B$\(B") | |
155 ("pa" "$B$Q(B") ("pi" "$B$T(B") ("pu" "$B$W(B") ("pe" "$B$Z(B") ("po" "$B$](B") | |
156 | |
157 ("kya" ["$B$-$c(B"]) ("kyu" ["$B$-$e(B"]) ("kye" ["$B$-$'(B"]) ("kyo" ["$B$-$g(B"]) | |
158 ("sya" ["$B$7$c(B"]) ("syu" ["$B$7$e(B"]) ("sye" ["$B$7$'(B"]) ("syo" ["$B$7$g(B"]) | |
159 ("sha" ["$B$7$c(B"]) ("shu" ["$B$7$e(B"]) ("she" ["$B$7$'(B"]) ("sho" ["$B$7$g(B"]) | |
160 ("cha" ["$B$A$c(B"]) ("chu" ["$B$A$e(B"]) ("che" ["$B$A$'(B"]) ("cho" ["$B$A$g(B"]) | |
161 ("tya" ["$B$A$c(B"]) ("tyu" ["$B$A$e(B"]) ("tye" ["$B$A$'(B"]) ("tyo" ["$B$A$g(B"]) | |
162 ("nya" ["$B$K$c(B"]) ("nyu" ["$B$K$e(B"]) ("nye" ["$B$K$'(B"]) ("nyo" ["$B$K$g(B"]) | |
163 ("hya" ["$B$R$c(B"]) ("hyu" ["$B$R$e(B"]) ("hye" ["$B$R$'(B"]) ("hyo" ["$B$R$g(B"]) | |
164 ("mya" ["$B$_$c(B"]) ("myu" ["$B$_$e(B"]) ("mye" ["$B$_$'(B"]) ("myo" ["$B$_$g(B"]) | |
165 ("rya" ["$B$j$c(B"]) ("ryu" ["$B$j$e(B"]) ("rye" ["$B$j$'(B"]) ("ryo" ["$B$j$g(B"]) | |
166 ("lya" ["$B$j$c(B"]) ("lyu" ["$B$j$e(B"]) ("lye" ["$B$j$'(B"]) ("lyo" ["$B$j$g(B"]) | |
167 ("gya" ["$B$.$c(B"]) ("gyu" ["$B$.$e(B"]) ("gye" ["$B$.$'(B"]) ("gyo" ["$B$.$g(B"]) | |
168 ("zya" ["$B$8$c(B"]) ("zyu" ["$B$8$e(B"]) ("zye" ["$B$8$'(B"]) ("zyo" ["$B$8$g(B"]) | |
169 ("jya" ["$B$8$c(B"]) ("jyu" ["$B$8$e(B"]) ("jye" ["$B$8$'(B"]) ("jyo" ["$B$8$g(B"]) | |
170 ( "ja" ["$B$8$c(B"]) ( "ju" ["$B$8$e(B"]) ( "je" ["$B$8$'(B"]) ( "jo" ["$B$8$g(B"]) | |
171 ("bya" ["$B$S$c(B"]) ("byu" ["$B$S$e(B"]) ("bye" ["$B$S$'(B"]) ("byo" ["$B$S$g(B"]) | |
172 ("pya" ["$B$T$c(B"]) ("pyu" ["$B$T$e(B"]) ("pye" ["$B$T$'(B"]) ("pyo" ["$B$T$g(B"]) | |
173 | |
174 ("kwa" ["$B$/$n(B"]) ("kwi" ["$B$/$#(B"]) ("kwe" ["$B$/$'(B"]) ("kwo" ["$B$/$)(B"]) | |
175 ("tsa" ["$B$D$!(B"]) ("tsi" ["$B$D$#(B"]) ("tse" ["$B$D$'(B"]) ("tso" ["$B$D$)(B"]) | |
176 ( "fa" ["$B$U$!(B"]) ( "fi" ["$B$U$#(B"]) ( "fe" ["$B$U$'(B"]) ( "fo" ["$B$U$)(B"]) | |
177 ("gwa" ["$B$0$n(B"]) ("gwi" ["$B$0$#(B"]) ("gwe" ["$B$0$'(B"]) ("gwo" ["$B$0$)(B"]) | |
178 | |
179 ("dyi" ["$B$G$#(B"]) ("dyu" ["$B$I$%(B"]) ("dye" ["$B$G$'(B"]) ("dyo" ["$B$I$)(B"]) | |
180 ("xwi" ["$B$&$#(B"]) ("xwe" ["$B$&$'(B"]) ("xwo" ["$B$&$)(B"]) | |
181 | |
182 ("shi" "$B$7(B") ("tyi" ["$B$F$#(B"]) ("chi" "$B$A(B") ("tsu" "$B$D(B") ("ji" "$B$8(B") | |
183 ("fu" "$B$U(B") | |
184 ("ye" ["$B$$$'(B"]) | |
185 | |
186 ("va" ["$B%t$!(B"]) ("vi" ["$B%t$#(B"]) ("vu" "$B%t(B") ("ve" ["$B%t$'(B"]) ("vo" ["$B%t$)(B"]) | |
187 | |
188 ("xa" "$B$!(B") ("xi" "$B$#(B") ("xu" "$B$%(B") ("xe" "$B$'(B") ("xo" "$B$)(B") | |
189 ("xtu" "$B$C(B") ("xya" "$B$c(B") ("xyu" "$B$e(B") ("xyo" "$B$g(B") ("xwa" "$B$n(B") | |
190 ("xka" "$B%u(B") ("xke" "$B%v(B") | |
191 | |
192 ("1" "$B#1(B") ("2" "$B#2(B") ("3" "$B#3(B") ("4" "$B#4(B") ("5" "$B#5(B") | |
193 ("6" "$B#6(B") ("7" "$B#7(B") ("8" "$B#8(B") ("9" "$B#9(B") ("0" "$B#0(B") | |
194 | |
195 ("!" "$B!*(B") ("@" "$B!w(B") ("#" "$B!t(B") ("$" "$B!p(B") ("%" "$B!s(B") | |
196 ("^" "$B!0(B") ("&" "$B!u(B") ("*" "$B!v(B") ("(" "$B!J(B") (")" "$B!K(B") | |
197 ("-" "$B!<(B") ("=" "$B!a(B") ("`" "$B!.(B") ("\\" "$B!o(B") ("|" "$B!C(B") | |
198 ("_" "$B!2(B") ("+" "$B!\(B") ("~" "$B!1(B") ("[" "$B!V(B") ("]" "$B!W(B") | |
199 ("{" "$B!P(B") ("}" "$B!Q(B") (":" "$B!'(B") (";" "$B!((B") ("\"" "$B!I(B") | |
200 ("'" "$B!G(B") ("." "$B!#(B") ("," "$B!"(B") ("<" "$B!c(B") (">" "$B!d(B") | |
201 ("?" "$B!)(B") ("/" "$B!?(B") | |
202 | |
203 ("z1" "$B!{(B") ("z!" "$B!|(B") | |
204 ("z2" "$B"&(B") ("z@" "$B"'(B") | |
205 ("z3" "$B"$(B") ("z#" "$B"%(B") | |
206 ("z4" "$B""(B") ("z$" "$B"#(B") | |
207 ("z5" "$B!~(B") ("z%" "$B"!(B") | |
208 ("z6" "$B!y(B") ("z^" "$B!z(B") | |
209 ("z7" "$B!}(B") ("z&" "$B!r(B") | |
210 ("z8" "$B!q(B") ("z*" "$B!_(B") | |
211 ("z9" "$B!i(B") ("z(" "$B!Z(B") | |
212 ("z0" "$B!j(B") ("z)" "$B![(B") | |
213 ("z-" "$B!A(B") ("z_" "$B!h(B") | |
214 ("z=" "$B!b(B") ("z+" "$B!^(B") | |
215 ("z\\" "$B!@(B") ("z|" "$B!B(B") | |
216 ("z`" "$B!-(B") ("z~" "$B!/(B") | |
217 | |
218 ("zq" "$B!T(B") ("zQ" "$B!R(B") | |
219 ("zw" "$B!U(B") ("zW" "$B!S(B") | |
220 ("zr" "$B!9(B") ("zR" "$B!8(B") | |
221 ("zt" "$B!:(B") ("zT" "$B!x(B") | |
222 ("zp" "$B")(B") ("zP" "$B",(B") | |
223 ("z[" "$B!X(B") ("z{" "$B!L(B") | |
224 ("z]" "$B!Y(B") ("z}" "$B!M(B") | |
225 | |
226 ("zs" "$B!3(B") ("zS" "$B!4(B") | |
227 ("zd" "$B!5(B") ("zD" "$B!6(B") | |
228 ("zf" "$B!7(B") ("zF" "$B"*(B") | |
229 ("zg" "$B!>(B") ("zG" "$B!=(B") | |
230 ("zh" "$B"+(B") | |
231 ("zj" "$B"-(B") | |
232 ("zk" "$B",(B") | |
233 ("zl" "$B"*(B") | |
234 ("z;" "$B!+(B") ("z:" "$B!,(B") | |
235 ("z\'" "$B!F(B") ("z\"" "$B!H(B") | |
236 | |
237 ("zx" ":-") ("zX" ":-)") | |
238 ("zc" "$B!;(B") ("zC" "$B!n(B") | |
239 ("zv" "$B"((B") ("zV" "$B!`(B") | |
240 ("zb" "$B!k(B") ("zB" "$B"+(B") | |
241 ("zn" "$B!l(B") ("zN" "$B"-(B") | |
242 ("zm" "$B!m(B") ("zM" "$B".(B") | |
243 ("z," "$B!E(B") ("z<" "$B!e(B") | |
244 ("z." "$B!D(B") ("z>" "$B!f(B") | |
245 ("z/" "$B!&(B") ("z?" "$B!g(B") | |
246 | |
247 ("\\\\" quail-japanese-self-insert-and-switch-to-alpha) | |
248 ("{{" quail-japanese-self-insert-and-switch-to-alpha) | |
249 ("}}" quail-japanese-self-insert-and-switch-to-alpha) | |
250 | |
251 ("qq" quail-japanese-switch-package) | |
252 ("qz" quail-japanese-switch-package) | |
253 | |
254 ) | |
255 | |
256 (quail-define-package | |
257 "japanese-ascii" "Japanese" "Aa" | |
258 nil | |
259 "Temporary ASCII input mode while using Quail package `japanese' | |
260 Type \"qq\" to go back to previous package." | |
261 nil t t) | |
262 | |
263 (quail-define-rules ("qq" quail-japanese-switch-package)) | |
264 | |
265 (quail-define-package | |
266 "japanese-zenkaku" "Japanese" "$B#A(B" | |
267 nil | |
268 "Japanese zenkaku alpha numeric character input method | |
269 ---- Special key bindings ---- | |
270 qq: toggle between `japanese-zenkaku' and `japanese-ascii' | |
271 qh: use `japanese' package, \"qz\" puts you back to `japanese-zenkaku' | |
272 " | |
273 nil t t) | |
274 | |
275 (quail-define-rules | |
276 | |
277 (" " "$B!!(B") ("!" "$B!*(B") ("\"" "$B!m(B") ("#" "$B!t(B") | |
278 ("$" "$B!p(B") ("%" "$B!s(B") ("&" "$B!u(B") ("'" "$B!l(B") | |
279 ("(" "$B!J(B") (")" "$B!K(B") ("*" "$B!v(B") ("+" "$B!\(B") | |
280 ("," "$B!$(B") ("-" "$B!](B") ("." "$B!%(B") ("/" "$B!?(B") | |
281 ("0" "$B#0(B") ("1" "$B#1(B") ("2" "$B#2(B") ("3" "$B#3(B") | |
282 ("4" "$B#4(B") ("5" "$B#5(B") ("6" "$B#6(B") ("7" "$B#7(B") | |
283 ("8" "$B#8(B") ("9" "$B#9(B") (":" "$B!'(B") (";" "$B!((B") | |
284 ("<" "$B!c(B") ("=" "$B!a(B") (">" "$B!d(B") ("?" "$B!)(B") | |
285 ("@" "$B!w(B") ("A" "$B#A(B") ("B" "$B#B(B") ("C" "$B#C(B") | |
286 ("D" "$B#D(B") ("E" "$B#E(B") ("F" "$B#F(B") ("G" "$B#G(B") | |
287 ("H" "$B#H(B") ("I" "$B#I(B") ("J" "$B#J(B") ("K" "$B#K(B") | |
288 ("L" "$B#L(B") ("M" "$B#M(B") ("N" "$B#N(B") ("O" "$B#O(B") | |
289 ("P" "$B#P(B") ("Q" "$B#Q(B") ("R" "$B#R(B") ("S" "$B#S(B") | |
290 ("T" "$B#T(B") ("U" "$B#U(B") ("V" "$B#V(B") ("W" "$B#W(B") | |
291 ("X" "$B#X(B") ("Y" "$B#Y(B") ("Z" "$B#Z(B") ("[" "$B!N(B") | |
292 ("\\" "$B!o(B") ("]" "$B!O(B") ("^" "$B!0(B") ("_" "$B!2(B") | |
293 ("`" "$B!F(B") ("a" "$B#a(B") ("b" "$B#b(B") ("c" "$B#c(B") | |
294 ("d" "$B#d(B") ("e" "$B#e(B") ("f" "$B#f(B") ("g" "$B#g(B") | |
295 ("h" "$B#h(B") ("i" "$B#i(B") ("j" "$B#j(B") ("k" "$B#k(B") | |
296 ("l" "$B#l(B") ("m" "$B#m(B") ("n" "$B#n(B") ("o" "$B#o(B") | |
297 ("p" "$B#p(B") ("q" "$B#q(B") ("r" "$B#r(B") ("s" "$B#s(B") | |
298 ("t" "$B#t(B") ("u" "$B#u(B") ("v" "$B#v(B") ("w" "$B#w(B") | |
299 ("x" "$B#x(B") ("y" "$B#y(B") ("z" "$B#z(B") ("{" "$B!P(B") | |
300 ("|" "$B!C(B") ("}" "$B!Q(B") ("~" "$B!A(B") | |
301 | |
302 ("qq" quail-japanese-switch-package) | |
303 ("qh" quail-japanese-switch-package) | |
304 ) | |
305 | |
306 (defun quail-japanese-hankaku-update-translation (control-flag) | |
307 (cond ((eq control-flag t) | |
308 (insert (japanese-hankaku quail-current-str)) | |
309 (quail-terminate-translation)) | |
310 ((null control-flag) | |
311 (insert (if quail-current-str | |
312 (japanese-hankaku quail-current-str) | |
313 quail-current-key))) | |
314 (t ; i.e. (numberp control-flag) | |
315 (cond ((= (aref quail-current-key 0) ?n) | |
316 (insert ?(I](B)) | |
317 ((= (aref quail-current-key 0) (aref quail-current-key 1)) | |
318 (insert ?(I/(B)) | |
319 (t | |
320 (insert (aref quail-current-key 0)))) | |
321 (setq unread-command-events | |
322 (list (aref quail-current-key control-flag))) | |
323 (quail-terminate-translation)))) | |
324 | |
325 | |
326 (quail-define-package | |
327 "japanese-hankaku-kana" | |
328 "Japanese" "(I1(B" | |
329 nil | |
330 "Japanese hankaku katakana input method by Roman transliteration | |
331 ---- Special key bindings ---- | |
332 qq: toggle between `japanese-hankaku-kana' and `japanese-ascii' | |
333 " | |
334 nil t t nil nil nil nil nil | |
335 'quail-japanese-hankaku-update-translation) | |
336 | |
337 ;; Use the same map as that of `japanese'. | |
338 (setcar (cdr (cdr quail-current-package)) | |
339 (nth 2 (assoc "japanese" quail-package-alist))) | |
340 | |
341 (quail-define-package | |
342 "japanese-hiragana" "Japanese" "$B$"(B" | |
343 nil | |
344 "Japanese hiragana input method by Roman transliteration" | |
345 nil t t nil nil nil nil nil | |
346 'quail-japanese-update-translation) | |
347 | |
348 ;; Use the same map as that of `japanese'. | |
349 (setcar (cdr (cdr quail-current-package)) | |
350 (nth 2 (assoc "japanese" quail-package-alist))) | |
351 | |
352 ;; Update Quail translation region while converting Hiragana to Katakana. | |
353 (defun quail-japanese-katakana-update-translation (control-flag) | |
354 (cond ((eq control-flag t) | |
355 (insert (japanese-katakana quail-current-str)) | |
356 (quail-terminate-translation)) | |
357 ((null control-flag) | |
358 (insert (if quail-current-str | |
359 (japanese-katakana quail-current-str) | |
360 quail-current-key))) | |
361 (t ; i.e. (numberp control-flag) | |
362 (cond ((= (aref quail-current-key 0) ?n) | |
363 (insert ?$B%s(B)) | |
364 ((= (aref quail-current-key 0) (aref quail-current-key 1)) | |
365 (insert ?$B%C(B)) | |
366 (t | |
367 (insert (aref quail-current-key 0)))) | |
368 (setq unread-command-events | |
369 (list (aref quail-current-key control-flag))) | |
370 (quail-terminate-translation)))) | |
371 | |
372 (quail-define-package | |
373 "japanese-katakana" "Japanese" "$B%"(B" | |
374 nil | |
375 "Japanese katakana input method by Roman transliteration" | |
376 nil t t nil nil nil nil nil | |
377 'quail-japanese-katakana-update-translation) | |
378 | |
379 ;; Use the same map as that of `japanese'. | |
380 (setcar (cdr (cdr quail-current-package)) | |
381 (nth 2 (assoc "japanese" quail-package-alist))) |