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