annotate lisp/mule/canna.el @ 151:59463afc5666 r20-3b2

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