Fix typos and spacing.
[emacs.git] / leim / quail / japanese.el
blobe1f7e74e0306e6d3f2b93827e40e0458dca65abe
1 ;;; japanese.el --- Quail package for inputting Japanese -*-coding: iso-2022-7bit;-*-
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc.
5 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
6 ;; 2006, 2007, 2008, 2009, 2010
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
8 ;; Registration Number H14PRO021
10 ;; Keywords: multilingual, input method, Japanese
12 ;; This file is part of GNU Emacs.
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation, either version 3 of the License, or
17 ;; (at your option) any later version.
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;;; Commentary:
29 ;;; Code:
31 (require 'quail)
32 (require 'kkc)
34 (defvar quail-japanese-use-double-n nil
35 "If non-nil, use type \"nn\" to insert \e$B$s\e(B.")
37 ;; Update Quail translation region while considering Japanese bizarre
38 ;; translation rules.
39 (defun quail-japanese-update-translation (control-flag)
40 (if (null control-flag)
41 (setq quail-current-str
42 (if (/= (aref quail-current-key 0) ?q)
43 (or quail-current-str quail-current-key)
44 ""))
45 (if (integerp control-flag)
46 (if (= control-flag 0)
47 (setq quail-current-str (aref quail-current-key 0))
48 (cond ((= (aref quail-current-key 0) ?n)
49 (setq quail-current-str ?\e$B$s\e(B)
50 (if (and quail-japanese-use-double-n
51 (= (aref quail-current-key 1) ?n))
52 (setq control-flag t)))
53 ((= (aref quail-current-key 0) (aref quail-current-key 1))
54 (setq quail-current-str ?\e$B$C\e(B))
56 (setq quail-current-str (aref quail-current-key 0))))
57 (if (integerp control-flag)
58 (setq unread-command-events
59 (list (aref quail-current-key control-flag)))))))
60 control-flag)
62 ;; Convert Hiragana <-> Katakana in the current translation region.
63 (defun quail-japanese-toggle-kana ()
64 (interactive)
65 (setq quail-translating nil)
66 (let ((start (overlay-start quail-conv-overlay))
67 (end (overlay-end quail-conv-overlay)))
68 (save-excursion
69 (goto-char start)
70 (if (re-search-forward "\\cH" end t)
71 (japanese-katakana-region start end)
72 (japanese-hiragana-region start end)))
73 (setq quail-conversion-str
74 (buffer-substring (overlay-start quail-conv-overlay)
75 (overlay-end quail-conv-overlay)))))
77 ;; Convert Hiragana in the current translation region to Kanji by KKC
78 ;; (Kana Kanji Converter) utility.
79 (defun quail-japanese-kanji-kkc ()
80 (interactive)
81 (when (= (char-before (overlay-end quail-conv-overlay)) ?n)
82 ;; The last char is `n'. We had better convert it to `\e$B$s\e(B'
83 ;; before kana-kanji conversion.
84 (goto-char (1- (overlay-end quail-conv-overlay)))
85 (insert ?\e$B$s\e(B)
86 (delete-char 1))
87 (let* ((from (copy-marker (overlay-start quail-conv-overlay)))
88 (len (- (overlay-end quail-conv-overlay) from)))
89 (quail-delete-overlays)
90 (setq quail-current-str nil)
91 (unwind-protect
92 (let ((result (kkc-region from (+ from len))))
93 (move-overlay quail-conv-overlay from (point))
94 (setq quail-conversion-str (buffer-substring from (point)))
95 (if (= (+ from result) (point))
96 (setq quail-converting nil))
97 (setq quail-translating nil))
98 (set-marker from nil))))
100 (defun quail-japanese-self-insert-and-switch-to-alpha (key idx)
101 (quail-delete-region)
102 (setq unread-command-events (list (aref key (1- idx))))
103 (quail-japanese-switch-package "q" 1))
105 (defvar quail-japanese-switch-table
106 '((?z . "japanese-zenkaku")
107 (?k . "japanese-hankaku-kana")
108 (?h . "japanese")
109 (?q . ("japanese-ascii"))))
111 (defvar quail-japanese-package-saved nil)
112 (make-variable-buffer-local 'quail-japanese-package-saved)
113 (put 'quail-japanese-package-saved 'permanent-local t)
115 (defun quail-japanese-switch-package (key idx)
116 (quail-delete-region)
117 (setq quail-current-str nil
118 quail-converting nil
119 quail-conversion-str "")
120 (let ((pkg (cdr (assq (aref key (1- idx)) quail-japanese-switch-table))))
121 (if (null pkg)
122 (quail-error "No package to be switched")
123 (if (stringp pkg)
124 (activate-input-method pkg)
125 (if (string= (car pkg) current-input-method)
126 (if quail-japanese-package-saved
127 (activate-input-method quail-japanese-package-saved))
128 (setq quail-japanese-package-saved current-input-method)
129 (activate-input-method (car pkg))))))
130 (throw 'quail-tag nil))
132 (defvar quail-japanese-transliteration-rules
133 '(( "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")
134 ("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")
135 ("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")
136 ("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")
137 ("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")
138 ("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")
139 ("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")
140 ("ya" "\e$B$d\e(B") ("yu" "\e$B$f\e(B") ("yo" "\e$B$h\e(B")
141 ("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")
142 ("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")
143 ("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")
144 ("n'" "\e$B$s\e(B")
145 ("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")
146 ("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")
147 ("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")
148 ("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")
149 ("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")
151 ("kya" ["\e$B$-$c\e(B"]) ("kyu" ["\e$B$-$e\e(B"]) ("kye" ["\e$B$-$'\e(B"]) ("kyo" ["\e$B$-$g\e(B"])
152 ("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"])
153 ("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"])
154 ("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"])
155 ("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"])
156 ("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"])
157 ("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"])
158 ("mya" ["\e$B$_$c\e(B"]) ("myu" ["\e$B$_$e\e(B"]) ("mye" ["\e$B$_$'\e(B"]) ("myo" ["\e$B$_$g\e(B"])
159 ("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"])
160 ("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"])
161 ("gya" ["\e$B$.$c\e(B"]) ("gyu" ["\e$B$.$e\e(B"]) ("gye" ["\e$B$.$'\e(B"]) ("gyo" ["\e$B$.$g\e(B"])
162 ("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"])
163 ("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"])
164 ( "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"])
165 ("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"])
166 ("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"])
168 ("kwa" ["\e$B$/$n\e(B"]) ("kwi" ["\e$B$/$#\e(B"]) ("kwe" ["\e$B$/$'\e(B"]) ("kwo" ["\e$B$/$)\e(B"])
169 ("tsa" ["\e$B$D$!\e(B"]) ("tsi" ["\e$B$D$#\e(B"]) ("tse" ["\e$B$D$'\e(B"]) ("tso" ["\e$B$D$)\e(B"])
170 ( "fa" ["\e$B$U$!\e(B"]) ( "fi" ["\e$B$U$#\e(B"]) ( "fe" ["\e$B$U$'\e(B"]) ( "fo" ["\e$B$U$)\e(B"])
171 ("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"])
173 ("dyi" ["\e$B$G$#\e(B"]) ("dyu" ["\e$B$I$%\e(B"]) ("dye" ["\e$B$G$'\e(B"]) ("dyo" ["\e$B$I$)\e(B"])
174 ("xwi" ["\e$B$&$#\e(B"]) ("xwe" ["\e$B$&$'\e(B"]) ("xwo" ["\e$B$&$)\e(B"])
176 ("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")
177 ("fu" "\e$B$U\e(B")
178 ("ye" ["\e$B$$$'\e(B"])
180 ("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"])
182 ("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")
183 ("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")
184 ("xka" "\e$B%u\e(B") ("xke" "\e$B%v\e(B")
186 ("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")
187 ("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")
189 ("!" "\e$B!*\e(B") ("@" "\e$B!w\e(B") ("#" "\e$B!t\e(B") ("$" "\e$B!p\e(B") ("%" "\e$B!s\e(B")
190 ("^" "\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")
191 ("-" "\e$B!<\e(B") ("=" "\e$B!a\e(B") ("`" "\e$B!.\e(B") ("\\" "\e$B!o\e(B") ("|" "\e$B!C\e(B")
192 ("_" "\e$B!2\e(B") ("+" "\e$B!\\e(B") ("~" "\e$B!1\e(B") ("[" "\e$B!V\e(B") ("]" "\e$B!W\e(B")
193 ("{" "\e$B!P\e(B") ("}" "\e$B!Q\e(B") (":" "\e$B!'\e(B") (";" "\e$B!(\e(B") ("\"" "\e$B!I\e(B")
194 ("'" "\e$B!G\e(B") ("." "\e$B!#\e(B") ("," "\e$B!"\e(B") ("<" "\e$B!c\e(B") (">" "\e$B!d\e(B")
195 ("?" "\e$B!)\e(B") ("/" "\e$B!?\e(B")
197 ("z1" "\e$B!{\e(B") ("z!" "\e$B!|\e(B")
198 ("z2" "\e$B"&\e(B") ("z@" "\e$B"'\e(B")
199 ("z3" "\e$B"$\e(B") ("z#" "\e$B"%\e(B")
200 ("z4" "\e$B""\e(B") ("z$" "\e$B"#\e(B")
201 ("z5" "\e$B!~\e(B") ("z%" "\e$B"!\e(B")
202 ("z6" "\e$B!y\e(B") ("z^" "\e$B!z\e(B")
203 ("z7" "\e$B!}\e(B") ("z&" "\e$B!r\e(B")
204 ("z8" "\e$B!q\e(B") ("z*" "\e$B!_\e(B")
205 ("z9" "\e$B!i\e(B") ("z(" "\e$B!Z\e(B")
206 ("z0" "\e$B!j\e(B") ("z)" "\e$B![\e(B")
207 ("z-" "\e$B!A\e(B") ("z_" "\e$B!h\e(B")
208 ("z=" "\e$B!b\e(B") ("z+" "\e$B!^\e(B")
209 ("z\\" "\e$B!@\e(B") ("z|" "\e$B!B\e(B")
210 ("z`" "\e$B!-\e(B") ("z~" "\e$B!/\e(B")
212 ("zq" "\e$B!T\e(B") ("zQ" "\e$B!R\e(B")
213 ("zw" "\e$B!U\e(B") ("zW" "\e$B!S\e(B")
214 ("zr" "\e$B!9\e(B") ("zR" "\e$B!8\e(B")
215 ("zt" "\e$B!:\e(B") ("zT" "\e$B!x\e(B")
216 ("zp" "\e$B")\e(B") ("zP" "\e$B",\e(B")
217 ("z[" "\e$B!X\e(B") ("z{" "\e$B!L\e(B")
218 ("z]" "\e$B!Y\e(B") ("z}" "\e$B!M\e(B")
220 ("zs" "\e$B!3\e(B") ("zS" "\e$B!4\e(B")
221 ("zd" "\e$B!5\e(B") ("zD" "\e$B!6\e(B")
222 ("zf" "\e$B!7\e(B") ("zF" "\e$B"*\e(B")
223 ("zg" "\e$B!>\e(B") ("zG" "\e$B!=\e(B")
224 ("zh" "\e$B"+\e(B")
225 ("zj" "\e$B"-\e(B")
226 ("zk" "\e$B",\e(B")
227 ("zl" "\e$B"*\e(B")
228 ("z;" "\e$B!+\e(B") ("z:" "\e$B!,\e(B")
229 ("z\'" "\e$B!F\e(B") ("z\"" "\e$B!H\e(B")
231 ("zx" [":-"]) ("zX" [":-)"])
232 ("zc" "\e$B!;\e(B") ("zC" "\e$B!n\e(B")
233 ("zv" "\e$B"(\e(B") ("zV" "\e$B!`\e(B")
234 ("zb" "\e$B!k\e(B") ("zB" "\e$B"+\e(B")
235 ("zn" "\e$B!l\e(B") ("zN" "\e$B"-\e(B")
236 ("zm" "\e$B!m\e(B") ("zM" "\e$B".\e(B")
237 ("z," "\e$B!E\e(B") ("z<" "\e$B!e\e(B")
238 ("z." "\e$B!D\e(B") ("z>" "\e$B!f\e(B")
239 ("z/" "\e$B!&\e(B") ("z?" "\e$B!g\e(B")
241 ("\\\\" quail-japanese-self-insert-and-switch-to-alpha)
242 ("{{" quail-japanese-self-insert-and-switch-to-alpha)
243 ("}}" quail-japanese-self-insert-and-switch-to-alpha)
245 ("qq" quail-japanese-switch-package)
246 ("qz" quail-japanese-switch-package)
250 ;; \e$B%m!<%^;zF~NO5Z$S2>L>4A;zJQ49$K$h$kF|K\8lF~NO%a%=%C%I\e(B
252 ;; \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
253 ;; \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
254 ;; \e$B%Z!<%9%-!<$r2!$9$3$H$K$h$j!"<!$N%9%F!<%8!V2>L>4A;zJQ49!W$X?J$`!#\e(B
256 ;; \e$B!V%m!<%^;z2>L>JQ49!W\e(B
258 ;; \e$BJ?2>L>$O>.J8;z%-!<!JNs!K$rBG$D$3$H$K$h$jF~NO!#6gFIE@!"3g8LN`$OBP1~\e(B
259 ;; \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
260 ;; \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
261 ;; \e$B%H%"%C%W$5$l$F$$$k!#F~NO$5$l$?J8;z$O2<@~$G<($5$l$k!#\e(B
263 ;; \e$B$5$i$K0J2<$N%-!<$GFCJL$J=hM}$r9T$&!#\e(B
265 ;; K \e$BJ?2>L>$rJR2>L>$K!"$"$k$$$OJR2>L>$rJ?2>L>$KJQ49\e(B
266 ;; 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
267 ;; qz `japanese-zenkaku' \e$BF~NO%a%=%C%I$K%7%U%H\e(B
268 ;; qh \e$B$HBG$F$P85$KLa$k\e(B
269 ;; RET \e$B8=:_$NF~NOJ8;zNs$r3NDj\e(B
270 ;; SPC \e$B2>L>4A;zJQ49$K?J$`\e(B
272 ;; `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
273 ;; \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
274 ;; \e$BBG$D$3$H$K$h$j!"\e(B`japanese' \e$BF~NO%a%=%C%I$KLa$l$kE@$G$"$k!#\e(B
276 ;; `japanese-zenkaku' \e$BF~NO%a%=%C%I$OA43Q1Q?t;z$rF~NO$9$k$N$K;H$&!#\e(B
278 ;; \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
279 ;; \e$B$F$"$k!#\e(B
281 ;; \e$B!V2>L>4A;zJQ49!W\e(B
283 ;; \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
284 ;; \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
285 ;; \e$BJ,$1$i$l$k!#CmL\J8@a$KBP$7$F$O0J2<$N%3%^%s%I$,;H$($k!#\e(B
287 ;; SPC, C-n kkc-next
288 ;; \e$B<!$NJQ498uJd$rI=<(\e(B
289 ;; kkc-show-conversion-list-count \e$B0J>eB3$1$FBG$F$P!"JQ498uJd%j%9\e(B
290 ;; \e$B%H$r%(%3!<%(%j%"$KI=<(\e(B
291 ;; C-p kkc-prev
292 ;; \e$BA0$NJQ498uJd$rI=<(\e(B
293 ;; kkc-show-conversion-list-count \e$B0J>eB3$1$FBG$F$P!"JQ498uJd%j%9\e(B
294 ;; \e$B%H$r%(%3!<%(%j%"$KI=<(\e(B
295 ;; l kkc-show-conversion-list-or-next-group
296 ;; \e$B:G9b#1#08D$^$G$NJQ498uJd$r%(%3!<%(%j%"$KI=<(!#\e(B
297 ;; \e$BB3$1$FBG$?$l$l$P!"<!$N#1#08uJd$rI=<(!#\e(B
298 ;; L kkc-show-conversion-list-or-prev-group
299 ;; \e$B:G9b#1#08D$^$G$NJQ498uJd$r%(%3!<%(%j%"$KI=<(!#\e(B
300 ;; \e$BB3$1$FBG$?$l$l$P!"A0$N#1#08uJd$rI=<(!#\e(B
301 ;; 0..9 kkc-select-from-list
302 ;; \e$BBG$?$l$??t;z$NJQ498uJd$rA*Br\e(B
303 ;; H kkc-hiragana
304 ;; \e$BCmL\J8@a$rJ?2>L>$KJQ49\e(B
305 ;; K kkc-katakana
306 ;; \e$BCmL\J8@a$rJR2>L>$KJQ49\e(B
307 ;; C-o kkc-longer
308 ;; \e$BCmL\J8@a$r8e$m$K0lJ8;z?-$P$9\e(B
309 ;; C-i kkc-shorter
310 ;; \e$BCmL\J8@a$r8e$m$+$i0lJ8;z=L$a$k\e(B
311 ;; C-f kkc-next-phrase
312 ;; \e$BCmL\J8@a$r3NDj$5$;$k!#$b$7;D$j$NF~NO$,$^$@$"$l$P!":G=i$NJ8@a$r\e(B
313 ;; \e$BA*Br$7!"$=$l$rCmL\J8@a$H$7!"$=$N:G=i$NJQ498uJd$rI=<($9$k!#\e(B
314 ;; DEL, C-c kkc-cancel
315 ;; \e$B2>L>4A;zJQ49$r%-%c%s%;%k$7!"%m!<%^;z2>L>JQ49$N%9%F!<%8$KLa$k!#\e(B
316 ;; return kkc-terminate
317 ;; \e$BA4J8@a$r3NDj$5$;$k!#\e(B
318 ;; C-SPC, C-@ kkc-first-char-only
319 ;; \e$B:G=i$NJ8;z$r3NDj$5$;!";D$j$O:o=|$9$k!#\e(B
320 ;; C-h kkc-help
321 ;; \e$B$3$l$i$N%-!<%P%$%s%I$N%j%9%H$rI=<($9$k!#$"\e(B
323 (quail-define-package
324 "japanese" "Japanese" "A\e$B$"\e(B"
326 "Japanese input method by Roman transliteration and Kana-Kanji conversion.
328 When you use this input method, text entry proceeds in two stages:
329 Roman-Kana transliteration and Kana-Kanji conversion. When you start
330 to enter text, you are in the first stage, Roman-Kana transliteration.
331 Type SPC to proceed to the next stage, Kana-Kanji conversion.
333 :: Roman-Kana transliteration ::
335 You can input any Hiragana character as a sequence of lower-case
336 letters, Japanese punctuation characters by typing punctuation keys,
337 Japanese symbols by typing `z' followed by another key. See below for
338 a list of all available sequences. The characters you input are
339 underlined.
341 In addition, the following keys provide special effects:
343 K Change Hiragana to Katakana or Katakana to Hiragana.
344 qq Toggle between this input method and the input method `japanese-ascii'.
345 qz Shift to the input method `japanese-zenkaku'.
346 Typing \"qh\" will put you back to this input method.
347 RET Accept the current character sequence.
348 SPC Proceed to the next stage, Kana-Kanji conversion.
350 The input method `japanese-ascii' is used to enter ASCII characters.
351 This is almost the same as turning off the input method. The only
352 difference is that typing `qq' will put you back into the Japanese
353 input method.
355 The input method `japanese-zenkaku' is used to enter full width
356 JISX0208 characters corresponding to typed ASCII characters.
358 List of the all key sequences for Roman-Kana transliteration is shown
359 at the tail.
361 :: Kana-Kanji conversion ::
363 You can convert the current Japanese characters (underlined) to
364 Kana-Kanji mixed text. In this stage, the converted text is divided
365 into two parts, the current phrase (highlighted) and the remaining
366 input (underlined). The following commands can be used on the
367 current phrase.
369 SPC, C-n kkc-next
370 Show the next candidate for the current phrase.
371 If successively typed `kkc-show-conversion-list-count' times,
372 conversion candidates are shown in the echo area.
373 C-p kkc-prev
374 Show the previous candidate for the current phrase.
375 If successively typed `kkc-show-conversion-list-count' times,
376 conversion candidates are shown in the echo area.
377 l kkc-show-conversion-list-or-next-group
378 Show at most 10 candidates for the current phrase in echo area.
379 If typed repeatedly, show the next 10 candidates.
380 L kkc-show-conversion-list-or-prev-group
381 Show at most 10 candidates for the current phrase in echo area.
382 If typed repeatedly, show the previous 10 candidates.
383 0..9 kkc-select-from-list
384 Select a candidate corresponding to the typed number.
385 H kkc-hiragana
386 Convert the current phrase to Hiragana
387 K kkc-katakana
388 Convert the current phrase to Katakana
389 C-o kkc-longer
390 Extend the current phrase; pull in the first character of
391 the remaining input.
392 C-i kkc-shorter
393 Contract the current phrase; drop its last character
394 back into the remaining input.
395 C-f kkc-next-phrase
396 Accept the current phrase. If there remains input, select
397 the first phrase as the current one, and show the first
398 candidate for the conversion.
399 DEL, C-c kkc-cancel
400 Cancel the conversion, shift back to the Roman-Kana
401 transliteration.
402 return kkc-terminate
403 Accept the whole conversion.
404 C-SPC, C-@ kkc-first-char-only
405 Accept the first character of the current conversion,
406 delete the remaining input.
407 C-h kkc-help
408 List these key bindings.
410 nil t t nil nil nil nil nil
411 'quail-japanese-update-translation
412 '(("K" . quail-japanese-toggle-kana)
413 (" " . quail-japanese-kanji-kkc)
414 ("\C-m" . quail-no-conversion)
415 ([return] . quail-no-conversion))
418 (dolist (elt quail-japanese-transliteration-rules)
419 (quail-defrule (car elt) (nth 1 elt)))
421 (quail-define-package
422 "japanese-ascii" "Japanese" "Aa"
424 "Temporary ASCII input mode used within the input method `japanese'.
425 Type \"qq\" to go back to previous input method."
426 nil t t)
428 (quail-define-rules ("qq" quail-japanese-switch-package))
430 (quail-define-package
431 "japanese-zenkaku" "Japanese" "\e$B#A\e(B"
433 "Japanese zenkaku alpha numeric character input method.
434 ---- Special key bindings ----
435 qq: toggle between this input method and the input method `japanese-ascii'.
436 qh: shift to the input method `japanese',
437 typing \"qz\" puts you back to this input method.
439 nil t t)
441 (quail-define-rules
443 (" " "\e$B!!\e(B") ("!" "\e$B!*\e(B") ("\"" "\e$B!m\e(B") ("#" "\e$B!t\e(B")
444 ("$" "\e$B!p\e(B") ("%" "\e$B!s\e(B") ("&" "\e$B!u\e(B") ("'" "\e$B!l\e(B")
445 ("(" "\e$B!J\e(B") (")" "\e$B!K\e(B") ("*" "\e$B!v\e(B") ("+" "\e$B!\\e(B")
446 ("," "\e$B!$\e(B") ("-" "\e$B!]\e(B") ("." "\e$B!%\e(B") ("/" "\e$B!?\e(B")
447 ("0" "\e$B#0\e(B") ("1" "\e$B#1\e(B") ("2" "\e$B#2\e(B") ("3" "\e$B#3\e(B")
448 ("4" "\e$B#4\e(B") ("5" "\e$B#5\e(B") ("6" "\e$B#6\e(B") ("7" "\e$B#7\e(B")
449 ("8" "\e$B#8\e(B") ("9" "\e$B#9\e(B") (":" "\e$B!'\e(B") (";" "\e$B!(\e(B")
450 ("<" "\e$B!c\e(B") ("=" "\e$B!a\e(B") (">" "\e$B!d\e(B") ("?" "\e$B!)\e(B")
451 ("@" "\e$B!w\e(B") ("A" "\e$B#A\e(B") ("B" "\e$B#B\e(B") ("C" "\e$B#C\e(B")
452 ("D" "\e$B#D\e(B") ("E" "\e$B#E\e(B") ("F" "\e$B#F\e(B") ("G" "\e$B#G\e(B")
453 ("H" "\e$B#H\e(B") ("I" "\e$B#I\e(B") ("J" "\e$B#J\e(B") ("K" "\e$B#K\e(B")
454 ("L" "\e$B#L\e(B") ("M" "\e$B#M\e(B") ("N" "\e$B#N\e(B") ("O" "\e$B#O\e(B")
455 ("P" "\e$B#P\e(B") ("Q" "\e$B#Q\e(B") ("R" "\e$B#R\e(B") ("S" "\e$B#S\e(B")
456 ("T" "\e$B#T\e(B") ("U" "\e$B#U\e(B") ("V" "\e$B#V\e(B") ("W" "\e$B#W\e(B")
457 ("X" "\e$B#X\e(B") ("Y" "\e$B#Y\e(B") ("Z" "\e$B#Z\e(B") ("[" "\e$B!N\e(B")
458 ("\\" "\e$B!o\e(B") ("]" "\e$B!O\e(B") ("^" "\e$B!0\e(B") ("_" "\e$B!2\e(B")
459 ("`" "\e$B!F\e(B") ("a" "\e$B#a\e(B") ("b" "\e$B#b\e(B") ("c" "\e$B#c\e(B")
460 ("d" "\e$B#d\e(B") ("e" "\e$B#e\e(B") ("f" "\e$B#f\e(B") ("g" "\e$B#g\e(B")
461 ("h" "\e$B#h\e(B") ("i" "\e$B#i\e(B") ("j" "\e$B#j\e(B") ("k" "\e$B#k\e(B")
462 ("l" "\e$B#l\e(B") ("m" "\e$B#m\e(B") ("n" "\e$B#n\e(B") ("o" "\e$B#o\e(B")
463 ("p" "\e$B#p\e(B") ("q" "\e$B#q\e(B") ("r" "\e$B#r\e(B") ("s" "\e$B#s\e(B")
464 ("t" "\e$B#t\e(B") ("u" "\e$B#u\e(B") ("v" "\e$B#v\e(B") ("w" "\e$B#w\e(B")
465 ("x" "\e$B#x\e(B") ("y" "\e$B#y\e(B") ("z" "\e$B#z\e(B") ("{" "\e$B!P\e(B")
466 ("|" "\e$B!C\e(B") ("}" "\e$B!Q\e(B") ("~" "\e$B!A\e(B")
468 ("qq" quail-japanese-switch-package)
469 ("qh" quail-japanese-switch-package)
472 (defun quail-japanese-hankaku-update-translation (control-flag)
473 (setq control-flag
474 (quail-japanese-update-translation control-flag))
475 (if (or (and (stringp quail-current-str)
476 (> (length quail-current-str) 0))
477 (integerp quail-current-str))
478 (setq quail-current-str (japanese-hankaku quail-current-str)))
479 control-flag)
481 (quail-define-package
482 "japanese-hankaku-kana"
483 "Japanese" "\e(I1\e(B"
485 "Japanese hankaku katakana input method by Roman transliteration.
486 ---- Special key bindings ----
487 qq: toggle between this input method and the input method `japanese-ascii'.
489 nil t t nil nil nil nil nil
490 'quail-japanese-hankaku-update-translation)
492 (dolist (elt quail-japanese-transliteration-rules)
493 (quail-defrule (car elt)
494 (let ((trans (nth 1 elt)))
495 (when (or (stringp trans) (vectorp trans))
496 (let ((s (japanese-hankaku (if (stringp trans)
497 trans
498 (aref trans 0)))))
499 ;; If the result of the conversion is a string
500 ;; containing more than one character, make the
501 ;; result a vector, so that quail-defrule
502 ;; recognizes the whole string is the
503 ;; translation, instead of interpreting
504 ;; individual characters as alternative
505 ;; translations.
506 (if (and (stringp s) (> (length s) 1))
507 (setq trans (vector s))
508 (setq trans s))))
509 trans)))
511 (quail-define-package
512 "japanese-hiragana" "Japanese" "\e$B$"\e(B"
514 "Japanese hiragana input method by Roman transliteration."
515 nil t t nil nil nil nil nil
516 'quail-japanese-update-translation)
518 ;; Use the same map as that of `japanese'.
519 (setcar (cdr (cdr quail-current-package))
520 (nth 2 (assoc "japanese" quail-package-alist)))
522 ;; Update Quail translation region while converting Hiragana to Katakana.
523 (defun quail-japanese-katakana-update-translation (control-flag)
524 (setq control-flag
525 (quail-japanese-update-translation control-flag))
526 (if (or (and (stringp quail-current-str)
527 (> (length quail-current-str) 0))
528 (integerp quail-current-str))
529 (setq quail-current-str (japanese-katakana quail-current-str)))
530 control-flag)
532 (quail-define-package
533 "japanese-katakana" "Japanese" "\e$B%"\e(B"
535 "Japanese katakana input method by Roman transliteration."
536 nil t t nil nil nil nil nil
537 'quail-japanese-katakana-update-translation)
539 (dolist (elt quail-japanese-transliteration-rules)
540 (quail-defrule (car elt)
541 (let ((trans (nth 1 elt)))
542 (cond ((stringp trans)
543 (japanese-katakana trans))
544 ((vectorp trans)
545 (vector (japanese-katakana (aref trans 0))))
546 (t trans)))))
548 ;; arch-tag: 47e0bfd4-6ecc-4d01-89a8-d687c5e01ff7
549 ;;; japanese.el ends here