annotate lisp/mule/canna.el @ 118:7d55a9ba150c r20-1b11

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