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