annotate lisp/mule/canna.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents
children 0d2f883870bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1 ;;; canna.el --- Interface to the Canna input method.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
3 ;; This file is part of XEmacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
4
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
5 ;; XEmacs is free software; you can redistribute it and/or modify it
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
6 ;; under the terms of the GNU General Public License as published by
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
7 ;; the Free Software Foundation; either version 2, or (at your option)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
8 ;; any later version.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
9
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
10 ;; XEmacs is distributed in the hope that it will be useful, but
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
11 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
13 ;; General Public License for more details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
14
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
15 ;; You should have received a copy of the GNU General Public License
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
16 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
17 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
18 ;; Boston, MA 02111-1307, USA.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
19
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
20 ;;; Synched up with: Mule 2.3.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
21
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
22 ;; Egg offered some influences to the implementation of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
23 ;; Canna on Nemacs/Mule, and this file contains a few part
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
24 ;; of Egg which is written by S.Tomura, Electrotechnical
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
25 ;; Lab. (tomura@etl.go.jp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
26
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
27 ;; Written by Akira Kon, NEC Corporation.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
28 ;; E-Mail: kon@d1.bs2.mt.nec.co.jp.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
29
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
30 ;; #### This is far from working in XEmacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
31
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
32 ;; added by MORIOKA Tomohiko <morioka@jaist.ac.jp>, 1996/6/7
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
33 (or (fboundp 'minibuffer-prompt-width)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
34 (defun minibuffer-prompt-width ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
35 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
36 (set-buffer (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
37 (current-column)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
38 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
39 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
40 (or (fboundp 'char-before)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
41 (defun char-before (pos)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
42 (char-after (1- (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
43 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
44 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
45 (or (fboundp 'overlayp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
46 (defalias 'overlayp 'extentp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
47 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
48
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
49 ;; added by MORIOKA Tomohiko <morioka@jaist.ac.jp>, 1996/6/18
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
50 (defvar running-xemacs (string-match "XEmacs" emacs-version))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
51
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
52 (if running-xemacs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
53 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
54 (defun self-insert-string (string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
55 (let ((len (length string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
56 (i 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
57 ;; $BA^F~$NESCf$G(B blink $B$,5/$-$k$H$&$C$H$*$7$$$N$G!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
58 ;; $B0l;~E*$K(B blink $B$rM^;_$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
59 (blink-matching-paren nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
60 (while (< i len)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
61 (self-insert-internal (aref canna-kakutei-string i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
62 (setq i (1+ i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
63 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
64 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
65 (defun self-insert-string (string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
66 (let ((len (length string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
67 (i 0) chr
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
68 ;; $BA^F~$NESCf$G(B blink $B$,5/$-$k$H$&$C$H$*$7$$$N$G!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
69 ;; $B0l;~E*$K(B blink $B$rM^;_$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
70 (blink-matching-paren nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
71 (while (< i len)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
72 (setq chr (sref canna-kakutei-string i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
73 (self-insert-internal chr)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
74 (setq i (+ i (char-bytes chr)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
75 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
76 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
77
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
78
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
79 ;; -*-mode: emacs-lisp-*-
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
80
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
81 (defconst canna-rcs-version "Canna/mule 2.x, based on Canna 2.2/3.2. : canna.el,v x.xx 1994/11/7 00:00:00")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
82
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
83 (defun canna-version ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
84 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
85 (message (concat (substring canna-rcs-version 0 72) " ...")) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
86
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
87 ;;; $B$+$s$J$NJQ?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
88
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
89 (defvar canna-save-undo-text-predicate nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
90 (defvar canna-undo-hook nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
91
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
92 (defvar canna-do-keybind-for-functionkeys t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
93 (defvar canna-use-functional-numbers nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
94 (defvar canna-use-space-key-as-henkan-region t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
95
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
96 (defvar canna-server nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
97 (defvar canna-file nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
98
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
99 (defvar canna-underline nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
100 (defvar canna-with-fences (not canna-underline))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
101
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
102 (defvar canna-initialize-minibuffer-state-when-exit nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
103 "*Non-nil $B$N$H$-$O(B, $B%_%K%P%C%U%!$rH4$1$k;~F|K\8l>uBV$r=i4|2=$9$k(B.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
104
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
105 (defvar canna-inhibit-hankakukana nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
106 "*Non-nil $B$N;~!";z<oJQ49$GH>3Q$+$J$KJQ49$7$J$$(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
107
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
108 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
109 ;;; $B%b!<%I%i%$%s$N=$@0(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
110 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
111
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
112 (defvar canna:*kanji-mode-string* "[ $B$"(B ]")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
113 (defvar canna:*alpha-mode-string* "$B$+$s$J(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
114 (defvar canna:*saved-mode-string* "[ $B$"(B ]")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
115
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
116 (defvar mode-line-canna-mode canna:*alpha-mode-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
117 (defvar mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
118
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
119 (defvar display-minibuffer-mode-in-minibuffer nil) ; same name as TAKANA
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
120 ; $B$?$+$J$G$O(B t $B$,%G%U%)%k%H$@$1$I!"(Bnil $B$r%G%U%)%k%H$K$7$F$*$3$&$+$J!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
121
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
122 (make-variable-buffer-local 'mode-line-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
123
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
124 ; select-window-hook $B$O(B mule $B$+$iF~$C$?$s$@$H;W$&$1$I!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
125 ; $B$3$l$,L5$$$H(B preprompt $B$,$"$C$F$b$I$&$7$h$&$b$J$$$N$G$J$$$H$-$O(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
126 ; display-minibuffer-mode-in-minibuffer $B$r(B nil $B$K$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
127
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
128 (if (not (boundp 'select-window-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
129 (setq display-minibuffer-mode-in-minibuffer nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
130
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
131 (defun canna:select-window-hook (old new)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
132 (if (and (eq old (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
133 (not (eq new (minibuffer-window))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
134 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
135 (set-buffer (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
136 ;; minibuffer$B$N%G%U%)%k%H$O%"%k%U%!%Y%C%H%b!<%I(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
137 (setq mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
138 canna:*japanese-mode-in-minibuffer* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
139 minibuffer-preprompt nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
140 (if (eq new (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
141 (setq minibuffer-window-selected t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
142 (setq minibuffer-window-selected nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
143
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
144 ; egg:select-window-hook $B$G$b==J,$J$N$G!"(Begg:select-window-hook $B$,(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
145 ; $B@_Dj$5$l$F$$$J$$>l9g$N$_Dj5A$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
146
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
147 ; $BNI$/9M$($F$_$k$H(B display-minibuffer-mode-in-minibuffer $B$,(B t $B$N;~$O(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
148 ; $B$d$O$j>e5-$N(B canna:select-window-hook $B$,I,MW$@$J$"!#$I$&$7$h$&!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
149
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
150 (if (and (boundp 'select-window-hook)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
151 (not (eq select-window-hook 'egg:select-window-hook)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
152 (setq select-window-hook 'canna:select-window-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
153
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
154 (defun mode-line-canna-mode-update (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
155 (if (eq (current-buffer) (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
156 (if (and display-minibuffer-mode-in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
157 (boundp 'minibuffer-preprompt))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
158 (setq minibuffer-preprompt str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
159 ;else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
160 (setq mode-line-canna-mode-in-minibuffer str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
161 (setq mode-line-canna-mode str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
162 (redraw-modeline))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
163
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
164 ;; memq $B$r6/D4$9$k$J$i!"0J2<$@$,!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
165 ;(defun canna:memq-recursive (a l)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
166 ; (or (eq a l)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
167 ; (and (consp l)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
168 ; (or (canna:memq-recursive a (car l))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
169 ; (canna:memq-recursive a (cdr l)) ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
170 ;; $B<!$NDj5A$r;H$*$&(B...
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
171 (defun canna:memq-recursive (a l)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
172 (if (atom l) (eq a l)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
173 (or (canna:memq-recursive a (car l))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
174 (canna:memq-recursive a (cdr l)) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
175
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
176 (defun canna:create-mode-line ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
177 (if (not (canna:memq-recursive 'mode-line-canna-mode mode-line-format))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
178 (setq-default
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
179 mode-line-format
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
180 (append (list (list 'minibuffer-window-selected
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
181 (list 'display-minibuffer-mode-in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
182 "-" "m") "-")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
183 (list 'minibuffer-window-selected
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
184 (list 'display-minibuffer-mode-in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
185 'mode-line-canna-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
186 'mode-line-canna-mode-in-minibuffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
187 'mode-line-canna-mode))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
188 mode-line-format)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
189 (mode-line-canna-mode-update mode-line-canna-mode) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
190
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
191 (defun canna:mode-line-display ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
192 (mode-line-canna-mode-update mode-line-canna-mode))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
193
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
194 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
195 ;;; Canna local variables
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
196 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
197
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
198 (defvar canna:*japanese-mode* nil "T if canna mode is ``japanese''.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
199 (make-variable-buffer-local 'canna:*japanese-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
200 (set-default 'canna:*japanese-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
201
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
202 (defvar canna:*japanese-mode-in-minibuffer* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
203 "T if canna mode is ``japanese'' in minibuffer.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
204
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
205 (defvar canna:*exit-japanese-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
206 (defvar canna:*fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
207 ;(make-variable-buffer-local 'canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
208 ;(setq-default canna:*fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
209
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
210 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
211 ;;; global variables
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
212 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
213
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
214 (defvar canna-sys:*global-map* (copy-keymap global-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
215 (defvar canna:*region-start* (make-marker))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
216 (defvar canna:*region-end* (make-marker))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
217 (defvar canna:*spos-undo-text* (make-marker))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
218 (defvar canna:*epos-undo-text* (make-marker))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
219 (defvar canna:*undo-text-yomi* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
220 (defvar canna:*local-map-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
221 (defvar canna:*last-kouho* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
222 (defvar canna:*initialized* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
223 (defvar canna:*previous-window* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
224 (defvar canna:*minibuffer-local-map-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
225 (defvar canna:*cursor-was-in-minibuffer* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
226 (defvar canna:*menu-buffer* " *menu*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
227 (defvar canna:*saved-minibuffer*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
228 (defvar canna:*saved-redirection* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
229 (defvar canna:*use-region-as-henkan-region* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
230 (make-variable-buffer-local 'canna:*use-region-as-henkan-region*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
231 (setq-default canna:*use-region-as-henkan-region* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
232
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
233 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
234 ;;; $B?'$N@_Dj(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
235 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
236 (defvar canna-use-color nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
237 "*Non-nil $B$G%+%i!<%G%#%9%W%l%$$G?'$rIU$1$k(B.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
238 t $B$N;~$O%G%U%)%k%H$N?'$r;HMQ$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
239 $B?'$r;XDj$7$?$$;~$O(B, \"$BFI$_$N?'(B\", \"$BJQ49BP>]$N?'(B\", \"$BA*BrBP>]$N?'(B\" $B$N(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
240 $B%j%9%H$r@_Dj$9$k(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
241 (defvar canna:color-p nil "$B?'$,;H$($k$+(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
242 (defvar canna:attr-mode nil "$B8=:_$N%G%#%9%W%l%$%b!<%I(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
243 (defvar canna:attr-yomi nil "$BFI$_$N?'B0@-(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
244 (defvar canna:attr-taishou nil "$BJQ49BP>]ItJ,$N?'B0@-(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
245 (defvar canna:attr-select nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
246 "$B%_%K%P%C%U%!J,N%;~$N%a%K%e!<$NA*BrBP>]HV9f$N?'B0@-(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
247 (defvar canna:attribute-alist ;colored by tagu@ae.keio.ac.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
248 '((yomi (normal . "red")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
249 (reverse . "moccasin"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
250 (taishou (normal . "blue/lavender")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
251 (reverse . "yellow/cadet blue"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
252 (select (normal . "DarkOliveGreen1/cadet blue")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
253 (reverse . "light sea green/burlywood1")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
254 "$B$+$s$JJQ49;~$NG[?'$N(Balist")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
255
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
256 (make-variable-buffer-local (defvar canna:*yomi-overlay* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
257 (make-variable-buffer-local (defvar canna:*henkan-overlay* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
258 (make-variable-buffer-local (defvar canna:*select-overlay* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
259
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
260 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
261 ;;; $B%-!<%^%C%W%F!<%V%k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
262 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
263
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
264 ;; $B%U%'%s%9%b!<%I$G$N%m!<%+%k%^%C%W(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
265 (defvar canna-mode-map (make-sparse-keymap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
266
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
267 (let ((ch 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
268 (while (<= ch 127)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
269 (define-key canna-mode-map (make-string 1 ch) 'canna-functional-insert-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
270 (setq ch (1+ ch))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
271
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
272 (define-key canna-mode-map [up] "\C-p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
273 (define-key canna-mode-map [(shift up)] "\C-p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
274 (define-key canna-mode-map [(control up)] "\C-p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
275 (define-key canna-mode-map [down] "\C-n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
276 (define-key canna-mode-map [(shift down)] "\C-n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
277 (define-key canna-mode-map [(control down)] "\C-n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
278 (define-key canna-mode-map [right] "\C-f")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
279 (define-key canna-mode-map [(shift right)] "\C-f")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
280 (define-key canna-mode-map [(control right)] "\C-f")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
281 (define-key canna-mode-map [left] "\C-b")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
282 (define-key canna-mode-map [(shift left)] "\C-b")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
283 (define-key canna-mode-map [(control left)] "\C-b")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
284 (define-key canna-mode-map [kanji] " ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
285 (define-key canna-mode-map [(control space)] [(control @)])
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
286
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
287 ;; $B%_%K%P%C%U%!$K2?$+$rI=<($7$F$$$k;~$N%m!<%+%k%^%C%W(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
288 (defvar canna-minibuffer-mode-map (make-sparse-keymap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
289
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
290 (let ((ch 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
291 (while (<= ch 127)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
292 (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-insert-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
293 (setq ch (1+ ch))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
294
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
295 (define-key canna-minibuffer-mode-map [up] "\C-p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
296 (define-key canna-minibuffer-mode-map [(shift up)] "\C-p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
297 (define-key canna-minibuffer-mode-map [(control up)] "\C-p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
298 (define-key canna-minibuffer-mode-map [down] "\C-n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
299 (define-key canna-minibuffer-mode-map [(shift down)] "\C-n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
300 (define-key canna-minibuffer-mode-map [(control down)] "\C-n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
301 (define-key canna-minibuffer-mode-map [right] "\C-f")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
302 (define-key canna-minibuffer-mode-map [(shift right)] "\C-f")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
303 (define-key canna-minibuffer-mode-map [(control right)] "\C-f")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
304 (define-key canna-minibuffer-mode-map [left] "\C-b")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
305 (define-key canna-minibuffer-mode-map [(shift left)] "\C-b")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
306 (define-key canna-minibuffer-mode-map [(control left)] "\C-b")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
307 (define-key canna-minibuffer-mode-map [kanji] " ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
308 (define-key canna-minibuffer-mode-map [(control space)] [(control @)])
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
309
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
310 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
311 ;;; $B%0%m!<%P%k4X?t$N=q$-BX$((B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
312 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
313
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
314
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
315 ;; Keyboard quit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
316
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
317 ;(if (not (fboundp 'canna-sys:keyboard-quit))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
318 ; (fset 'canna-sys:keyboard-quit (symbol-function 'keyboard-quit)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
319
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
320 ;(defun canna:keyboard-quit ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
321 ; "See documents for canna-sys:keyboard-quit"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
322 ; (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
323 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
324 ; (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
325 ;; (setq canna:*japanese-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
326 ; (setq canna:*fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
327 ; (buffer-enable-undo (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
328 ; (canna:mode-line-display) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
329 ; (canna-sys:keyboard-quit) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
330
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
331 ;; Abort recursive edit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
332
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
333 ;(if (not (fboundp 'canna-sys:abort-recursive-edit))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
334 ; (fset 'canna-sys:abort-recursive-edit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
335 ; (symbol-function 'abort-recursive-edit)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
336
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
337 ;(defun canna:abort-recursive-edit ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
338 ; "see documents for canna-sys:abort-recursive-edit"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
339 ; (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
340 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
341 ; (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
342 ; (setq canna:*japanese-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
343 ; (setq canna:*fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
344 ; (buffer-enable-undo (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
345 ; (canna:mode-line-display) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
346 ; (canna-sys:abort-recursive-edit) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
347
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
348 ;; Exit-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
349
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
350 (defun canna:exit-minibuffer ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
351 "Exit minibuffer turning off canna Japanese mode.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
352 See also document for canna:saved-exit-minibuffer."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
353 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
354 (if canna-initialize-minibuffer-state-when-exit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
355 (setq canna:*japanese-mode-in-minibuffer* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
356 mode-line-canna-mode-in-minibuffer canna:*alpha-mode-string*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
357 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
358
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
359 (add-hook 'minibuffer-exit-hook 'canna:exit-minibuffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
360
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
361 ;; kill-emacs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
362
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
363 (add-hook 'kill-emacs-hook 'canna:finalize)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
364
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
365 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
366 ;;; function for mini-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
367 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
368
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
369 (defun adjust-minibuffer-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
370 (if (eq (current-buffer) (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
371 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
372 (setq canna:*japanese-mode* canna:*japanese-mode-in-minibuffer*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
373 t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
374 nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
375
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
376 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
377 ;;; keyboard input for japanese language
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
378 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
379
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
380 (defun canna-functional-insert-command (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
381 "Use input character as a key of complex translation input such as\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
382 kana-to-kanji translation."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
383 (interactive "*p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
384 (canna:functional-insert-command2 last-command-char arg) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
385
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
386 (defun canna:functional-insert-command2 (ch arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
387 "This function actualy isert a converted Japanese string."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
388 ;; $B$3$N4X?t$OM?$($i$l$?J8;z$rF|K\8lF~NO$N$?$a$N%-!<F~NO$H$7$F<h$j07(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
389 ;; $B$$!"F|K\8lF~NO$NCf4V7k2L$r4^$a$?=hM}$r(BEmacs$B$N%P%C%U%!$KH?1G$5$;$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
390 ;; $B4X?t$G$"$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
391 (canna:display-candidates (canna-key-proc ch)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
392
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
393 (defun canna:delete-last-preedit ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
394 (if (not (zerop canna:*last-kouho*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
395 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
396 (if canna-underline
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
397 ; $B$^$:!"B0@-$r>C$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
398 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
399 (canna:henkan-attr-off canna:*region-start* canna:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
400 (canna:yomi-attr-off canna:*region-start* canna:*region-end*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
401 (delete-region canna:*region-start* canna:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
402 (setq canna:*last-kouho* 0) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
403
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
404 (defun canna:insert-fixed (strs)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
405 (cond ((> strs 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
406 (cond ((and canna-kakutei-yomi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
407 (or (null canna-save-undo-text-predicate)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
408 (funcall canna-save-undo-text-predicate
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
409 (cons canna-kakutei-yomi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
410 canna-kakutei-romaji) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
411 (setq canna:*undo-text-yomi*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
412 (cons canna-kakutei-yomi canna-kakutei-romaji))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
413 (set-marker canna:*spos-undo-text* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
414 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
415 ;; update kbnes
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
416 (self-insert-string canna-kakutei-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
417 ;; $BL$3NDj$NJ8;z$,$J$/!"3NDjJ8;zNs$N:G8e$,JD$83g8L$N(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
418 ;; $BN`$@$C$?$H$-$O(B blink $B$5$;$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
419 (if (and canna-empty-info
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
420 (eq (char-syntax (char-before (point))) ?\)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
421 (blink-matching-open))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
422
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
423 ; (if overwrite-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
424 ; (let ((num strs)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
425 ; (kanji-compare 128))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
426 ; (catch 'delete-loop
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
427 ; (while (> num 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
428 ; (if (eolp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
429 ; (throw 'delete-loop nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
430 ; (if (>= (following-char) kanji-compare)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
431 ; (setq num (1- num)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
432 ; (delete-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
433 ; (setq num (1- num))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
434 ;; end kbnes
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
435 ; (insert canna-kakutei-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
436 (if self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
437 (funcall self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
438 canna:*region-start* canna:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
439 (canna:do-auto-fill)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
440 (set-marker canna:*epos-undo-text* (point)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
441 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
442 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
443 ;; update kbnes
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
444 (self-insert-string canna-kakutei-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
445 ;; $BL$3NDj$NJ8;z$,$J$/!"3NDjJ8;zNs$N:G8e$,JD$83g8L$N(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
446 ;; $BN`$@$C$?$H$-$O(B blink $B$5$;$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
447 (if (and canna-empty-info
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
448 (eq (char-syntax (char-before (point))) ?\)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
449 (blink-matching-open))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
450
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
451 ; (if overwrite-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
452 ; (let ((num strs)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
453 ; (kanji-compare 128))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
454 ; (catch 'delete-loop
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
455 ; (while (> num 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
456 ; (if (eolp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
457 ; (throw 'delete-loop nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
458 ; (if (>= (following-char) kanji-compare)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
459 ; (setq num (1- num)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
460 ; (delete-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
461 ; (setq num (1- num))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
462 ;; end kbnes
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
463 ; (insert canna-kakutei-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
464 (if self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
465 (funcall self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
466 canna:*region-start* canna:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
467 (canna:do-auto-fill) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
468 ) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
469
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
470 (defun canna:insert-preedit ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
471 (cond ((> canna-henkan-length 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
472 (set-marker canna:*region-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
473 (if canna-with-fences
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
474 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
475 (insert "||")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
476 (set-marker canna:*region-end* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
477 (backward-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
478 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
479 (insert canna-henkan-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
480 (if (not canna-with-fences)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
481 (set-marker canna:*region-end* (point)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
482 (if canna-underline
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
483 (canna:yomi-attr-on canna:*region-start* canna:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
484 (setq canna:*last-kouho* canna-henkan-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
485 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
486
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
487 ;; $B8uJdNN0h$G$O6/D4$7$?$$J8;zNs$,B8:_$9$k$b$N$H9M$($i(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
488 ;; $B$l$k!#6/D4$7$?$$J8;z$O(BEmacs$B$G$O%+!<%=%k%]%8%7%g%s$K$FI=<((B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
489 ;; $B$9$k$3$H$H$9$k!#6/D4$7$?$$J8;z$,$J$$$N$G$"$l$P!"%+!<%=%k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
490 ;; $B$O0lHV8e$NItJ,(B($BF~NO$,9T$o$l$k%]%$%s%H(B)$B$KCV$$$F$*$/!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
491
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
492 ;; $B%+!<%=%k$r0\F0$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
493 (if (not canna-underline)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
494 (backward-char
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
495 (- canna:*last-kouho*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
496 ;; $B%+!<%=%k0LCV$O!"H?E>I=<(ItJ,$,B8:_$7$J$$$N$G$"$l$P!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
497 ;; $B8uJdJ8;zNs$N:G8e$NItJ,$H$7!"H?E>I=<(ItJ,$,B8:_$9$k$N(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
498 ;; $B$G$"$l$P!"$=$NItJ,$N;O$a$H$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
499 (cond ((zerop canna-henkan-revlen)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
500 canna:*last-kouho*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
501 (t canna-henkan-revpos) )) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
502 (if (and (> canna-henkan-revlen 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
503 (> canna-henkan-length 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
504 ; $B8uJd$ND9$5$,(B0$B$G$J$/!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
505 ; $BH?E>I=<($ND9$5$,(B0$B$G$J$1$l$P!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
506 ; $B$=$NItJ,$rJQE>I=<($9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
507 (let ((start (+ canna:*region-start*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
508 (if canna-with-fences 1 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
509 canna-henkan-revpos) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
510 (if canna-underline
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
511 (canna:henkan-attr-on start
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
512 (+ start canna-henkan-revlen)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
513 ) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
514
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
515 (defun canna:display-candidates (strs)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
516 (cond ((stringp strs) ; $B%(%i!<$,5/$3$C$?>l9g(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
517 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
518 (message strs) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
519 (canna-henkan-string
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
520 ;; $B$b$78uJdI=<($,A0$N7k2L$+$iJQ$o$C$F$$$J$/$J$$$H$-$O(B......
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
521
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
522 ;; $B<h$j9g$($::G=i$OA0$K=q$$$F$*$$$?Cf4V7k2L$r>C$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
523 (canna:delete-last-preedit)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
524
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
525 ;; $B3NDj$7$?J8;zNs$,$"$l$P$=$l$rA^F~$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
526 (canna:insert-fixed strs)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
527
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
528 ;; $B<!$O8uJd$K$D$$$F$N:n6H$G$"$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
529
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
530 ;; $B8uJd$rA^F~$9$k!#8uJd$O=DK@FsK\$K$F64$^$l$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
531 (canna:insert-preedit)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
532 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
533
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
534 ;; $B%b!<%I$rI=$9J8;zNs$,B8:_$9$l$P$=$l$r%b!<%I$H$7$F<h$j07$&!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
535 (if (stringp canna-mode-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
536 (mode-line-canna-mode-update canna-mode-string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
537
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
538 ;; $B8uJdI=<($,$J$1$l$P%U%'%s%9%b!<%I$+$iH4$1$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
539 (cond (canna-empty-info (canna:quit-canna-mode)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
540
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
541 ;; $B%_%K%P%C%U%!$K=q$/$3$H$,B8:_$9$k$N$G$"$l$P!"$=$l$r%_%K%P%C%U%!(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
542 ;; $B$KI=<($9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
543 (cond (canna-ichiran-string
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
544 (canna:minibuffer-input canna-ichiran-string
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
545 canna-ichiran-length
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
546 canna-ichiran-revpos
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
547 canna-ichiran-revlen
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
548 strs) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
549 (canna:*cursor-was-in-minibuffer*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
550 ; (select-frame (window-frame (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
551 (select-window (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
552 (set-window-buffer (minibuffer-window)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
553 (get-buffer-create canna:*menu-buffer*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
554 (use-local-map canna-minibuffer-mode-map) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
555 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
556
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
557 (defun canna:minibuffer-input (str len revpos revlen nfixed)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
558 "Displaying misc informations for kana-to-kanji input."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
559
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
560 ;; $B:n6H$r%_%K%P%C%U%!$K0\$9$N$K:]$7$F!"8=:_$N%&%#%s%I%&$N>pJs$rJ]B8(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
561 ;; $B$7$F$*$/!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
562 (setq canna:*previous-window* (selected-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
563 ; (select-frame (window-frame (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
564
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
565 ;; $B<+J,$KMh$kA0$,%_%K%P%C%U%!$+$I$&$+$rJQ?t$K$G$b$$$l$F$*$$$?J}$,$$$$$J$"!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
566
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
567 (if (not canna:*cursor-was-in-minibuffer*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
568 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
569 ;; $B%_%K%P%C%U%!$r%/%j%"$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
570 ; (if (eq canna:*previous-window* (selected-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
571 ; (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
572 ; (canna:henkan-attr-off (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
573 ; (canna:delete-last-preedit) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
574
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
575 ;; $B%_%K%P%C%U%!%&%#%s%I%&$K8uJd0lMwMQ$N%P%C%U%!$r3d$jEv$F$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
576 (setq canna:*saved-minibuffer* (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
577 ; (set-window-buffer (minibuffer-window)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
578 ; (get-buffer-create canna:*menu-buffer*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
579 ;; modified by $B<i2,(B $BCNI'(B <morioka@jaist.ac.jp>, 1996/6/7
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
580 ;; $B$H$j$"$($:(B comment out $B$7$F$*$3$&(B (^_^;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
581 ;; (setq canna:*saved-redirection* (frame-focus (selected-frame)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
582 ;; (redirect-frame-focus (selected-frame)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
583 ;; (window-frame (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
584 ;; end of modification
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
585
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
586 ;; $B%_%K%P%C%U%!$N%-!<%^%C%W$rJ]B8$7$F$*$/!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
587 (setq canna:*minibuffer-local-map-backup* (current-local-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
588 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
589 (select-window (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
590 (set-window-buffer (minibuffer-window)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
591 (get-buffer-create canna:*menu-buffer*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
592
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
593 (use-local-map canna-minibuffer-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
594
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
595 ; (canna:yomi-attr-off (point-min) (point-max) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
596 ; (canna:henkan-attr-off (point-min) (point-max) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
597 (canna:select-attr-off (point-min) (point-max) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
598 (setq canna:*cursor-was-in-minibuffer* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
599 (delete-region (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
600 (if (not (eq canna:*previous-window* (selected-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
601 (setq minibuffer-window-selected nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
602
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
603 (insert str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
604
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
605 ;; $B%_%K%P%C%U%!$GH?E>I=<($9$k$Y$-J8;z$N$H$3$m$K%+!<%=%k$r0\F0$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
606 (cond ((> revlen 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
607 (backward-char (- len revpos)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
608 ;;(message "%s" (selected-frame)) (sit-for 3)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
609 (raise-frame (window-frame (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
610 ; (select-frame (window-frame (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
611 (and canna:color-p (not (eobp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
612 (canna:select-attr-on (point)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
613 (save-excursion (forward-char 1) (point))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
614
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
615 ;; $B%_%K%P%C%U%!$KI=<($9$k$Y$-J8;zNs$,%L%kJ8;zNs$J$N$G$"$l$P!"A0$N%&%#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
616 ;; $B%s%I%&$KLa$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
617 (if (or (zerop len) canna-empty-info)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
618 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
619 (setq canna:*cursor-was-in-minibuffer* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
620 (use-local-map canna:*minibuffer-local-map-backup*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
621
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
622 ;; $B%_%K%P%C%U%!%&%#%s%I%&$N%P%C%U%!$r85$KLa$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
623 (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
624 ; (setq canna:*saved-minibuffer* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
625 ;; modified by $B<i2,(B $BCNI'(B <morioka@jaist.ac.jp>, 1996/6/7
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
626 ;; $B$H$j$"$($:(B comment out $B$7$F$*$3$&(B (^_^;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
627 ;; (redirect-frame-focus (window-frame canna:*previous-window*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
628 ;; canna:*saved-redirection*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
629 ;; end of modification
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
630 ;; $B%_%K%P%C%U%!$GF~NO$7$F$$$?$N$J$i0J2<$b$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
631 ; (if (eq canna:*previous-window* (selected-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
632 ; (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
633 ; (canna:insert-fixed nfixed)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
634 ; (canna:insert-preedit) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
635
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
636 (if (and canna-empty-info (> len 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
637 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
638 ; (delete-region (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
639 (message str) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
640 (select-window canna:*previous-window*) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
641 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
642
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
643 (defun canna-minibuffer-insert-command (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
644 "Use input character as a key of complex translation input such as\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
645 kana-to-kanji translation, even if you are in the minibuffer."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
646 (interactive "p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
647 (use-local-map canna:*minibuffer-local-map-backup*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
648 (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
649 (select-window canna:*previous-window*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
650 (canna:functional-insert-command2 last-command-char arg) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
651
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
652 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
653 ;;; $B$+$s$J%b!<%I$N<gLr$O!"<!$N(B canna-self-insert-command $B$G$"$k!#$3$N(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
654 ;;; $B%3%^%s%I$OA4$F$N%0%i%U%#%C%/%-!<$K%P%$%s%I$5$l$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
655 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
656 ;;; $B$3$N4X?t$G$O!"8=:_$N%b!<%I$,F|K\8lF~NO%b!<%I$+$I$&$+$r%A%'%C%/$7$F!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
657 ;;; $BF|K\8lF~NO%b!<%I$G$J$$$N$G$"$l$P!"%7%9%F%`$N(B self-insert-command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
658 ;;; $B$r8F$V!#F|K\8lF~NO%b!<%I$G$"$l$P!"%U%'%s%9%b!<%I$KF~$j!"(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
659 ;;; canna-functional-insert-command $B$r8F$V!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
660 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
661
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
662 (if (not (boundp 'MULE)) ; for Nemacs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
663 (defun cancel-undo-boundary ()))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
664
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
665 (defun canna-self-insert-command (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
666 "Self insert pressed key and use it to assemble Romaji character."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
667 (interactive "*p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
668 (adjust-minibuffer-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
669 (if (and canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
670 ;; $B%U%'%s%9%b!<%I$@$C$?$i$b$&0lEY%U%'%s%9%b!<%I$KF~$C$?$j$7(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
671 ;; $B$J$$!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
672 (not canna:*fence-mode*) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
673 (canna:enter-canna-mode-and-functional-insert)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
674 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
675 ;; $B0J2<$NItJ,$O(B egg.el $B$N(B 3.09 $B$N(B egg-self-insert-command $B$NItJ,$+$i(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
676 ;; $B%3%T!<$7!"<j$rF~$l$F$$$^$9!#(B93.11.5 kon
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
677 ;; treat continuous 20 self insert as a single undo chunk.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
678 ;; `20' is a magic number copied from keyboard.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
679 ; (if (or ;92.12.20 by T.Enami
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
680 ; (not (eq last-command 'canna-self-insert-command))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
681 ; (>= canna:*self-insert-non-undo-count* 20))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
682 ; (setq canna:*self-insert-non-undo-count* 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
683 ; (cancel-undo-boundary)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
684 ; (setq canna:*self-insert-non-undo-count*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
685 ; (1+ canna:*self-insert-non-undo-count*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
686 (if (and (eq last-command 'canna-self-insert-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
687 (> last-command-char ? ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
688 (cancel-undo-boundary))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
689 (self-insert-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
690 ; (if canna-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
691 ; (run-hooks 'canna-insert-after-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
692 (if self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
693 (if (<= 1 arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
694 (funcall self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
695 (- (point) arg) (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
696 (if (= last-command-char ? ) (canna:do-auto-fill))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
697
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
698 (defun canna-toggle-japanese-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
699 "Toggle canna japanese mode."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
700 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
701 (let ((in-minibuffer (adjust-minibuffer-mode)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
702 (cond (canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
703 (setq canna:*japanese-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
704 (canna-abandon-undo-info)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
705 (setq canna:*use-region-as-henkan-region* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
706 (setq canna:*saved-mode-string* mode-line-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
707 (mode-line-canna-mode-update canna:*alpha-mode-string*) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
708 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
709 (setq canna:*japanese-mode* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
710 (if (fboundp 'canna-query-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
711 (let ((new-mode (canna-query-mode)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
712 (if (string-equal new-mode "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
713 (setq canna:*kanji-mode-string* canna:*saved-mode-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
714 (setq canna:*kanji-mode-string* new-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
715 )) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
716 (mode-line-canna-mode-update canna:*kanji-mode-string*) ) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
717 (if in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
718 (setq canna:*japanese-mode-in-minibuffer* canna:*japanese-mode*)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
719
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
720 (defun canna:initialize ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
721 (let ((init-val nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
722 (cond (canna:*initialized*) ; initialize $B$5$l$F$$$?$i2?$b$7$J$$(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
723 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
724 (setq canna:*initialized* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
725 (setq init-val (canna-initialize
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
726 (if canna-underline 0 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
727 canna-server canna-file))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
728 (cond ((car (cdr (cdr init-val)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
729 (canna:output-warnings (car (cdr (cdr init-val)))) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
730 (cond ((car (cdr init-val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
731 (error (car (cdr init-val))) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
732 ) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
733
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
734 (if (fboundp 'canna-query-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
735 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
736 (canna-change-mode canna-mode-alpha-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
737 (setq canna:*alpha-mode-string* (canna-query-mode)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
738
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
739 (canna-do-function canna-func-japanese-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
740
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
741 (if (fboundp 'canna-query-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
742 (setq canna:*kanji-mode-string* (canna-query-mode)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
743
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
744 init-val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
745
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
746 (defun canna:finalize ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
747 (cond ((null canna:*initialized*)) ; initialize $B$5$l$F$$$J$+$C$?$i2?$b$7$J$$(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
748 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
749 (setq canna:*initialized* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
750 (let ((init-val (canna-finalize)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
751 (cond ((car (cdr (cdr init-val)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
752 (canna:output-warnings (car (cdr (cdr init-val)))) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
753 (cond ((car (cdr init-val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
754 (error (car (cdr init-val))) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
755 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
756 (message "$B!X$+$s$J!Y$N<-=q$r%;!<%V$7$^$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
757 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
758
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
759 (defun canna:enter-canna-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
760 (if (not canna:*initialized*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
761 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
762 (message "$B!X$+$s$J!Y$N=i4|2=$r9T$C$F$$$^$9(B....")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
763 (canna:initialize)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
764 (message "$B!X$+$s$J!Y$N=i4|2=$r9T$C$F$$$^$9(B....done")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
765 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
766 (canna-set-width (- (window-width (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
767 (minibuffer-prompt-width)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
768 (if (and display-minibuffer-mode-in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
769 (eq (selected-window) (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
770 (string-width
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
771 (let ((new-mode (canna-query-mode)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
772 (if (string-equal new-mode "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
773 canna:*saved-mode-string*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
774 new-mode)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
775 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
776 (setq canna:*local-map-backup* (current-local-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
777 (setq canna:*fence-mode* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
778 ;; XEmacs change:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
779 (buffer-disable-undo (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
780 (use-local-map canna-mode-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
781
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
782 (defun canna:enter-canna-mode-and-functional-insert ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
783 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
784 (setq canna:*use-region-as-henkan-region* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
785 (setq unread-command-events (list last-command-event)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
786
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
787 (defun canna:quit-canna-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
788 (cond (canna:*fence-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
789 (use-local-map canna:*local-map-backup*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
790 (setq canna:*fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
791 (if canna:*exit-japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
792 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
793 (setq canna:*exit-japanese-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
794 (setq canna-mode-string canna:*alpha-mode-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
795 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
796 (canna-toggle-japanese-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
797 (mode-line-canna-mode-update canna:*alpha-mode-string*) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
798 ;; XEmacs change:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
799 (buffer-enable-undo (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
800 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
801 (set-marker canna:*region-start* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
802 (set-marker canna:*region-end* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
803 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
804
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
805 (defun canna-touroku ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
806 "Register a word into a kana-to-kanji dictionary."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
807 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
808 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
809 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
810 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
811 (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
812 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
813 (canna:display-candidates (canna-touroku-string "")) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
814 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
815 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
816
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
817 (defun canna-without-newline (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
818 (and (not (eq start end))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
819 (or
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
820 (and (<= end (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
821 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
822 (beginning-of-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
823 (<= (point) start) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
824 (and (<= (point) start)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
825 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
826 (end-of-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
827 (<= end (point)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
828 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
829
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
830 (defun canna-touroku-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
831 "Register a word which is indicated by region into a kana-to-kanji\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
832 dictionary."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
833 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
834 (if (canna-without-newline start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
835 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
836 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
837 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
838 (setq canna:*use-region-as-henkan-region* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
839 (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
840 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
841 (canna:display-candidates
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
842 (canna-touroku-string (buffer-substring start end))) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
843 (message "$B%j!<%8%g%s$,IT@5$G$9!#%L%k%j!<%8%g%s$+!"2~9T$,4^$^$l$F$$$^$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
844 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
845
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
846 (defun canna-extend-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
847 "To enter an extend-mode of Canna."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
848 (interactive "*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
849 ; (if (and (not (eq (window-frame (minibuffer-window)) (selected-frame)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
850 ; (not canna:*fence-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
851 ;; $B%_%K%P%C%U%!$rJ,N%$7$F$$$k;~$O0l;~E*$K%U%'%s%9%b!<%I$KF~$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
852 ;; $B$=$&$7$J$$$H%a%K%e!<$rA*$Y$J$$(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
853 ;; (focus$B$,%_%K%P%C%U%!$K9T$+$J$$$+$i(B)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
854 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
855 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
856 (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
857 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
858 (canna:display-candidates
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
859 (canna-do-function canna-func-extend-mode) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
860 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
861
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
862 (defun canna-kigou-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
863 "Enter symbol choosing mode."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
864 (interactive "*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
865 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
866 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
867 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
868 (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
869 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
870 (canna:display-candidates (canna-change-mode canna-mode-kigo-mode)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
871 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
872 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
873
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
874 (defun canna-hex-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
875 "Enter hex code entering mode."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
876 (interactive "*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
877 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
878 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
879 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
880 (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
881 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
882 (canna:display-candidates (canna-change-mode canna-mode-hex-mode)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
883 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
884 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
885
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
886 (defun canna-bushu-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
887 "Enter special mode to convert by BUSHU name."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
888 (interactive "*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
889 ; (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
890 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
891 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
892 (setq canna:*exit-japanese-mode* (not canna:*japanese-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
893 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
894 (canna:display-candidates (canna-change-mode canna-mode-bushu-mode)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
895 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
896 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
897
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
898 (defun canna-reset ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
899 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
900 (message "$B!X$+$s$J!Y$N<-=q$r%;!<%V$7$^$9!#(B");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
901 (canna:finalize)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
902 (message "$B!X$+$s$J!Y$N:F=i4|2=$r9T$C$F$$$^$9(B....")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
903 (canna:initialize)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
904 (message "$B!X$+$s$J!Y$N:F=i4|2=$r9T$C$F$$$^$9(B....done")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
905 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
906
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
907
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
908 (defun canna ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
909 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
910 (message "$B!X$+$s$J!Y$r=i4|2=$7$F$$$^$9(B....")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
911 (let (init-val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
912 (cond ((and (fboundp 'canna-initialize) (fboundp 'canna-change-mode) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
913
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
914 ;; canna $B$,;H$($k;~$O<!$N=hM}$r$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
915
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
916 ;; $BG[?'@_Dj(B (by yuuji@ae.keio.ac.jp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
917 (setq canna:color-p (and canna-use-color
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
918 window-system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
919 (x-display-color-p)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
920 ;;$B%+%i!<$N;~(Bunderline$B%b!<%I$HF1$8>uBV$G=i4|2=$9$kI,MW$,$"$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
921 (setq canna-underline (or canna:color-p canna-underline))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
922 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
923 (canna:color-p
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
924 (setq canna:attr-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
925 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
926 ((or (and (boundp 'hilit-background-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
927 (eq hilit-background-mode 'dark))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
928 (string-match
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
929 "on\\|t"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
930 (or (x-get-resource "ReverseVideo" "reverseVideo")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
931 "")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
932 'reverse) ;$BH?E>$7$F$$$k$J$i(B 'reverse
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
933 (t 'normal)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
934 (setq canna:attr-yomi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
935 (if (listp canna-use-color)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
936 (car canna-use-color)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
937 (cdr (assq canna:attr-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
938 (assq 'yomi canna:attribute-alist)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
939 (setq canna:attr-taishou
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
940 (if (listp canna-use-color)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
941 (car (cdr canna-use-color))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
942 (setq canna:attr-taishou
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
943 (cdr (assq
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
944 canna:attr-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
945 (assq 'taishou canna:attribute-alist))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
946 (setq canna:attr-select
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
947 (if (listp canna-use-color)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
948 (car (cdr (cdr canna-use-color)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
949 (setq canna:attr-select
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
950 (cdr (assq canna:attr-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
951 (assq 'select canna:attribute-alist))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
952 ;;$B?'$E$1MQ(Bface$B$N:n@.(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
953 (mapcar
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
954 (function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
955 (lambda (face)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
956 (let* ((color (symbol-value
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
957 (intern (concat "canna:" (symbol-name face)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
958 backp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
959 (make-face face)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
960 (if (stringp color)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
961 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
962 (setq backp (string-match "/" color))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
963 (set-face-foreground
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
964 face (substring color 0 backp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
965 (if backp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
966 (set-face-background
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
967 face (substring color (1+ backp)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
968 (copy-face color face)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
969 '(attr-yomi attr-taishou attr-select))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
970 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
971 ;;$BG[?'@_Dj=*N;(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
972
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
973 ;; $B!X$+$s$J!Y%7%9%F%`$N=i4|2=(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
974
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
975 (setq init-val (canna:initialize))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
976
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
977 ;; $B%-!<$N%P%$%s%G%#%s%0(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
978
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
979 (let ((ch 32))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
980 (while (< ch 127)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
981 (define-key global-map (make-string 1 ch) 'canna-self-insert-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
982 (setq ch (1+ ch)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
983
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
984 (cond ((let ((keys (car init-val)) (ok nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
985 (while keys
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
986 (cond ((< (car keys) 128)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
987 (global-set-key
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
988 (make-string 1 (car keys))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
989 'canna-toggle-japanese-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
990 (setq ok t) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
991 (setq keys (cdr keys))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
992 ) ok))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
993 (t ; $B%G%U%)%k%H$N@_Dj(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
994 (global-set-key "\C-o" 'canna-toggle-japanese-mode) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
995
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
996 (if (not (keymapp (global-key-binding "\e[")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
997 (global-unset-key "\e[") )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
998 (global-set-key "\e[210z" 'canna-toggle-japanese-mode) ; XFER
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
999 (define-key global-map [kanji] 'canna-toggle-japanese-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1000 (if canna-do-keybind-for-functionkeys
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1001 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1002 (global-set-key "\e[28~" 'canna-extend-mode) ; HELP on EWS4800
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1003 (global-set-key "\e[2~" 'canna-kigou-mode) ; INS on EWS4800
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1004 (global-set-key "\e[11~" 'canna-kigou-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1005 (global-set-key "\e[12~" 'canna-hex-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1006 (global-set-key "\e[13~" 'canna-bushu-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1007 (define-key global-map [help] 'canna-extend-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1008 (define-key global-map [insert] 'canna-kigou-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1009 (define-key global-map [f1] 'canna-kigou-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1010 (define-key global-map [f2] 'canna-hex-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1011 (define-key global-map [f3] 'canna-bushu-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1012 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1013
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1014 (if canna-use-space-key-as-henkan-region
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1015 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1016 (global-set-key "\C-@" 'canna-set-mark-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1017 ;; X Window $B$O(B C-@ $B$H(B C-SPC $B$r6hJL$9$k$N$G!"$3$l$,I,MW!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1018 (global-set-key [?\C-\ ] 'canna-set-mark-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1019 (global-set-key " " 'canna-henkan-region-or-self-insert) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1020
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1021 ;; $B%b!<%I9T$N:n@.(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1022
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1023 (canna:create-mode-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1024 (mode-line-canna-mode-update canna:*alpha-mode-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1025
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1026 ;; $B%7%9%F%`4X?t$N=q$-BX$((B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1027
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1028 ; (fset 'abort-recursive-edit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1029 ; (symbol-function 'canna:abort-recursive-edit))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1030 ; (fset 'keyboard-quit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1031 ; (symbol-function 'canna:keyboard-quit))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1032
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1033 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1034
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1035 ((fboundp 'canna-initialize)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1036 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1037 (with-output-to-temp-buffer "*canna-warning*"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1038 (princ "$B$3$N(B Mule $B$G$O(B new-canna $B$,;H$($^$;$s(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1039 (terpri)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1040 (print-help-return-message)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1041
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1042 (t ; $B!X$+$s$J!Y%7%9%F%`$,;H$($J$+$C$?;~$N=hM}(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1043 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1044 (with-output-to-temp-buffer "*canna-warning*"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1045 (princ "$B$3$N(B Mule $B$G$O(B canna $B$,;H$($^$;$s(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1046 (terpri)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1047 (print-help-return-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1048 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1049 (message "$B!X$+$s$J!Y$r=i4|2=$7$F$$$^$9(B....done")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1050 ) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1051
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1052 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1053 ;;; auto fill controll (from egg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1054 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1055
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1056 (defun canna:do-auto-fill ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1057 (if (and auto-fill-function (not buffer-read-only)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1058 (> (current-column) fill-column))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1059 (let ((ocolumn (current-column)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1060 (funcall auto-fill-function)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1061 (while (and (< fill-column (current-column))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1062 (< (current-column) ocolumn))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1063 (setq ocolumn (current-column))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1064 (funcall auto-fill-function)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1065
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1066 (defun canna:output-warnings (mesg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1067 (with-output-to-temp-buffer "*canna-warning*"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1068 (while mesg
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1069 (princ (car mesg))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1070 (terpri)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1071 (setq mesg (cdr mesg)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1072 (print-help-return-message)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1073
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1074 (defun canna-undo (&optional arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1075 (interactive "*p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1076 (if (and canna:*undo-text-yomi*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1077 (eq (current-buffer) (marker-buffer canna:*spos-undo-text*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1078 ; (canna-without-newline canna:*spos-undo-text*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1079 ; canna:*epos-undo-text*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1080 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1081 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1082 (message "$BFI$_$KLa$7$^$9!*(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1083 ; (switch-to-buffer (marker-buffer canna:*spos-undo-text*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1084 (goto-char canna:*spos-undo-text*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1085 (delete-region canna:*spos-undo-text*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1086 canna:*epos-undo-text*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1087
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1088 (if (null canna:*japanese-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1089 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1090 (setq canna:*exit-japanese-mode* t) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1091 ; (canna-toggle-japanese-mode) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1092 (if (not canna:*fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1093 ;; $B%U%'%s%9%b!<%I$@$C$?$i$b$&0lEY%U%'%s%9%b!<%I$KF~$C$?$j$7(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1094 ;; $B$J$$!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1095 (canna:enter-canna-mode) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1096 (canna:display-candidates
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1097 (let ((texts (canna-store-yomi (car canna:*undo-text-yomi*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1098 (cdr canna:*undo-text-yomi*) )) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1099 (cond (canna-undo-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1100 (funcall canna-undo-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1101 (t texts) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1102 (canna-abandon-undo-info)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1103 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1104 (canna-abandon-undo-info)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1105 (undo arg) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1106
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1107 (defun canna-abandon-undo-info ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1108 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1109 (setq canna:*undo-text-yomi* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1110 (set-marker canna:*spos-undo-text* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1111 (set-marker canna:*epos-undo-text* nil) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1112
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1113 (defun canna-henkan-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1114 "Convert a text which is indicated by region into a kanji text."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1115 (interactive "*r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1116 (if (null canna:*japanese-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1117 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1118 (setq canna:*exit-japanese-mode* t) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1119 ; (canna-toggle-japanese-mode) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1120 (let ((res nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1121 (setq res (canna-store-yomi (buffer-substring start end)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1122 (delete-region start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1123 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1124 (if (fboundp 'canna-do-function)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1125 (setq res (canna-do-function canna-func-henkan)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1126 (canna:display-candidates res) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1127
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1128 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1129 ;;; $B%^!<%/%3%^%s%I!$(Bcanna-henkan-region-or-self-insert $B$G;H$&$+$b(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1130 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1131
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1132 (defun canna-set-mark-command (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1133 "Besides setting mark, set mark as a HENKAN region if it is in\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1134 the japanese mode."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1135 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1136 (set-mark-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1137 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1138 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1139 (setq canna:*use-region-as-henkan-region* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1140 (message "Mark set($BJQ49NN0h3+;O(B)") )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1141
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1142 (defun canna-henkan-region-or-self-insert (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1143 "Do kana-to-kanji convert region if HENKAN region is defined,\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1144 self insert otherwise."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1145 (interactive "*p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1146 (if (and canna:*use-region-as-henkan-region*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1147 ; (< (mark) (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1148 ; (not (save-excursion (beginning-of-line) (< (mark) (point)))) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1149 (canna-without-newline (region-beginning) (region-end)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1150 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1151 (setq canna:*use-region-as-henkan-region* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1152 (canna-henkan-region (region-beginning) (region-end)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1153 (canna-self-insert-command arg) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1154
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1155 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1156 ;; for C-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1157 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1158
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1159 (defun canna-electric-c-terminator (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1160 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1161 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1162 (canna-self-insert-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1163 (electric-c-terminator arg) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1164
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1165 (defun canna-electric-c-semi (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1166 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1167 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1168 (canna-self-insert-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1169 (electric-c-semi arg) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1170
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1171 (defun canna-electric-c-brace (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1172 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1173 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1174 (canna-self-insert-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1175 (electric-c-brace arg) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1176
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1177 (defun canna-c-mode-hook ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1178 (define-key c-mode-map "{" 'canna-electric-c-brace)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1179 (define-key c-mode-map "}" 'canna-electric-c-brace)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1180 (define-key c-mode-map ";" 'canna-electric-c-semi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1181 (define-key c-mode-map ":" 'canna-electric-c-terminator) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1182
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1183 (defun canna-set-fence-mode-format (fence sep underline)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1184 (setq canna-with-fences fence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1185 (canna-set-bunsetsu-kugiri sep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1186 (setq canna-underline underline)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1187 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1188
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1189 ;; $B%j!<%8%g%s$K$"$k%m!<%^;z$r!X$+$s$J!Y$K?)$o$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1190 ;; $B7k2L$H$7$F!"!X$+$s$J!Y$NFI$_%b!<%I$K$J$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1191 ;; $B%j!<%8%g%s$KB8:_$7$F$$$k6uGrJ8;z$H@)8fJ8;z$O<N$F$i$l$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1192
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1193 (defun canna-rk-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1194 "Convert region into kana."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1195 (interactive "*r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1196 (let ((str nil) (len 0) (i 0) (res 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1197 (setq str (buffer-substring start end))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1198 (setq len (length str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1199 (while (< i len)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1200 (let ((ch (elt str i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1201 (if (> ch ? )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1202 (setq res (canna-do-function canna-func-functional-insert ch)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1203 (setq i (1+ i)) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1204 res))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1205
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1206 (defun canna-rk-trans-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1207 "Insert alpha-numeric string as it is sent from keyboard."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1208 (interactive "*r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1209 (let ((res))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1210 (setq res (canna-rk-region start end))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1211 (delete-region start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1212 (if (null canna:*japanese-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1213 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1214 (setq canna:*exit-japanese-mode* t) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1215 (setq res (canna-do-function canna-func-henkan))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1216 (canna:enter-canna-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1217 (canna:display-candidates res) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1218
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1219 ;; $B%+!<%=%k$N:8$K$"$k(B arg $B%o!<%I$N%m!<%^;z$r!X$+$s$J!Y$K?)$o$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1220
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1221 (defun canna-rk-trans (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1222 (interactive "*p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1223 (let ((po (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1224 (skip-chars-backward "-a-zA-Z.,?!~")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1225 (if (not (eq (point) po))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1226 (canna-rk-trans-region (point) po) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1227
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1228 (defun canna-henkan-kakutei-and-self-insert (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1229 (interactive "*p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1230 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1231 (canna-functional-insert-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1232 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1233 (setq unread-command-events (list last-command-event))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1234 (canna-kakutei-to-basic-stat)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1235
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1236 (defun canna-kakutei-to-basic-stat ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1237 (let ((res 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1238 (kakutei canna-henkan-string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1239 (while (not canna-empty-info)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1240 ; (setq res (canna-key-proc ?\C-m)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1241 (setq res (canna-do-function canna-func-kakutei)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1242 (setq canna-kakutei-string kakutei)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1243 (canna:display-candidates (length canna-kakutei-string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1244 (if (not canna:*japanese-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1245 (mode-line-canna-mode-update canna:*alpha-mode-string*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1246 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1247
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1248 (defun canna-minibuffer-henkan-kakutei-and-self-insert (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1249 (interactive "p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1250 (set-window-buffer (minibuffer-window) canna:*saved-minibuffer*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1251 (select-window canna:*previous-window*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1252 (if canna:*japanese-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1253 (canna:functional-insert-command2 last-command-event arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1254 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1255 (setq unread-command-events (list last-command-event))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1256 (canna-kakutei-to-basic-stat)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1257
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1258 (defun canna-setup-for-being-boiled ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1259 (let ((ch (1+ ? )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1260 (while (< ch 127)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1261 (define-key canna-mode-map (make-string 1 ch) 'canna-henkan-kakutei-and-self-insert)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1262 (define-key canna-minibuffer-mode-map (make-string 1 ch) 'canna-minibuffer-henkan-kakutei-and-self-insert)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1263 (setq ch (1+ ch)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1264
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1265 (defvar rK-trans-key "\C-j" "for `boil' only")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1266 (make-variable-buffer-local 'rK-trans-key)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1267
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1268 (defun canna-boil ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1269 "`canna-boil' cooks `canna' as if `boil' does for `egg'."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1270 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1271 (canna-setup-for-being-boiled)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1272 (local-set-key rK-trans-key 'canna-rk-trans)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1273 (message "boiled"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1274
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1275 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1276 ;; $B?'$E$1$N$?$a$N4X?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1277 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1278 (defun canna:yomi-attr-on (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1279 (if (overlayp canna:*yomi-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1280 (move-overlay canna:*yomi-overlay* start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1281 (overlay-put (setq canna:*yomi-overlay* (make-overlay start end nil t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1282 'face
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1283 (if canna:color-p 'attr-yomi 'underline))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1284 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1285 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1286
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1287 (defun canna:yomi-attr-off (start end);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1288 (and (overlayp canna:*yomi-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1289 (delete-overlay canna:*yomi-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1290 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1291 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1292
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1293 (defun canna:henkan-attr-on (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1294 (if (overlayp canna:*henkan-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1295 (move-overlay canna:*henkan-overlay* start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1296 (overlay-put (setq canna:*henkan-overlay* (make-overlay start end nil t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1297 'face
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1298 (if canna:color-p 'attr-taishou 'region))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1299 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1300 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1301
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1302 (defun canna:henkan-attr-off (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1303 (and (overlayp canna:*henkan-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1304 (delete-overlay canna:*henkan-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1305 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1306 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1307
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1308 (defun canna:select-attr-on (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1309 (if (overlayp canna:*select-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1310 (move-overlay canna:*select-overlay* start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1311 (overlay-put (setq canna:*select-overlay* (make-overlay start end nil t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1312 'face
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1313 'attr-select))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1314 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1315
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1316 (defun canna:select-attr-off (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1317 (and (overlayp canna:*select-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1318 (delete-overlay canna:*select-overlay*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1319 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1320 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1321
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1322 (provide 'canna)