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