annotate lisp/skk/skk-auto.el @ 219:262b8bb4a523 r20-4b8

Import from CVS: tag r20-4b8
author cvs
date Mon, 13 Aug 2007 10:09:35 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
1 ;;; skk-auto.el --- $BAw$j2>L>$N<+F0=hM}$N$?$a$N%W%m%0%i%`(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
2 ;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
3 ;; Masahiko Sato <masahiko@kuis.kyoto-u.ac.jp>
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
4
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
5 ;; Author: Masahiko Sato <masahiko@kuis.kyoto-u.ac.jp>
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
6 ;; Maintainer: Mikio Nakajima <minakaji@osaka.email.ne.jp>
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
7 ;; Version: $Id: skk-auto.el,v 1.1 1997/12/02 08:48:37 steve Exp $
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
8 ;; Keywords: japanese
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
9 ;; Last Modified: $Date: 1997/12/02 08:48:37 $
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
10
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
11 ;; This program is free software; you can redistribute it and/or modify
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either versions 2, or (at your option)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
14 ;; any later version.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
15
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
16 ;; This program is distributed in the hope that it will be useful
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
19 ;; GNU General Public License for more details.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
20
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
22 ;; along with SKK, see the file COPYING. If not, write to the Free
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
23 ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston,
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
24 ;; MA 02111-1307, USA.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
25
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
26 ;;; Commentary:
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
27 ;; Following people contributed modifications to skk-server.el (Alphabetic
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
28 ;; order):
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
29 ;;
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
30 ;; Mikio Nakajima <minakaji@osaka.email.ne.jp>
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
31
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
32 ;;; Change log:
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
33 ;; version 1.0.6 released 1997.2.18 (derived from the skk.el 8.6)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
34
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
35 ;;; Code:
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
36 (require 'skk-foreword)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
37 (require 'skk-vars)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
38
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
39 ;;; user variables
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
40 (defvar skk-kana-rom-vector
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
41 ["x" "a" "x" "i" "x" "u" "x" "e" "x" "o" "k" "g" "k" "g" "k" "g"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
42 "k" "g" "k" "g" "s" "z" "s" "j" "s" "z" "s" "z" "s" "z" "t" "d"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
43 "t" "d" "x" "t" "d" "t" "d" "t" "d" "n" "n" "n" "n" "n" "h" "b"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
44 "p" "h" "b" "p" "h" "b" "p" "h" "b" "p" "h" "b" "p" "m" "m" "m"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
45 "m" "m" "x" "y" "x" "y" "x" "y" "r" "r" "r" "r" "r" "x" "w" "x"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
46 "x" "w" "n"]
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
47 "*skk-remove-common $B$G;HMQ$9$k$+$JJ8;z$+$i%m!<%^;z$X$NJQ49%k!<%k!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
48 $B2<5-$N3:Ev$9$k$+$JJ8;z$r$=$NJ8;z$N%m!<%^;z%W%l%U%#%C%/%9$G8=$o$7$?$b$N!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
49 $B$!(B $B$"(B $B$#(B $B$$(B $B$%(B $B$&(B $B$'(B $B$((B $B$)(B $B$*(B $B$+(B $B$,(B $B$-(B $B$.(B $B$/(B $B$0(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
50 $B$1(B $B$2(B $B$3(B $B$4(B $B$5(B $B$6(B $B$7(B $B$8(B $B$9(B $B$:(B $B$;(B $B$<(B $B$=(B $B$>(B $B$?(B $B$@(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
51 $B$A(B $B$B(B $B$C(B $B$D(B $B$E(B $B$F(B $B$G(B $B$H(B $B$I(B $B$J(B $B$K(B $B$L(B $B$M(B $B$N(B $B$O(B $B$P(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
52 $B$Q(B $B$R(B $B$S(B $B$T(B $B$U(B $B$V(B $B$W(B $B$X(B $B$Y(B $B$Z(B $B$[(B $B$\(B $B$](B $B$^(B $B$_(B $B$`(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
53 $B$a(B $B$b(B $B$c(B $B$d(B $B$e(B $B$f(B $B$g(B $B$h(B $B$i(B $B$j(B $B$k(B $B$l(B $B$m(B $B$n(B $B$o(B $B$p(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
54 $B$q(B $B$r(B $B$s(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
55 $B$=$l$>$l$N$+$JJ8;z$,Aw$j2>L>$G$"$k>l9g$K$I$N%m!<%^;z%W%l%U%#%C%/%9$rBP1~$5$;$k(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
56 $B$N$+$r;XDj$9$k$3$H$,$G$-$k!#!V$8!W!"!V$A!W!"!V$U!W$NJ8;z$K$D$$$F!"BP1~$9$k%m!<(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
57 $B%^;z%W%l%U%#%C%/%9$r(B \"z\", \"c\",\"f\" $B$KJQ99$r4uK>$9$k>l9g$b$"$k$G$"$m$&!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
58 skk-auto-okuri-process $B$NCM$,(B non-nil $B$N$H$-$N$_;2>H$5$l$k!#(B" )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
59
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
60 (defvar skk-auto-load-hook nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
61 "*skk-auto.el $B$r%m!<%I$7$?8e$K%3!<%k$5$l$k%U%C%/!#(B" )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
62
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
63 ;; internal valriables
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
64 ;;;###skk-autoload
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
65 (skk-deflocalvar skk-henkan-in-minibuff-flag nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
66 "$B%_%K%P%C%U%!$G<-=qEPO?$r9T$C$?$H$-$K$3$N%U%i%0$,N)$D!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
67 skk-remove-common $B$G;2>H$5$l$k!#(B" )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
68
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
69 (skk-deflocalvar skk-okuri-index-min -1
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
70 "skk-henkan-list $B$N%$%s%G%/%9$G<+F0Aw$j=hM}$G8!:w$7$?:G=i$N8uJd$r;X$9$b$N!#(B" )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
71
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
72 (skk-deflocalvar skk-okuri-index-max -1
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
73 "skk-henkan-list $B$N%$%s%G%/%9$G<+F0Aw$j=hM}$G8!:w$7$?:G8e$N8uJd$r;X$9$b$N!#(B" )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
74
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
75 (defun skk-okuri-search ()
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
76 ;; skk-auto-okuri-process $B$,(B non-nil $B$J$i$P(B "Uresii" $B$N$h$&$KAw$j2>L>$b4^$a(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
77 ;; $B$F%?%$%W$7$F$bAw$j$"$j$N(B "$B4r$7$$(B" $B$rC5$7=P$9!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
78 (if (and skk-auto-okuri-process
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
79 (not (or skk-abbrev-mode skk-process-okuri-early
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
80 skk-henkan-okurigana ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
81 ;; we don't do auto-okuri-process if henkan key contains numerals.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
82 (not (skk-numeric-p))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
83 (> (length skk-henkan-key) skk-kanji-len) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
84 (let (l)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
85 (setq skk-okuri-index-min (length skk-henkan-list)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
86 l (skk-okuri-search-subr)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
87 skk-okuri-index-max (+ skk-okuri-index-min (length l)) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
88 l )))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
89
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
90 (defun skk-okuri-search-subr ()
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
91 ;; skk-okuri-search $B$N%5%V%k!<%A%s!#8+$D$1$?%(%s%H%j$N%j%9%H$rJV$9!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
92 (let* ((henkan-key skk-henkan-key)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
93 (key (substring henkan-key 0 skk-kanji-len))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
94 (len (length henkan-key))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
95 (key1 (concat "\n" key))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
96 key2 len2 key3 len3 okuri3
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
97 ;; $B8zN($,NI$$$h$&$K(B kanji-flag, mc-flag, enable-multibyte-characters
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
98 ;; $B$r(B nil $B$K$7$F$*$/!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
99 mc-flag
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
100 ;; enable-multibyte-characters
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
101 ;; case-fold-search $B$O!"<-=q%P%C%U%!$G$O>o$K(B nil$B!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
102 ;;case-fold-search
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
103 (inhibit-quit t)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
104 key-cand-alist p q r s )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
105 (save-match-data
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
106 (with-current-buffer (skk-get-jisyo-buffer skk-jisyo)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
107 (goto-char skk-okuri-ari-min)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
108 (while (search-forward key1 skk-okuri-ari-max t)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
109 (setq p (point)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
110 key2 (concat key (skk-buffer-substring
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
111 p (- (search-forward " ") 2) ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
112 len2 (length key2) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
113 (if (not (and (<= len2 len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
114 (string= key2 (substring henkan-key 0 len2)) ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
115 nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
116 (let ((cont t))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
117 (skk-save-point
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
118 (end-of-line)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
119 (setq q (point)) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
120 (while (and cont (search-forward "/[" q t))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
121 (setq r (point))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
122 (setq okuri3 (skk-buffer-substring r (1- (search-forward "/")))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
123 key3 (concat key2 okuri3)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
124 len3 (length key3) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
125 (if (not (and (<= len3 len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
126 (string= key3 (substring henkan-key 0 len3)) ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
127 nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
128 ;; finally found a candidate!
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
129 (let ((okuri
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
130 (concat okuri3 (substring henkan-key len3 len)) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
131 cand )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
132 (while (not (eq (following-char) ?\]))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
133 (setq cand
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
134 (concat
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
135 (skk-buffer-substring
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
136 (point)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
137 (1- (search-forward "/" skk-okuri-ari-max t)) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
138 okuri ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
139 ;; $B8+=P$78l$,0c$C$F$b8uJd$,F1$8$3$H$,$"$jF@$k!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
140 ;; $B$+$s(Bz /$B46(B/[$B$8(B/$B46(B/]/
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
141 ;; $B$+$s(Bj /$B46(B/[$B$8(B/$B46(B/]/
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
142 ;; $B$J$I!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
143 (if (null (rassoc cand key-cand-alist))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
144 (setq key-cand-alist (cons (cons key3 cand)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
145 key-cand-alist ))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
146 ;; it is not necessary to seach for "\[" on this line
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
147 ;; any more
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
148 (setq cont nil) ))))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
149 ;; key3 $B$ND9$$$b$N=g$K%=!<%H$7$FJV$9!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
150 (mapcar (function
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
151 (lambda (x) (cdr x)) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
152 (sort (nreverse key-cand-alist)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
153 (function (lambda (x y)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
154 (string< (car y) (car x)) ))))))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
155
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
156 ;;;###skk-autoload
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
157 (defun skk-remove-common (word)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
158 ;; skk-henkan-key $B$H(B word $B$N4V$K6&DL$NAw$j2>L>$r<h$j=|$-!"Aw$j2>L>0J30$NItJ,(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
159 ;; $B$NJ8;zNs$rJV$9!#(Bskk-henkan-key $B$H(B skk-henkan-okurigana $B$NCM$r%;%C%H$9$k!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
160 ;; $BNc$($P!"(Bword == $B;}$C$F$-$?(B $B$G$"$l$P!"(Bskk-henkan-key := "$B$b(Bt",
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
161 ;; skk-henkan-okurigana := "$B$C$F(B", word := "$B;}(B" $B$N$h$&$KJ,2r$7!"(Bword $B$rJV$9!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
162 ;; skk-auto-okuri-process $B$NCM$,(B non-nil $B$G$"$k$H$-$K$3$N4X?t$r;HMQ$9$k!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
163 (if (and (not (skk-numeric-p)) (not skk-abbrev-mode)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
164 (or skk-henkan-in-minibuff-flag
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
165 (and (<= skk-okuri-index-min skk-henkan-count)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
166 (<= skk-henkan-count skk-okuri-index-max) )))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
167 (let ((midasi skk-henkan-key)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
168 (midasi-len (length skk-henkan-key))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
169 (word-len (length word))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
170 (kanji-len2 (* 2 skk-kanji-len))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
171 (mc-flag t)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
172 (enable-multibyte-characters t)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
173 (cont t)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
174 char pos pos2 midasi-tail word-tail new-word okuri-first
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
175 new-skk-henkan-key )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
176 (if (not (and (>= midasi-len kanji-len2) (>= word-len kanji-len2)))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
177 nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
178 ;; check if both midasi and word end with the same ascii char.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
179 (if (and (eq (aref midasi (1- midasi-len)) (aref word (1- word-len)))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
180 (skk-alpha-char-p (aref midasi (1- midasi-len))) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
181 ;; if so chop off the char from midasi and word
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
182 (setq midasi (substring midasi 0 -1)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
183 midasi-len (1- midasi-len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
184 word (substring word 0 -1)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
185 word-len (1- word-len) ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
186 (setq midasi-tail (substring midasi (- midasi-len skk-kanji-len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
187 midasi-len )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
188 word-tail (substring word (- word-len skk-kanji-len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
189 word-len ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
190 ;; $B$b$&>/$7E83+$G$-$=$&$@$,!"%P%$%H%3%s%Q%$%i!<$,%*%W%F%#%^%$%:$7$d(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
191 ;; $B$9$$$h$&$K(B not $B$rIU$1$k$@$1$K$7$F$*$/!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
192 (if (not (and (string= midasi-tail word-tail)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
193 (or (and (skk-string<= "$B$!(B" midasi-tail)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
194 (skk-string<= midasi-tail "$B$s(B") )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
195 (member midasi-tail '("$B!"(B" "$B!#(B" "$B!$(B" "$B!%(B")) )))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
196 nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
197 (setq pos (- word-len skk-kanji-len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
198 new-word new-skk-henkan-key )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
199 (while (and cont (> pos 0))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
200 (setq char (substring word (- pos skk-kanji-len) pos))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
201 (if (and (skk-string<= "$B0!(B" char) (skk-string<= char "$Bt$(B"))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
202 ;; char is the right-most Kanji
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
203 (setq cont nil)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
204 (setq pos (- pos skk-kanji-len)) ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
205 (setq pos2 (- midasi-len (- word-len pos)))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
206 ;; check if midasi and word has the same tail of length
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
207 (if (not (string= (substring midasi pos2 midasi-len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
208 (substring word pos word-len) ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
209 nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
210 (setq okuri-first (substring word pos (+ pos skk-kanji-len)))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
211 (setq skk-henkan-okurigana
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
212 (if (and (string= okuri-first "$B$C(B")
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
213 (<= (+ pos kanji-len2) word-len) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
214 ;; in this case okuriga consits of two
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
215 ;; characters, e.g., $B!V;D$C$?!W(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
216 (substring word pos (+ pos kanji-len2))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
217 okuri-first ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
218 (setq new-word (substring word 0 pos))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
219 (setq new-skk-henkan-key
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
220 (concat
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
221 (substring midasi 0 pos2)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
222 (cond ((string= okuri-first "$B$s(B")
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
223 "n" )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
224 ((string= okuri-first "$B$C(B")
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
225 (aref skk-kana-rom-vector
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
226 (- (string-to-char
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
227 (substring
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
228 skk-henkan-okurigana
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
229 (1- kanji-len2) kanji-len2 ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
230 161 )))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
231 (t (aref skk-kana-rom-vector
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
232 (- (string-to-char
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
233 (substring
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
234 skk-henkan-okurigana
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
235 (1- skk-kanji-len)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
236 skk-kanji-len ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
237 161 ))))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
238 (if (not skk-henkan-in-minibuff-flag)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
239 (setq word new-word
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
240 skk-henkan-key new-skk-henkan-key )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
241 ;; ask if register as okuri-ari word.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
242 (let (inhibit-quit) ; allow keyboard quit
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
243 (if (y-or-n-p
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
244 (format
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
245 (if skk-japanese-message-and-error
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
246 "%s /%s/ $B$rAw$j$"$j%(%s%H%j$H$7$FEPO?$7$^$9$+!)(B"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
247 "Shall I register this as okuri-ari entry: %s /%s/ ? " )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
248 new-skk-henkan-key new-word ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
249 (setq word new-word
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
250 skk-henkan-key new-skk-henkan-key )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
251 (setq skk-henkan-okurigana nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
252 skk-okuri-char nil )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
253 (message "") ))))))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
254 ;; $BJ,2r$7$?(B word ($BAw$j2>L>ItJ,$r=|$$$?$b$N(B) $B$rJV$9!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
255 word )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
256
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
257 ;;;###skk-autoload
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
258 (defun skk-init-auto-okuri-variables ()
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
259 ;; skk-auto.el $B$NFbItJQ?t$r=i4|2=$9$k!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
260 (setq skk-henkan-in-minibuff-flag nil
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
261 skk-okuri-index-min -1
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
262 skk-okuri-index-max -1 ))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
263
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
264 ;;;###skk-autoload
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
265 (defun skk-adjust-search-prog-list-for-auto-okuri ()
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
266 ;; skk-auto-okuri-process $B$,(B nil $B$G$"$l$P!"(Bskk-search-prog-list $B$+$i(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
267 ;; '(skk-okuri-search) $B$r>C$7!"(Bnon-nil $B$G$"$l$P2C$($k!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
268 ;;
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
269 ;; '(skk-okuri-search) $B$r2C$($k0LCV$K$D$$$F$O!"(Bskk-jisyo $B$N8e$,:GNI$+$I$&$+(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
270 ;; $B$OJ,$i$J$$$N$G!"%*%W%7%g%s$GJQ99$G$-$k$h$&$K$9$Y$-$@$,(B...$B!#(B
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
271 (if (not skk-auto-okuri-process)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
272 (setq skk-search-prog-list
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
273 (delete '(skk-okuri-search) skk-search-prog-list) )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
274 (if (null (member '(skk-okuri-search) skk-search-prog-list))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
275 (let ((pl skk-search-prog-list)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
276 (n 0) dic mark )
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
277 (while pl
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
278 (setq dic (car pl))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
279 (if (eq (nth 1 dic) 'skk-jisyo)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
280 (setq mark n
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
281 pl nil)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
282 (setq pl (cdr pl)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
283 n (1+ n) )))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
284 (skk-middle-list skk-search-prog-list
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
285 (1+ mark) '((skk-okuri-search)) )))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
286
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
287 ;;(add-hook 'skk-mode-hook 'skk-adjust-search-prog-list-for-auto-okuri)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
288
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
289 (run-hooks 'skk-auto-load-hook)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
290 (provide 'skk-auto)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents:
diff changeset
291 ;;; skk-auto.el ends here