(toplevel): Remove definition of `cl-assertion-failed' condition --
[emacs.git] / leim / quail / japanese.el
blob974a68c04490bdcb5be66119e3cf8a13179de231
1 ;;; japanese.el --- Quail package for inputting Japanese -*-coding: iso-2022-7bit;-*-
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2005
4 ;; National Institute of Advanced Industrial Science and Technology (AIST)
5 ;; Registration Number H14PRO021
7 ;; Keywords: multilingual, input method, Japanese
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
26 ;;; Commentary:
28 ;;; Code:
30 (require 'quail)
31 (require 'kkc)
33 (defvar quail-japanese-use-double-n nil
34 "If non-nil, use type \"nn\" to insert \e$B$s\e(B.")
36 ;; Update Quail translation region while considering Japanese bizarre
37 ;; translation rules.
38 (defun quail-japanese-update-translation (control-flag)
39 (if (null control-flag)
40 (setq quail-current-str
41 (if (/= (aref quail-current-key 0) ?q)
42 (or quail-current-str quail-current-key)
43 ""))
44 (if (integerp control-flag)
45 (if (= control-flag 0)
46 (setq quail-current-str (aref quail-current-key 0))
47 (cond ((= (aref quail-current-key 0) ?n)
48 (setq quail-current-str ?\e$B$s\e(B)
49 (if (and quail-japanese-use-double-n
50 (= (aref quail-current-key 1) ?n))
51 (setq control-flag t)))
52 ((= (aref quail-current-key 0) (aref quail-current-key 1))
53 (setq quail-current-str ?\e$B$C\e(B))
55 (setq quail-current-str (aref quail-current-key 0))))
56 (if (integerp control-flag)
57 (setq unread-command-events
58 (list (aref quail-current-key control-flag)))))))
59 control-flag)
61 ;; Convert Hiragana <-> Katakana in the current translation region.
62 (defun quail-japanese-toggle-kana ()
63 (interactive)
64 (setq quail-translating nil)
65 (let ((start (overlay-start quail-conv-overlay))
66 (end (overlay-end quail-conv-overlay)))
67 (save-excursion
68 (goto-char start)
69 (if (re-search-forward "\\cH" end t)
70 (japanese-katakana-region start end)
71 (japanese-hiragana-region start end)))
72 (setq quail-conversion-str
73 (buffer-substring (overlay-start quail-conv-overlay)
74 (overlay-end quail-conv-overlay)))))
76 ;; Convert Hiragana in the current translation region to Kanji by KKC
77 ;; (Kana Kanji Converter) utility.
78 (defun quail-japanese-kanji-kkc ()
79 (interactive)
80 (when (= (char-before (overlay-end quail-conv-overlay)) ?n)
81 ;; The last char is `n'. We had better convert it to `\e$B$s\e(B'
82 ;; before kana-kanji conversion.
83 (goto-char (1- (overlay-end quail-conv-overlay)))
84 (insert ?\e$B$s\e(B)
85 (delete-char 1))
86 (let* ((from (copy-marker (overlay-start quail-conv-overlay)))
87 (len (- (overlay-end quail-conv-overlay) from)))
88 (quail-delete-overlays)
89 (setq quail-current-str nil)
90 (unwind-protect
91 (let ((result (kkc-region from (+ from len))))
92 (move-overlay quail-conv-overlay from (point))
93 (setq quail-conversion-str (buffer-substring from (point)))
94 (if (= (+ from result) (point))
95 (setq quail-converting nil))
96 (setq quail-translating nil))
97 (set-marker from nil))))
99 (defun quail-japanese-self-insert-and-switch-to-alpha (key idx)
100 (quail-delete-region)
101 (setq unread-command-events (list (aref key (1- idx))))
102 (quail-japanese-switch-package "q" 1))
104 (defvar quail-japanese-switch-table
105 '((?z . "japanese-zenkaku")
106 (?k . "japanese-hankaku-kana")
107 (?h . "japanese")
108 (?q . ("japanese-ascii"))))
110 (defvar quail-japanese-package-saved nil)
111 (make-variable-buffer-local 'quail-japanese-package-saved)
112 (put 'quail-japanese-package-saved 'permanent-local t)
114 (defun quail-japanese-switch-package (key idx)
115 (quail-delete-region)
116 (setq quail-current-str nil
117 quail-converting nil
118 quail-conversion-str "")
119 (let ((pkg (cdr (assq (aref key (1- idx)) quail-japanese-switch-table))))
120 (if (null pkg)
121 (quail-error "No package to be switched")
122 (if (stringp pkg)
123 (activate-input-method pkg)
124 (if (string= (car pkg) current-input-method)
125 (if quail-japanese-package-saved
126 (activate-input-method quail-japanese-package-saved))
127 (setq quail-japanese-package-saved current-input-method)
128 (activate-input-method (car pkg))))))
129 (throw 'quail-tag nil))
131 (defvar quail-japanese-transliteration-rules
132 '(( "a" "\e$B$"\e(B") ( "i" "\e$B$$\e(B") ( "u" "\e$B$&\e(B") ( "e" "\e$B$(\e(B") ( "o" "\e$B$*\e(B")
133 ("ka" "\e$B$+\e(B") ("ki" "\e$B$-\e(B") ("ku" "\e$B$/\e(B") ("ke" "\e$B$1\e(B") ("ko" "\e$B$3\e(B")
134 ("sa" "\e$B$5\e(B") ("si" "\e$B$7\e(B") ("su" "\e$B$9\e(B") ("se" "\e$B$;\e(B") ("so" "\e$B$=\e(B")
135 ("ta" "\e$B$?\e(B") ("ti" "\e$B$A\e(B") ("tu" "\e$B$D\e(B") ("te" "\e$B$F\e(B") ("to" "\e$B$H\e(B")
136 ("na" "\e$B$J\e(B") ("ni" "\e$B$K\e(B") ("nu" "\e$B$L\e(B") ("ne" "\e$B$M\e(B") ("no" "\e$B$N\e(B")
137 ("ha" "\e$B$O\e(B") ("hi" "\e$B$R\e(B") ("hu" "\e$B$U\e(B") ("he" "\e$B$X\e(B") ("ho" "\e$B$[\e(B")
138 ("ma" "\e$B$^\e(B") ("mi" "\e$B$_\e(B") ("mu" "\e$B$`\e(B") ("me" "\e$B$a\e(B") ("mo" "\e$B$b\e(B")
139 ("ya" "\e$B$d\e(B") ("yu" "\e$B$f\e(B") ("yo" "\e$B$h\e(B")
140 ("ra" "\e$B$i\e(B") ("ri" "\e$B$j\e(B") ("ru" "\e$B$k\e(B") ("re" "\e$B$l\e(B") ("ro" "\e$B$m\e(B")
141 ("la" "\e$B$i\e(B") ("li" "\e$B$j\e(B") ("lu" "\e$B$k\e(B") ("le" "\e$B$l\e(B") ("lo" "\e$B$m\e(B")
142 ("wa" "\e$B$o\e(B") ("wi" "\e$B$p\e(B") ("wu" "\e$B$&\e(B") ("we" "\e$B$q\e(B") ("wo" "\e$B$r\e(B")
143 ("n'" "\e$B$s\e(B")
144 ("ga" "\e$B$,\e(B") ("gi" "\e$B$.\e(B") ("gu" "\e$B$0\e(B") ("ge" "\e$B$2\e(B") ("go" "\e$B$4\e(B")
145 ("za" "\e$B$6\e(B") ("zi" "\e$B$8\e(B") ("zu" "\e$B$:\e(B") ("ze" "\e$B$<\e(B") ("zo" "\e$B$>\e(B")
146 ("da" "\e$B$@\e(B") ("di" "\e$B$B\e(B") ("du" "\e$B$E\e(B") ("de" "\e$B$G\e(B") ("do" "\e$B$I\e(B")
147 ("ba" "\e$B$P\e(B") ("bi" "\e$B$S\e(B") ("bu" "\e$B$V\e(B") ("be" "\e$B$Y\e(B") ("bo" "\e$B$\\e(B")
148 ("pa" "\e$B$Q\e(B") ("pi" "\e$B$T\e(B") ("pu" "\e$B$W\e(B") ("pe" "\e$B$Z\e(B") ("po" "\e$B$]\e(B")
150 ("kya" ["\e$B$-$c\e(B"]) ("kyu" ["\e$B$-$e\e(B"]) ("kye" ["\e$B$-$'\e(B"]) ("kyo" ["\e$B$-$g\e(B"])
151 ("sya" ["\e$B$7$c\e(B"]) ("syu" ["\e$B$7$e\e(B"]) ("sye" ["\e$B$7$'\e(B"]) ("syo" ["\e$B$7$g\e(B"])
152 ("sha" ["\e$B$7$c\e(B"]) ("shu" ["\e$B$7$e\e(B"]) ("she" ["\e$B$7$'\e(B"]) ("sho" ["\e$B$7$g\e(B"])
153 ("cha" ["\e$B$A$c\e(B"]) ("chu" ["\e$B$A$e\e(B"]) ("che" ["\e$B$A$'\e(B"]) ("cho" ["\e$B$A$g\e(B"])
154 ("tya" ["\e$B$A$c\e(B"]) ("tyu" ["\e$B$A$e\e(B"]) ("tye" ["\e$B$A$'\e(B"]) ("tyo" ["\e$B$A$g\e(B"])
155 ("nya" ["\e$B$K$c\e(B"]) ("nyu" ["\e$B$K$e\e(B"]) ("nye" ["\e$B$K$'\e(B"]) ("nyo" ["\e$B$K$g\e(B"])
156 ("hya" ["\e$B$R$c\e(B"]) ("hyu" ["\e$B$R$e\e(B"]) ("hye" ["\e$B$R$'\e(B"]) ("hyo" ["\e$B$R$g\e(B"])
157 ("mya" ["\e$B$_$c\e(B"]) ("myu" ["\e$B$_$e\e(B"]) ("mye" ["\e$B$_$'\e(B"]) ("myo" ["\e$B$_$g\e(B"])
158 ("rya" ["\e$B$j$c\e(B"]) ("ryu" ["\e$B$j$e\e(B"]) ("rye" ["\e$B$j$'\e(B"]) ("ryo" ["\e$B$j$g\e(B"])
159 ("lya" ["\e$B$j$c\e(B"]) ("lyu" ["\e$B$j$e\e(B"]) ("lye" ["\e$B$j$'\e(B"]) ("lyo" ["\e$B$j$g\e(B"])
160 ("gya" ["\e$B$.$c\e(B"]) ("gyu" ["\e$B$.$e\e(B"]) ("gye" ["\e$B$.$'\e(B"]) ("gyo" ["\e$B$.$g\e(B"])
161 ("zya" ["\e$B$8$c\e(B"]) ("zyu" ["\e$B$8$e\e(B"]) ("zye" ["\e$B$8$'\e(B"]) ("zyo" ["\e$B$8$g\e(B"])
162 ("jya" ["\e$B$8$c\e(B"]) ("jyu" ["\e$B$8$e\e(B"]) ("jye" ["\e$B$8$'\e(B"]) ("jyo" ["\e$B$8$g\e(B"])
163 ( "ja" ["\e$B$8$c\e(B"]) ( "ju" ["\e$B$8$e\e(B"]) ( "je" ["\e$B$8$'\e(B"]) ( "jo" ["\e$B$8$g\e(B"])
164 ("bya" ["\e$B$S$c\e(B"]) ("byu" ["\e$B$S$e\e(B"]) ("bye" ["\e$B$S$'\e(B"]) ("byo" ["\e$B$S$g\e(B"])
165 ("pya" ["\e$B$T$c\e(B"]) ("pyu" ["\e$B$T$e\e(B"]) ("pye" ["\e$B$T$'\e(B"]) ("pyo" ["\e$B$T$g\e(B"])
167 ("kwa" ["\e$B$/$n\e(B"]) ("kwi" ["\e$B$/$#\e(B"]) ("kwe" ["\e$B$/$'\e(B"]) ("kwo" ["\e$B$/$)\e(B"])
168 ("tsa" ["\e$B$D$!\e(B"]) ("tsi" ["\e$B$D$#\e(B"]) ("tse" ["\e$B$D$'\e(B"]) ("tso" ["\e$B$D$)\e(B"])
169 ( "fa" ["\e$B$U$!\e(B"]) ( "fi" ["\e$B$U$#\e(B"]) ( "fe" ["\e$B$U$'\e(B"]) ( "fo" ["\e$B$U$)\e(B"])
170 ("gwa" ["\e$B$0$n\e(B"]) ("gwi" ["\e$B$0$#\e(B"]) ("gwe" ["\e$B$0$'\e(B"]) ("gwo" ["\e$B$0$)\e(B"])
172 ("dyi" ["\e$B$G$#\e(B"]) ("dyu" ["\e$B$I$%\e(B"]) ("dye" ["\e$B$G$'\e(B"]) ("dyo" ["\e$B$I$)\e(B"])
173 ("xwi" ["\e$B$&$#\e(B"]) ("xwe" ["\e$B$&$'\e(B"]) ("xwo" ["\e$B$&$)\e(B"])
175 ("shi" "\e$B$7\e(B") ("tyi" ["\e$B$F$#\e(B"]) ("chi" "\e$B$A\e(B") ("tsu" "\e$B$D\e(B") ("ji" "\e$B$8\e(B")
176 ("fu" "\e$B$U\e(B")
177 ("ye" ["\e$B$$$'\e(B"])
179 ("va" ["\e$B%t$!\e(B"]) ("vi" ["\e$B%t$#\e(B"]) ("vu" "\e$B%t\e(B") ("ve" ["\e$B%t$'\e(B"]) ("vo" ["\e$B%t$)\e(B"])
181 ("xa" "\e$B$!\e(B") ("xi" "\e$B$#\e(B") ("xu" "\e$B$%\e(B") ("xe" "\e$B$'\e(B") ("xo" "\e$B$)\e(B")
182 ("xtu" "\e$B$C\e(B") ("xya" "\e$B$c\e(B") ("xyu" "\e$B$e\e(B") ("xyo" "\e$B$g\e(B") ("xwa" "\e$B$n\e(B")
183 ("xka" "\e$B%u\e(B") ("xke" "\e$B%v\e(B")
185 ("1" "\e$B#1\e(B") ("2" "\e$B#2\e(B") ("3" "\e$B#3\e(B") ("4" "\e$B#4\e(B") ("5" "\e$B#5\e(B")
186 ("6" "\e$B#6\e(B") ("7" "\e$B#7\e(B") ("8" "\e$B#8\e(B") ("9" "\e$B#9\e(B") ("0" "\e$B#0\e(B")
188 ("!" "\e$B!*\e(B") ("@" "\e$B!w\e(B") ("#" "\e$B!t\e(B") ("$" "\e$B!p\e(B") ("%" "\e$B!s\e(B")
189 ("^" "\e$B!0\e(B") ("&" "\e$B!u\e(B") ("*" "\e$B!v\e(B") ("(" "\e$B!J\e(B") (")" "\e$B!K\e(B")
190 ("-" "\e$B!<\e(B") ("=" "\e$B!a\e(B") ("`" "\e$B!.\e(B") ("\\" "\e$B!o\e(B") ("|" "\e$B!C\e(B")
191 ("_" "\e$B!2\e(B") ("+" "\e$B!\\e(B") ("~" "\e$B!1\e(B") ("[" "\e$B!V\e(B") ("]" "\e$B!W\e(B")
192 ("{" "\e$B!P\e(B") ("}" "\e$B!Q\e(B") (":" "\e$B!'\e(B") (";" "\e$B!(\e(B") ("\"" "\e$B!I\e(B")
193 ("'" "\e$B!G\e(B") ("." "\e$B!#\e(B") ("," "\e$B!"\e(B") ("<" "\e$B!c\e(B") (">" "\e$B!d\e(B")
194 ("?" "\e$B!)\e(B") ("/" "\e$B!?\e(B")
196 ("z1" "\e$B!{\e(B") ("z!" "\e$B!|\e(B")
197 ("z2" "\e$B"&\e(B") ("z@" "\e$B"'\e(B")
198 ("z3" "\e$B"$\e(B") ("z#" "\e$B"%\e(B")
199 ("z4" "\e$B""\e(B") ("z$" "\e$B"#\e(B")
200 ("z5" "\e$B!~\e(B") ("z%" "\e$B"!\e(B")
201 ("z6" "\e$B!y\e(B") ("z^" "\e$B!z\e(B")
202 ("z7" "\e$B!}\e(B") ("z&" "\e$B!r\e(B")
203 ("z8" "\e$B!q\e(B") ("z*" "\e$B!_\e(B")
204 ("z9" "\e$B!i\e(B") ("z(" "\e$B!Z\e(B")
205 ("z0" "\e$B!j\e(B") ("z)" "\e$B![\e(B")
206 ("z-" "\e$B!A\e(B") ("z_" "\e$B!h\e(B")
207 ("z=" "\e$B!b\e(B") ("z+" "\e$B!^\e(B")
208 ("z\\" "\e$B!@\e(B") ("z|" "\e$B!B\e(B")
209 ("z`" "\e$B!-\e(B") ("z~" "\e$B!/\e(B")
211 ("zq" "\e$B!T\e(B") ("zQ" "\e$B!R\e(B")
212 ("zw" "\e$B!U\e(B") ("zW" "\e$B!S\e(B")
213 ("zr" "\e$B!9\e(B") ("zR" "\e$B!8\e(B")
214 ("zt" "\e$B!:\e(B") ("zT" "\e$B!x\e(B")
215 ("zp" "\e$B")\e(B") ("zP" "\e$B",\e(B")
216 ("z[" "\e$B!X\e(B") ("z{" "\e$B!L\e(B")
217 ("z]" "\e$B!Y\e(B") ("z}" "\e$B!M\e(B")
219 ("zs" "\e$B!3\e(B") ("zS" "\e$B!4\e(B")
220 ("zd" "\e$B!5\e(B") ("zD" "\e$B!6\e(B")
221 ("zf" "\e$B!7\e(B") ("zF" "\e$B"*\e(B")
222 ("zg" "\e$B!>\e(B") ("zG" "\e$B!=\e(B")
223 ("zh" "\e$B"+\e(B")
224 ("zj" "\e$B"-\e(B")
225 ("zk" "\e$B",\e(B")
226 ("zl" "\e$B"*\e(B")
227 ("z;" "\e$B!+\e(B") ("z:" "\e$B!,\e(B")
228 ("z\'" "\e$B!F\e(B") ("z\"" "\e$B!H\e(B")
230 ("zx" [":-"]) ("zX" [":-)"])
231 ("zc" "\e$B!;\e(B") ("zC" "\e$B!n\e(B")
232 ("zv" "\e$B"(\e(B") ("zV" "\e$B!`\e(B")
233 ("zb" "\e$B!k\e(B") ("zB" "\e$B"+\e(B")
234 ("zn" "\e$B!l\e(B") ("zN" "\e$B"-\e(B")
235 ("zm" "\e$B!m\e(B") ("zM" "\e$B".\e(B")
236 ("z," "\e$B!E\e(B") ("z<" "\e$B!e\e(B")
237 ("z." "\e$B!D\e(B") ("z>" "\e$B!f\e(B")
238 ("z/" "\e$B!&\e(B") ("z?" "\e$B!g\e(B")
240 ("\\\\" quail-japanese-self-insert-and-switch-to-alpha)
241 ("{{" quail-japanese-self-insert-and-switch-to-alpha)
242 ("}}" quail-japanese-self-insert-and-switch-to-alpha)
244 ("qq" quail-japanese-switch-package)
245 ("qz" quail-japanese-switch-package)
249 ;; \e$B%m!<%^;zF~NO5Z$S2>L>4A;zJQ49$K$h$kF|K\8lF~NO%a%=%C%I\e(B
251 ;; \e$B$3$NF~NO%a%=%C%I$G$NF|K\8l$NF~NO$OFs$D$N%9%F!<%8!V%m!<%^;z2>L>JQ49!W\e(B
252 ;; \e$B$H!V2>L>4A;zJQ49!W$+$i$J$k!#:G=i$O%m!<%^;z2>L>JQ49$N%9%F!<%8$G!"%9\e(B
253 ;; \e$B%Z!<%9%-!<$r2!$9$3$H$K$h$j!"<!$N%9%F!<%8!V2>L>4A;zJQ49!W$X?J$`!#\e(B
255 ;; \e$B!V%m!<%^;z2>L>JQ49!W\e(B
257 ;; \e$BJ?2>L>$O>.J8;z%-!<!JNs!K$rBG$D$3$H$K$h$jF~NO!#6gFIE@!"3g8LN`$OBP1~\e(B
258 ;; \e$B$9$k1Q;z%-!<$rBG$D$3$H$K$h$jF~NO!#$=$NB>$N%7%s%\%k$O\e(B `z' \e$B$KB3$1$F2?\e(B
259 ;; \e$B$l$+$N%-!<$rBG$D$3$H$K$h$jF~NO!#2<$KA4$F$N2DG=$J%-!<%7!<%1%s%9%j%9\e(B
260 ;; \e$B%H%"%C%W$5$l$F$$$k!#F~NO$5$l$?J8;z$O2<@~$G<($5$l$k!#\e(B
262 ;; \e$B$5$i$K0J2<$N%-!<$GFCJL$J=hM}$r9T$&!#\e(B
264 ;; K \e$BJ?2>L>$rJR2>L>$K!"$"$k$$$OJR2>L>$rJ?2>L>$KJQ49\e(B
265 ;; qq \e$B$3$NF~NO%a%=%C%I$H\e(B `japanese-ascii' \e$BF~NO%a%=%C%I$r%H%0%k@ZBX\e(B
266 ;; qz `japanese-zenkaku' \e$BF~NO%a%=%C%I$K%7%U%H\e(B
267 ;; qh \e$B$HBG$F$P85$KLa$k\e(B
268 ;; RET \e$B8=:_$NF~NOJ8;zNs$r3NDj\e(B
269 ;; SPC \e$B2>L>4A;zJQ49$K?J$`\e(B
271 ;; `japanese-ascii' \e$BF~NO%a%=%C%I$O\e(B ASCII \e$BJ8;z$rF~NO$9$k$N$K;H$&!#$3$l\e(B
272 ;; \e$B$OF~NO%a%=%C%I$r%*%U$K$9$k$N$H$[$H$s$IF1$8$G$"$k!#0[$J$k$N$O\e(B qq \e$B$H\e(B
273 ;; \e$BBG$D$3$H$K$h$j!"\e(B`japanese' \e$BF~NO%a%=%C%I$KLa$l$kE@$G$"$k!#\e(B
275 ;; `japanese-zenkaku' \e$BF~NO%a%=%C%I$OA43Q1Q?t;z$rF~NO$9$k$N$K;H$&!#\e(B
277 ;; \e$B!V%m!<%^;z2>L>JQ49!W%9%F!<%8$G$N%-!<%7!<%1%s%9$N%j%9%H$O:G8e$KIU$1\e(B
278 ;; \e$B$F$"$k!#\e(B
280 ;; \e$B!V2>L>4A;zJQ49!W\e(B
282 ;; \e$B$3$N%9%F!<%8$G$O!"A0%9%F!<%8$GF~NO$5$l$?J8;zNs$r2>L>4A;zJQ49$9$k!#\e(B
283 ;; \e$BJQ49$5$l$?J8;zNs$O!"CmL\J8@a!JH?E>I=<(!K$H;D$j$NF~NO!J2<@~I=<(!K$K\e(B
284 ;; \e$BJ,$1$i$l$k!#CmL\J8@a$KBP$7$F$O0J2<$N%3%^%s%I$,;H$($k!#\e(B
286 ;; SPC, C-n kkc-next
287 ;; \e$B<!$NJQ498uJd$rI=<(\e(B
288 ;; kkc-show-conversion-list-count \e$B0J>eB3$1$FBG$F$P!"JQ498uJd%j%9\e(B
289 ;; \e$B%H$r%(%3!<%(%j%"$KI=<(\e(B
290 ;; C-p kkc-prev
291 ;; \e$BA0$NJQ498uJd$rI=<(\e(B
292 ;; kkc-show-conversion-list-count \e$B0J>eB3$1$FBG$F$P!"JQ498uJd%j%9\e(B
293 ;; \e$B%H$r%(%3!<%(%j%"$KI=<(\e(B
294 ;; l kkc-show-conversion-list-or-next-group
295 ;; \e$B:G9b#1#08D$^$G$NJQ498uJd$r%(%3!<%(%j%"$KI=<(!#\e(B
296 ;; \e$BB3$1$FBG$?$l$l$P!"<!$N#1#08uJd$rI=<(!#\e(B
297 ;; L kkc-show-conversion-list-or-prev-group
298 ;; \e$B:G9b#1#08D$^$G$NJQ498uJd$r%(%3!<%(%j%"$KI=<(!#\e(B
299 ;; \e$BB3$1$FBG$?$l$l$P!"A0$N#1#08uJd$rI=<(!#\e(B
300 ;; 0..9 kkc-select-from-list
301 ;; \e$BBG$?$l$??t;z$NJQ498uJd$rA*Br\e(B
302 ;; H kkc-hiragana
303 ;; \e$BCmL\J8@a$rJ?2>L>$KJQ49\e(B
304 ;; K kkc-katakana
305 ;; \e$BCmL\J8@a$rJR2>L>$KJQ49\e(B
306 ;; C-o kkc-longer
307 ;; \e$BCmL\J8@a$r8e$m$K0lJ8;z?-$P$9\e(B
308 ;; C-i kkc-shorter
309 ;; \e$BCmL\J8@a$r8e$m$+$i0lJ8;z=L$a$k\e(B
310 ;; C-f kkc-next-phrase
311 ;; \e$BCmL\J8@a$r3NDj$5$;$k!#$b$7;D$j$NF~NO$,$^$@$"$l$P!":G=i$NJ8@a$r\e(B
312 ;; \e$BA*Br$7!"$=$l$rCmL\J8@a$H$7!"$=$N:G=i$NJQ498uJd$rI=<($9$k!#\e(B
313 ;; DEL, C-c kkc-cancel
314 ;; \e$B2>L>4A;zJQ49$r%-%c%s%;%k$7!"%m!<%^;z2>L>JQ49$N%9%F!<%8$KLa$k!#\e(B
315 ;; return kkc-terminate
316 ;; \e$BA4J8@a$r3NDj$5$;$k!#\e(B
317 ;; C-SPC, C-@ kkc-first-char-only
318 ;; \e$B:G=i$NJ8;z$r3NDj$5$;!";D$j$O:o=|$9$k!#\e(B
319 ;; C-h kkc-help
320 ;; \e$B$3$l$i$N%-!<%P%$%s%I$N%j%9%H$rI=<($9$k!#$"\e(B
322 (quail-define-package
323 "japanese" "Japanese" "A\e$B$"\e(B"
325 "Japanese input method by Roman transliteration and Kana-Kanji conversion.
327 When you use this input method, text entry proceeds in two stages:
328 Roman-Kana transliteration and Kana-Kanji conversion. When you start
329 to enter text, you are in the first stage, Roman-Kana transliteration.
330 Type SPC to proceed to the next stage, Kana-Kanji conversion.
332 :: Roman-Kana transliteration ::
334 You can input any Hiragana character as a sequence of lower-case
335 letters, Japanese punctuation characters by typing punctuation keys,
336 Japanese symbols by typing `z' followed by another key. See below for
337 a list of all available sequences. The characters you input are
338 underlined.
340 In addition, the following keys provide special effects:
342 K Change Hiragana to Katakana or Katakana to Hiragana.
343 qq Toggle between this input method and the input method `japanese-ascii'.
344 qz Shift to the input method `japanese-zenkaku'.
345 Typing \"qh\" will put you back to this input method.
346 RET Accept the current character sequence.
347 SPC Proceed to the next stage, Kana-Kanji conversion.
349 The input method `japanese-ascii' is used to enter ASCII characters.
350 This is almost the same as turning off the input method. The only
351 difference is that typing `qq' will put you back into the Japanese
352 input method.
354 The input method `japanese-zenkaku' is used to enter full width
355 JISX0208 characters corresponding to typed ASCII characters.
357 List of the all key sequences for Roman-Kana transliteration is shown
358 at the tail.
360 :: Kana-Kanji conversion ::
362 You can convert the current Japanese characters (underlined) to
363 Kana-Kanji mixed text. In this stage, the converted text is divided
364 into two parts, the current phrase (highlighted) and the remaining
365 input (underlined). The following commands can be used on the
366 current phrase.
368 SPC, C-n kkc-next
369 Show the next candidate for the current phrase.
370 If successively typed `kkc-show-conversion-list-count' times,
371 conversion candidates are shown in the echo area.
372 C-p kkc-prev
373 Show the previous candidate for the current phrase.
374 If successively typed `kkc-show-conversion-list-count' times,
375 conversion candidates are shown in the echo area.
376 l kkc-show-conversion-list-or-next-group
377 Show at most 10 candidates for the current phrase in echo area.
378 If typed repeatedly, show the next 10 candidates.
379 L kkc-show-conversion-list-or-prev-group
380 Show at most 10 candidates for the current phrase in echo area.
381 If typed repeatedly, show the previous 10 candidates.
382 0..9 kkc-select-from-list
383 Select a candidate corresponding to the typed number.
384 H kkc-hiragana
385 Convert the current phrase to Hiragana
386 K kkc-katakana
387 Convert the current phrase to Katakana
388 C-o kkc-longer
389 Extend the current phrase; pull in the first character of
390 the remaining input.
391 C-i kkc-shorter
392 Contract the current phrase; drop its last character
393 back into the remaining input.
394 C-f kkc-next-phrase
395 Accept the current phrase. If there remains input, select
396 the first phrase as the current one, and show the first
397 candidate for the conversion.
398 DEL, C-c kkc-cancel
399 Cancel the conversion, shift back to the Roman-Kana
400 transliteration.
401 return kkc-terminate
402 Accept the whole conversion.
403 C-SPC, C-@ kkc-first-char-only
404 Accept the first character of the current conversion,
405 delete the remaining input.
406 C-h kkc-help
407 List these key bindings.
409 nil t t nil nil nil nil nil
410 'quail-japanese-update-translation
411 '(("K" . quail-japanese-toggle-kana)
412 (" " . quail-japanese-kanji-kkc)
413 ("\C-m" . quail-no-conversion)
414 ([return] . quail-no-conversion))
417 (dolist (elt quail-japanese-transliteration-rules)
418 (quail-defrule (car elt) (nth 1 elt)))
420 (quail-define-package
421 "japanese-ascii" "Japanese" "Aa"
423 "Temporary ASCII input mode used within the input method `japanese'.
424 Type \"qq\" to go back to previous input method."
425 nil t t)
427 (quail-define-rules ("qq" quail-japanese-switch-package))
429 (quail-define-package
430 "japanese-zenkaku" "Japanese" "\e$B#A\e(B"
432 "Japanese zenkaku alpha numeric character input method.
433 ---- Special key bindings ----
434 qq: toggle between this input method and the input method `japanese-ascii'.
435 qh: shift to the input method `japanese',
436 typing \"qz\" puts you back to this input method.
438 nil t t)
440 (quail-define-rules
442 (" " "\e$B!!\e(B") ("!" "\e$B!*\e(B") ("\"" "\e$B!m\e(B") ("#" "\e$B!t\e(B")
443 ("$" "\e$B!p\e(B") ("%" "\e$B!s\e(B") ("&" "\e$B!u\e(B") ("'" "\e$B!l\e(B")
444 ("(" "\e$B!J\e(B") (")" "\e$B!K\e(B") ("*" "\e$B!v\e(B") ("+" "\e$B!\\e(B")
445 ("," "\e$B!$\e(B") ("-" "\e$B!]\e(B") ("." "\e$B!%\e(B") ("/" "\e$B!?\e(B")
446 ("0" "\e$B#0\e(B") ("1" "\e$B#1\e(B") ("2" "\e$B#2\e(B") ("3" "\e$B#3\e(B")
447 ("4" "\e$B#4\e(B") ("5" "\e$B#5\e(B") ("6" "\e$B#6\e(B") ("7" "\e$B#7\e(B")
448 ("8" "\e$B#8\e(B") ("9" "\e$B#9\e(B") (":" "\e$B!'\e(B") (";" "\e$B!(\e(B")
449 ("<" "\e$B!c\e(B") ("=" "\e$B!a\e(B") (">" "\e$B!d\e(B") ("?" "\e$B!)\e(B")
450 ("@" "\e$B!w\e(B") ("A" "\e$B#A\e(B") ("B" "\e$B#B\e(B") ("C" "\e$B#C\e(B")
451 ("D" "\e$B#D\e(B") ("E" "\e$B#E\e(B") ("F" "\e$B#F\e(B") ("G" "\e$B#G\e(B")
452 ("H" "\e$B#H\e(B") ("I" "\e$B#I\e(B") ("J" "\e$B#J\e(B") ("K" "\e$B#K\e(B")
453 ("L" "\e$B#L\e(B") ("M" "\e$B#M\e(B") ("N" "\e$B#N\e(B") ("O" "\e$B#O\e(B")
454 ("P" "\e$B#P\e(B") ("Q" "\e$B#Q\e(B") ("R" "\e$B#R\e(B") ("S" "\e$B#S\e(B")
455 ("T" "\e$B#T\e(B") ("U" "\e$B#U\e(B") ("V" "\e$B#V\e(B") ("W" "\e$B#W\e(B")
456 ("X" "\e$B#X\e(B") ("Y" "\e$B#Y\e(B") ("Z" "\e$B#Z\e(B") ("[" "\e$B!N\e(B")
457 ("\\" "\e$B!o\e(B") ("]" "\e$B!O\e(B") ("^" "\e$B!0\e(B") ("_" "\e$B!2\e(B")
458 ("`" "\e$B!F\e(B") ("a" "\e$B#a\e(B") ("b" "\e$B#b\e(B") ("c" "\e$B#c\e(B")
459 ("d" "\e$B#d\e(B") ("e" "\e$B#e\e(B") ("f" "\e$B#f\e(B") ("g" "\e$B#g\e(B")
460 ("h" "\e$B#h\e(B") ("i" "\e$B#i\e(B") ("j" "\e$B#j\e(B") ("k" "\e$B#k\e(B")
461 ("l" "\e$B#l\e(B") ("m" "\e$B#m\e(B") ("n" "\e$B#n\e(B") ("o" "\e$B#o\e(B")
462 ("p" "\e$B#p\e(B") ("q" "\e$B#q\e(B") ("r" "\e$B#r\e(B") ("s" "\e$B#s\e(B")
463 ("t" "\e$B#t\e(B") ("u" "\e$B#u\e(B") ("v" "\e$B#v\e(B") ("w" "\e$B#w\e(B")
464 ("x" "\e$B#x\e(B") ("y" "\e$B#y\e(B") ("z" "\e$B#z\e(B") ("{" "\e$B!P\e(B")
465 ("|" "\e$B!C\e(B") ("}" "\e$B!Q\e(B") ("~" "\e$B!A\e(B")
467 ("qq" quail-japanese-switch-package)
468 ("qh" quail-japanese-switch-package)
471 (defun quail-japanese-hankaku-update-translation (control-flag)
472 (setq control-flag
473 (quail-japanese-update-translation control-flag))
474 (if (or (and (stringp quail-current-str)
475 (> (length quail-current-str) 0))
476 (integerp quail-current-str))
477 (setq quail-current-str (japanese-hankaku quail-current-str)))
478 control-flag)
480 (quail-define-package
481 "japanese-hankaku-kana"
482 "Japanese" "\e(I1\e(B"
484 "Japanese hankaku katakana input method by Roman transliteration.
485 ---- Special key bindings ----
486 qq: toggle between this input method and the input method `japanese-ascii'.
488 nil t t nil nil nil nil nil
489 'quail-japanese-hankaku-update-translation)
491 (dolist (elt quail-japanese-transliteration-rules)
492 (quail-defrule (car elt)
493 (let ((trans (nth 1 elt)))
494 (when (or (stringp trans) (vectorp trans))
495 (let ((s (japanese-hankaku (if (stringp trans)
496 trans
497 (aref trans 0)))))
498 ;; If the result of the conversion is a string
499 ;; containing more than one character, make the
500 ;; result a vector, so that quail-defrule
501 ;; recognizes the whole string is the
502 ;; translation, instead of interpreting
503 ;; individual characters as alternative
504 ;; translations.
505 (if (and (stringp s) (> (length s) 1))
506 (setq trans (vector s))
507 (setq trans s))))
508 trans)))
510 (quail-define-package
511 "japanese-hiragana" "Japanese" "\e$B$"\e(B"
513 "Japanese hiragana input method by Roman transliteration."
514 nil t t nil nil nil nil nil
515 'quail-japanese-update-translation)
517 ;; Use the same map as that of `japanese'.
518 (setcar (cdr (cdr quail-current-package))
519 (nth 2 (assoc "japanese" quail-package-alist)))
521 ;; Update Quail translation region while converting Hiragana to Katakana.
522 (defun quail-japanese-katakana-update-translation (control-flag)
523 (setq control-flag
524 (quail-japanese-update-translation control-flag))
525 (if (or (and (stringp quail-current-str)
526 (> (length quail-current-str) 0))
527 (integerp quail-current-str))
528 (setq quail-current-str (japanese-katakana quail-current-str)))
529 control-flag)
531 (quail-define-package
532 "japanese-katakana" "Japanese" "\e$B%"\e(B"
534 "Japanese katakana input method by Roman transliteration."
535 nil t t nil nil nil nil nil
536 'quail-japanese-katakana-update-translation)
538 (dolist (elt quail-japanese-transliteration-rules)
539 (quail-defrule (car elt)
540 (let ((trans (nth 1 elt)))
541 (cond ((stringp trans)
542 (japanese-katakana trans))
543 ((vectorp trans)
544 (vector (japanese-katakana (aref trans 0))))
545 (t trans)))))
547 ;;; arch-tag: 47e0bfd4-6ecc-4d01-89a8-d687c5e01ff7
548 ;;; japanese.el ends here