219
|
1 ;;; skk-vip.el --- vip related functions for skk.el
|
|
2 ;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
|
3 ;; Masahiko Sato <masahiko@kuis.kyoto-u.ac.jp>
|
|
4
|
|
5 ;; Author: Masahiko Sato <masahiko@kuis.kyoto-u.ac.jp>
|
|
6 ;; Maintainer: Mikio Nakajima <minakaji@osaka.email.ne.jp>
|
|
7 ;; Version: $Id: skk-vip.el,v 1.1 1997/12/02 08:48:39 steve Exp $
|
|
8 ;; Keywords: japanese
|
|
9 ;; Last Modified: $Date: 1997/12/02 08:48:39 $
|
|
10
|
|
11 ;; This program is free software; you can redistribute it and/or modify
|
|
12 ;; it under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either versions 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; This program is distributed in the hope that it will be useful
|
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 ;; GNU General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with SKK, see the file COPYING. If not, write to the Free
|
|
23 ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston,
|
|
24 ;; MA 02111-1307, USA.
|
|
25
|
|
26 ;;; Commentary:
|
|
27
|
|
28 ;; Following people contributed to skk-vip.el (Alphabetical order):
|
|
29 ;; Kiyotaka Sakai <ksakai@netwk.ntt-at.co.jp>
|
|
30 ;; Mikio Nakajima <minakaji@osaka.email.ne.jp>
|
|
31 ;; Murata Shuuichirou <mrt@mickey.ai.kyutech.ac.jp>
|
|
32 ;;
|
|
33 ;;; Change log:
|
|
34 ;; version 1.1.4 released 1996.12.15 (derived from the skk.el)
|
|
35
|
|
36 ;;; Code:
|
|
37 (require 'skk-foreword)
|
|
38 (require 'skk-vars)
|
|
39 (require 'advice)
|
|
40
|
|
41 (condition-case nil
|
|
42 ;; (require 'vip) $B$9$Y$-$@$,!"(Bvip 3.5 $B$G$O(B (provide 'vip) $B$5$l$F$$$J$$!#(B
|
|
43 (require 'vip)
|
|
44 (error (if (not (boundp 'vip-current-mode)) (load "vip"))) )
|
|
45
|
|
46 (defvar skk-vip-load-hook nil
|
|
47 "*skk-vip.el $B$,%m!<%I$5$l$?8e$K%3!<%k$5$l$k%U%C%/!#(B" )
|
|
48
|
|
49 ;;; --- user variable.
|
|
50 (defvar skk-vip-mode-hook nil
|
|
51 "*skk-use-vip$B$,(B non-nil $B$N>l9g$G!"(Bskk-mode $B$r5/F0$7$?$H$-$K%3!<%k$5$l$k%U%C%/!#(B" )
|
|
52
|
|
53 ;; internal variable.
|
|
54 (defvar skk-vip-mode-invoked nil
|
|
55 "Non-nil $B$G$"$l$P!"(BEmacs $B$r5/F08e4{$K(B skk-vip-mode $B$r5/F0$7$?$3$H$r<($9!#(B" )
|
|
56
|
|
57 (if (boundp 'vip-ovwrt-limit)
|
|
58 (defun skk-ovwrt-len (len)
|
|
59 ;; $B>e=q$-$7$FNI$$D9$5$rJV$9!#(B
|
|
60 ;; vip-ovwrt-limit $B$O(B vip version 4 $B$G;HMQ$5$l$F$$$kF0E*JQ?t!#(B
|
|
61 ;; $B2DG=$G$"$l$P!"$3$N$h$&$J%3!<%G%#%s%0%9%?%$%k$OHr$1$k$Y$-!#(B
|
|
62 (min (- vip-ovwrt-limit (point))
|
|
63 (- (skk-save-point (end-of-line) (point)) (point)) len )))
|
|
64
|
|
65 ;;;###skk-autoload
|
|
66 (defun skk-vip-mode ()
|
|
67 ;; skk-mode $B$N%3!<%k;~$K(B VIP $B4XO"$N%;%C%H%"%C%W$r9T$&!#(B
|
|
68 (let (skk-mode) (vip-change-mode-to-insert))
|
|
69 (if (not skk-vip-mode-invoked)
|
|
70 (prog1 (run-hooks 'skk-vip-mode-hook)
|
|
71 (setq skk-vip-mode-invoked t) )))
|
|
72
|
|
73 (defun skk-insert-str (str)
|
|
74 ;; skk-insert $B$N%5%V%k!<%A%s!#(BSTR $B$rA^F~$9$k!#I,MW$G$"$l$P(B
|
|
75 ;; self-insert-after-hook $B$r%3!<%k$9$k!#(Boverwrite-mode $B$G$"$l$P!"E,@Z$K>e=q$-(B
|
|
76 ;; $B$r9T$&(B (<(skk.el/skk-insert-str)>)$B!#(B
|
|
77 (skk-cancel-undo-boundary)
|
|
78 (skk-insert-and-inherit str)
|
|
79 (if (and skk-henkan-on (not skk-henkan-active))
|
|
80 (if (and skk-auto-start-henkan (not skk-okurigana))
|
|
81 (skk-auto-start-henkan str) )
|
|
82 (if (and (boundp 'self-insert-after-hook) self-insert-after-hook)
|
|
83 (funcall self-insert-after-hook (- (point) (length str)) (point)))
|
|
84 ;; (boundp 'vip-ovwrt-limit) means that this function is within the
|
|
85 ;; dynamic scope of vip-overwrite-execute
|
|
86 (if (or overwrite-mode (boundp 'vip-ovwrt-limit))
|
|
87 (skk-del-char-with-pad (skk-ovwrt-len (string-width str))) )))
|
|
88
|
|
89 (defun skk-kakutei-cleanup-henkan-buffer ()
|
|
90 ;; $B3NDjD>8e$N%P%C%U%!$N@07A$r9T$J$&(B
|
|
91 ;; (<(skk.el/skk-kakutei-cleanup-henkan-buffer)>)$B!#(B
|
|
92 (if skk-okurigana
|
|
93 (progn
|
|
94 (skk-delete-okuri-mark)
|
|
95 (if (and skk-katakana skk-convert-okurigana-into-katakana)
|
|
96 (skk-katakana-region skk-henkan-end-point (point)) )))
|
|
97 (skk-delete-henkan-markers)
|
|
98 (if (and (boundp 'self-insert-after-hook) self-insert-after-hook)
|
|
99 (funcall self-insert-after-hook skk-henkan-start-point (point)) )
|
|
100 (if (or overwrite-mode (boundp 'vip-ovwrt-limit))
|
|
101 (skk-del-char-with-pad
|
|
102 (skk-ovwrt-len
|
|
103 (string-width
|
|
104 (skk-buffer-substring skk-henkan-start-point (point)) )))))
|
|
105
|
|
106 (defadvice vip-ESC (before skk-add activate)
|
|
107 "$B"&%b!<%I!""'%b!<%I$@$C$?$i3NDj$9$k!#(B"
|
|
108 (and skk-mode skk-henkan-on (skk-kakutei)) )
|
|
109
|
|
110 (defadvice vip-insert (after skk-ad activate)
|
|
111 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
112 (if skk-mode (skk-j-mode-on)) )
|
|
113
|
|
114 (defadvice vip-Insert (after skk-ad activate)
|
|
115 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
116 (if skk-mode (skk-j-mode-on)) )
|
|
117
|
|
118 (defadvice vip-open-line (after skk-ad activate)
|
|
119 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
120 (if skk-mode (skk-j-mode-on)) )
|
|
121
|
|
122 (defadvice vip-Open-line (after skk-ad activate)
|
|
123 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
124 (if skk-mode (skk-j-mode-on)) )
|
|
125
|
|
126 (defadvice vip-append (after skk-ad activate)
|
|
127 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
128 (if skk-mode (skk-j-mode-on)) )
|
|
129
|
|
130 (defadvice vip-Append (after skk-ad activate)
|
|
131 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
132 (if skk-mode (skk-j-mode-on)) )
|
|
133
|
|
134 (defadvice vip-overwrite (after skk-ad activate)
|
|
135 "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
136 (if skk-mode (skk-j-mode-on)) )
|
|
137
|
|
138 ;;;; $B$3$j$c%@%a$C$9$M!#(B
|
|
139 ;;;;(defadvice vip-replace-char (after skk-ad activate)
|
|
140 ;;;; "skk-mode $B$@$C$?$i$+$J%b!<%I$K$9$k!#(B"
|
|
141 ;;;; (if skk-mode (skk-j-mode-on)) )
|
|
142
|
|
143 ;;(defadvice delete-backward-char (around skk-ad activate)
|
|
144 ;; (cond ((and skk-henkan-on (>= skk-henkan-start-point (point)))
|
|
145 ;; (setq skk-henkan-count 0)
|
|
146 ;; (skk-kakutei) )
|
|
147 ;; (skk-henkan-active
|
|
148 ;; (if (and (not skk-delete-implies-kakutei)
|
|
149 ;; (= skk-henkan-end-point (point)) )
|
|
150 ;; (skk-previous-candidate)
|
|
151 ;; ;;(if skk-use-face (skk-henkan-face-off))
|
|
152 ;; (if overwrite-mode
|
|
153 ;; (progn
|
|
154 ;; (backward-char (prefix-numeric-value count))
|
|
155 ;; (delete-char (prefix-numeric-value count)) )
|
|
156 ;; ad-do-it )
|
|
157 ;; (if (>= skk-henkan-end-point (point)) (skk-kakutei)) ))
|
|
158 ;; ((and skk-henkan-on overwrite-mode)
|
|
159 ;; (backward-char (prefix-numeric-value count))
|
|
160 ;; (delete-char (prefix-numeric-value count)) )
|
|
161 ;; (t ad-do-it) ))
|
|
162
|
|
163 (run-hooks 'skk-vip-load-hook)
|
|
164
|
|
165 (provide 'skk-vip)
|
|
166 ;; skk-vip.el ends here
|