1 ;; -*-byte-compile-dynamic: t;-*-
2 ;;; skk-look.el --- UNIX look command interface for SKK
3 ;; Copyright (C) 1998, 1999 Mikio Nakajima <minakaji@osaka.email.ne.jp>
5 ;; Author: Mikio Nakajima <minakaji@osaka.email.ne.jp>
6 ;; Maintainer: Mikio Nakajima <minakaji@osaka.email.ne.jp>
7 ;; Version: $Id: skk-look.el,v 1.2 2000-11-08 01:51:44 youngs Exp $
9 ;; Last Modified: $Date: 2000-11-08 01:51:44 $
11 ;; This file is not part of SKK yet.
13 ;; SKK is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either versions 2, or (at your option)
18 ;; SKK is distributed in the hope that it will be useful
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with SKK, see the file COPYING. If not, write to the Free
25 ;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston,
26 ;; MA 02111-1307, USA.
31 ;; .skk
\e$B$+
\e(B .emacs
\e$B$G
\e(B `skk-use-look'
\e$B$r
\e(B t
\e$B$K%;%C%H$7$F$3$l$rI>2A$7$F2<$5$$!#$=$N
\e(B
32 ;;
\e$B8e
\e(B skk-mode
\e$B$rN)$A>e$2$k$+!"
\e(BM-x skk-restart
\e$B$9$k$H!"
\e(B
\e$B2<5-$N$h$&$J7]Ev$,2DG=$K
\e(B
35 ;; (1)
\e$B1QC18l$rJd40$,$G$-$^$9!#
\e(B
37 ;;
\e$B"&
\e(Babstr(TAB) --->
\e$B"&
\e(Babstract
39 ;;
\e$BDL>o$NJd405!G=F1MM!"
\e(B`.'
\e$B$G<!$NJd408uJd!"
\e(B`,'
\e$B$G$R$H$DA0$NJd408uJd$K
\e(B
40 ;;
\e$B0\F0$G$-$^$9!#
\e(B
42 ;; SKK
\e$B7A<0$N1QOB<-=q$,$"$l$P!"$3$3$+$i
\e(B SPC
\e$B$r2!$7$F1QOBJQ49$,$G$-$^$9
\e(B
45 ;; (2)
\e$B1QC18l$r$"$$$^$$$KJQ49$7$F<h$j=P$9$3$H$,$G$-$^$9!#
\e(B
47 ;;
\e$B"&
\e(Babstr* (SPC) --->
\e$B"'
\e(Babstract
49 ;;
\e$B8+=P$78l$K%"%9%?%j%9%/
\e(B (`*')
\e$B$rF~$l$k$N$r$*K:$l$J$/!#
\e(B
51 ;;
\e$B3NDj$9$k$H!"
\e(B`abstr*'
\e$B$r8+=P$78l!"
\e(B`abstract'
\e$B$r8uJd$H$9$k%(%s%H%j$,8D?M<-
\e(B
52 ;;
\e$B=q$KDI2C$5$l$^$9!#$3$N$h$&$J%(%s%H%j$rDI2C$7$?$/$J$$>l9g$O!"
\e(B
53 ;;
\e$B%f!<%6!<JQ?t!"
\e(B`skk-search-excluding-word-pattern-function'
\e$B$rE,@Z$K
\e(B
54 ;;
\e$B@_Dj$9$k$3$H$G!"$3$l$r<B8=$9$k$3$H$,$G$-$^$9!#>\$7$/$O!"
\e(B
55 ;; `skk-search-excluding-word-pattern-function'
\e$B$N%I%-%e%a%s%H$r$4Mw2<$5$$!#
\e(B
57 ;; (3)(2)
\e$B$GJQ49$7$?8e!"99$K:F5"E*$J1QOBJQ49$r9T$J$&$3$H$,$G$-$^$9!#
\e(B
59 ;;
\e$B$^$:!"
\e(B`skk-look-recursive-search'
\e$B$NCM$r
\e(B non-nil
\e$B$K%;%C%H$7$F2<$5
\e(B
60 ;;
\e$B$$!#
\e(BEmacs/SKK
\e$B$r:F5/F0$9$kI,MW$O$"$j$^$;$s!#
\e(B
62 ;;
\e$B$9$k$H!"Nc$($P!"
\e(B
64 ;;
\e$B"&
\e(Babstr* (SPC)
66 ;; --->
\e$B"'
\e(Babstract (SPC) ->
\e$B"'%"%V%9%H%i%/%H
\e(B (SPC) ->
\e$B"'Cj>]
\e(B (SPC)
67 ;; ->
\e$B"'
\e(Babstraction (SPC) ->
\e$B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u-aizu.ac.jp:/pub/SciEng/nihongo/ftp.cc.monash.edu.au/
91 ;;
\e$B$KCV$$$F$"$k
\e(B edict
\e$B$rMxMQ$9$k$H<j7Z$K1QOB<-=q$,$G$-$^$9!#
\e(B
93 ;; % jgawk -f skk-10/lisp/look/edict2skk.awk edict > temp
94 ;; % skkdic-expr temp | skkdic-sort > SKK-JISYO.E2J
97 ;;
\e$B$G$-$?
\e(B SKK-JISYO.E2J
\e$B$NMxMQJ}K!$O?'!9$"$j$^$9$,!"
\e(B
99 ;; % skkdic-expr SKK-JISYO.E2J + /usr/local/share/skk/SKK-JISYO.L | skkdic-sort > SKK-JISYO.L
101 ;;
\e$B$J$I$H$7$F!"
\e(BSKK-JISYO.L
\e$B$H%^!<%8$7$F;H$&$N$,<j7Z$G$9!#
\e(B
104 ;;
\e$B$3$N%W%m%0%i%`$O!"
\e(BeWnn for Linux/FreeBSD
\e$B$N9-9p$KN`;w$N5!G=>R2p$,$"$C$?$N$r8+
\e(B
105 ;;
\e$B$F!"!V$3$s$J5!G=$J$i
\e(B SKK
\e$B>e$K$9$0%$%s%W%j%a%s%H$G$-$k$5!W$H;W$&$H$?$^$i$/$J$C
\e(B
106 ;;
\e$B$F=q$$$F$7$^$$$^$7$?!#
\e(BeWnn
\e$B$KIi$1$k$J!"
\e(BSKK!
108 ;;
\e$B@N!"
\e(BSeiichi Namba <sn@asahi-net.email.ne.jp>
\e$B$5$s$H0l=o$K
\e(B Emacs Lisp
\e$B$G
\e(B
109 ;; look interface
\e$B$r=q$$$?$3$H$,$"$k$N$G$9$,!":#2s$O$=$N:]$N7P83$r@8$+$9$3$H$,$G$-
\e(B
110 ;;
\e$B$^$7$?!#FqGH$5$s$K46<U$$$?$7$^$9!#
\e(B
113 (eval-when-compile (require 'skk) (require 'skk-comp))
114 (require 'skk-foreword)
119 (defgroup skk-look nil "SKK look conversion related customization."
124 (defcustom skk-look-command (exec-installed-p "look")
125 "*UNIX look
\e$B%3%^%s%I$NL>A0!#
\e(B"
129 (defcustom skk-look-ignore-case t
130 "*Non-nil
\e$B$G$"$l$P!"BgJ8;z!&>.J8;z$r6hJL$7$J$$$G8!:w$r9T$J$&!#
\e(B
131 look
\e$B%3%^%s%I$K%*%W%7%g%s
\e(B \"-f\"
\e$B$rEO$9!#
\e(B"
135 (defcustom skk-look-dictionary-order t
136 "*Non-nil
\e$B$G$"$l$P!"<-=q=g$K%=!<%H$5$l$?8!:w%U%!%$%k$r;HMQ$9$k!#
\e(B
137 look
\e$B%3%^%s%I$K%*%W%7%g%s
\e(B \"-d\"
\e$B$rEO$9!#
\e(B"
141 (defcustom skk-look-use-alternate-dictionary nil
142 "*Non-nil
\e$B$G$"$l$P!"
\e(B/usr/dict/web2
\e$B$r;H$$8!:w$r9T$J$&!#
\e(B
143 \e$B%G%#%U%)%k%H$N<-=q$O!"
\e(B/usr/dict/words
\e$B!#
\e(B
144 look
\e$B%3%^%s%I$K%*%W%7%g%s
\e(B \"-a\"
\e$B$rEO$9!#
\e(B"
145 :type '(choice file (const nil))
148 (defcustom skk-look-termination-character nil
149 "*Non-nil
\e$B$G$"$l$P!"$=$NJ8;zNs$r
\e(B UNIX look
\e$B%3%^%s%I$,;H$&=*C<J8;zNs$H$7$FL@<(E*$K;XDj$9$k!#
\e(B
150 look
\e$B%3%^%s%I$K%*%W%7%g%s
\e(B \"-t\"
\e$B$H$=$NJ8;zNs$rEO$9!#
\e(B"
151 :type '(choice string (const nil))
154 (defcustom skk-look-dictionary nil
155 "*look
\e$B%3%^%s%I$,8!:w$9$k<-=q%U%!%$%k!#
\e(B
156 nil
\e$B$G$"$l$P!"
\e(B/usr/dict/words
\e$B$r;HMQ$9$k!#
\e(B"
157 :type '(choice file (const nil))
160 (defcustom skk-look-recursive-search nil
161 "*Non-nil
\e$B$G$"$l$P!"
\e(Blook
\e$B%3%^%s%I$,8+$D$1$?1QC18l$rJQ49%-!<$K$7!":F8!:w$r9T$J$&!#
\e(B
162 \e$B:F8!:w$N7k2L!"8uJd$,8+$D$+$i$J$1$l$P!"85$N1QC18l<+?H$r8uJd$H$7$F=PNO$9$k!#
\e(B"
166 (defcustom skk-look-expanded-word-only t
167 "*Non-nil
\e$B$G$"$l$P!"
\e(Blook
\e$B$N=PNO$KBP$9$k:F8!:w$,@.8y$7$?>l9g$N$_$r:G=*E*$J8uJd$H$7$FI=<($9$k!#
\e(B
168 skk-look-recursive-search
\e$B$,
\e(B non-nil
\e$B$G$"$k$H$-$N$_M-8z!#
\e(B"
172 ;; internal constant and variable.
173 (defconst skk-look-working-buffer " *skk look*")
174 (defvar skk-look-completion-words nil)
177 (and skk-look-command
178 (null (member '(skk-look) skk-search-prog-list))
179 (let ((pl skk-search-prog-list)
183 (if (memq (nth 1 dic) '(skk-jisyo skk-rdbms-private-jisyo-table))
188 (skk-splice-in skk-search-prog-list (1+ mark)
194 ;; UNIX look
\e$B%3%^%s%I$rMxMQ$7$?JQ49$r9T$J$&!#
\e(B
195 ;; SKK abbrev
\e$B%b!<%I$K$F!"1QJ8;z
\e(B +
\e$B%"%9%?%j%9%/$G
\e(B uncompleted spelling
\e$B$r;XDj
\e(B
198 (eq (skk-str-ref skk-henkan-key (1- (length skk-henkan-key))) ?*)
199 (let ((args (substring skk-henkan-key 0 (1- (length skk-henkan-key))))
201 (setq v (skk-look-1 args))
202 (if (not skk-look-recursive-search)
204 (let (skk-henkan-key v2 v3)
206 (let ((skk-current-search-prog-list
207 (delete '(skk-look) (copy-sequence skk-search-prog-list)) ))
208 (setq skk-henkan-key (car v))
209 (while skk-current-search-prog-list
210 (setq v3 (skk-search)
211 v2 (if (not skk-look-expanded-word-only)
212 (skk-nunion v2 (cons (car v) v3))
214 (skk-nunion v2 (cons (car v) v3))
219 (defun skk-look-1 (args)
220 ;; core search engine
223 (let (opt buffer-read-only)
224 (set-buffer (get-buffer-create skk-look-working-buffer))
226 (setq args (list args))
227 (and skk-look-dictionary (nconc args (list skk-look-dictionary)))
228 (and skk-look-dictionary-order (setq opt "d"))
229 (and skk-look-ignore-case (setq opt (concat "f" opt)))
230 (and skk-look-use-alternate-dictionary
231 (setq opt (concat "a" opt)) )
232 (and opt (setq args (cons (concat "-" opt) args)))
233 (and skk-look-termination-character
235 (cons (list "-t" skk-look-termination-character) args) ))
237 (= 0 (apply 'call-process skk-look-command nil t nil args))
239 (split-string (buffer-substring-no-properties (point-min) (1- (point-max)))
242 (setq skk-search-prog-list (delete '(skk-look) skk-search-prog-list))
243 (skk-error "
\e$B%7%9%F%`>e$K
\e(B look
\e$B%3%^%s%I$,8+$D$+$j$^$;$s
\e(B"
244 "Sorry, can't find look command on your system" ))))
247 (defun skk-look-completion ()
248 (or skk-look-completion-words
249 (let ((stacked skk-completion-stack))
250 ;; look
\e$B$OJ#?t$N8uJd$rEG$/$N$G!"0lC6Cy$a$F$*$$$F!"0l$D$E$D
\e(B complete
\e$B$9$k!#
\e(B
251 (setq skk-look-completion-words
252 (delete skk-completion-word (skk-look-1 skk-completion-word)) )
254 (setq skk-look-completion-words
255 (delete (car stacked) skk-look-completion-words)
256 stacked (cdr stacked) ))))
258 (car skk-look-completion-words)
259 (setq skk-look-completion-words (cdr skk-look-completion-words)) ))
262 ;;; skk-look.el ends here