1;;; skk-comp.el --- �䴰�Τ���Υץ���� 2;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3;; 1999 4;; Masahiko Sato <masahiko@kuis.kyoto-u.ac.jp> 5 6;; Author: Masahiko Sato <masahiko@kuis.kyoto-u.ac.jp> 7;; Maintainer: Mikio Nakajima <minakaji@osaka.email.ne.jp> 8;; Version: $Id: skk-comp.el,v 1.1 2002/11/27 13:17:35 tatari Exp $ 9;; Keywords: japanese 10;; Last Modified: $Date: 2002/11/27 13:17:35 $ 11 12;; This file is part of SKK. 13 14;; SKK is free software; you can redistribute it and/or modify 15;; it under the terms of the GNU General Public License as published by 16;; the Free Software Foundation; either versions 2, or (at your option) 17;; any later version. 18 19;; SKK is distributed in the hope that it will be useful 20;; but WITHOUT ANY WARRANTY; without even the implied warranty of 21;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22;; GNU General Public License for more details. 23 24;; You should have received a copy of the GNU General Public License 25;; along with SKK, see the file COPYING. If not, write to the Free 26;; Software Foundation Inc., 59 Temple Place - Suite 330, Boston, 27;; MA 02111-1307, USA. 28 29;;; Commentary: 30;; ���� (TAB) -> �����Ȥ� (.) -> �������Ȥ� (,) -> �����Ȥ�(.) -> �������Ȥ� 31 32;;; Code: 33;(eval-when-compile (require 'skk)) 34(require 'skk-foreword) 35 36;;;###autoload 37(defgroup skk-comp nil "SKK completion related customization." 38 :prefix "skk-" 39 :group 'skk ) 40 41;;; -- user variables 42(defcustom skk-dabbrev-like-completion nil 43 "*Non-nil �Ǥ���С����Ф�����䴰�ˤ����ơ��Ǹ���䴰���줿��ˤĤ��ƹ����䴰���Ԥ��롣 44�㤨�С� 45 46 \"��\" (,) -> \"���Ȥ�\" (,) -> \"���Ȥ�����\" 47 48nil �Ǥ���С���Ƭ��ʸ�����̤ˤ���ʸ����ˤĤ����䴰���Ԥʤ��롣 49�㤨�С� 50 51 \"��\" (,) -> \"���Ȥ�\" (,) -> \"�����Ȥ�\" (,) -> \"������\"" 52 :type 'boolean 53 :group 'skk-comp ) 54 55(defcustom skk-completion-function 'skk-completion-original 56 "*skk-completion �ǻ��Ѥ���ؿ��� 57skk-comp.el �ʳ����䴰��ǽ�����ѤǤ���褦�˴ؿ��� funcall ������ˤ��Ƥ�����" 58 :type 'function 59 :group 'skk-comp ) 60 61(defcustom skk-previous-completion-function 'skk-previous-completion-original 62 "*skk-previous-completion �ǻ��Ѥ���ؿ��� 63skk-comp.el �ʳ����䴰��ǽ�����ѤǤ���褦�˴ؿ��� funcall ������ˤ��Ƥ�����" 64 :type 'function 65 :group 'skk-comp ) 66 67(defcustom skk-comp-load-hook nil 68 "*skk-comp.el ����ɤ�����˥����뤵���եå���" 69 :type 'hook 70 :group 'skk-comp ) 71 72;;; -- internal variables 73;; ---- buffer local variables 74;; ��ʸ������Ф��� skk-completion ��Ƥ֤��Ȥ⤢�ꤦ��Τǡ�"" �� nil �Ǥ��� 75;; �ѤǤ��ʤ��� 76(skk-deflocalvar skk-completion-word "" 77 "�䴰���٤����Ф��졣 78skk-dabbrev-like-completion �� non-nil �ξ��ϡ���˺Ǹ���䴰�������Ф��줬 79��������롣" ) 80;; ������Ͽ���ߥ˥Хåե����䴰������硢���ΥХåե�����ä��Ȥ��� 81;; skk-completion-word ���ͤ��˲�����Ƥ��ʤ������٥����� 82 83(skk-deflocalvar skk-completion-stack nil 84 "�䴰���������¸���Ƥ��������å���" ) 85 86(skk-deflocalvar skk-completion-depth 0 87 "�䴰������� skk-completion-stack ������Ф����֡�" ) 88 89;;;###autoload 90(defun skk-start-henkan-with-completion (arg) 91 "���⡼�ɤ��ɤߤ��䴰��Ԥʤä��塢�Ѵ����롣 92����ʳ��Υ⡼�ɤǤϥ��ꥸ�ʥ�Υ����ޥåפ˳���դ���줿���ޥ�ɤߥ�졼 93�Ȥ��롣" 94 (interactive "*P") 95 (if (and skk-henkan-on (not skk-henkan-active)) 96 (progn 97 (skk-completion (not (eq last-command 'skk-completion))) 98 (skk-start-henkan arg) ) 99 (skk-emulate-original-map arg) )) 100 101;;;###autoload 102(defun skk-completion (first) 103 ;; skk-try-completion �Υ��֥롼���� 104 ;; skk-comp.el �ʳ����䴰��ǽ�����ѤǤ���褦�˴ؿ��� funcall ������ˤ��Ƥ����� 105 (funcall skk-completion-function first) ) 106 107(defun skk-completion-original (first) 108 ;; default �� skk-completion-function. 109 (let ((inhibit-quit t) 110 ;; skk-num �� require ����Ƥʤ��� buffer-local �ͤ�������줢�ꡣ 111 skk-num-list 112 completion-word c-word ) 113 (skk-kana-cleanup 'force) 114 (and first (setq skk-completion-stack nil skk-completion-depth 0)) 115 (and (or first skk-dabbrev-like-completion) 116 (setq skk-completion-word 117 (buffer-substring-no-properties skk-henkan-start-point (point)) )) 118 (and (string= skk-completion-word "") 119 (skk-error "��ʸ�������䴰���뤳�ȤϤǤ��ޤ���" 120 "Cannot complete an empty string!" )) 121 (if (> skk-completion-depth 0) 122 ;; (����õ���Ѥߤ��ɤߤ�������) 123 (setq skk-completion-depth (1- skk-completion-depth) 124 c-word (nth skk-completion-depth skk-completion-stack)) 125 ;; (�������ɤߤ�Хåե�����õ��) 126 ;; skk-completion-word �ϥХåե��������ͤʤΤǡ�����Хåե��˰ܤ����� 127 ;; ����ѿ��˰ܤ��Ѥ��Ƥ����� 128 (setq completion-word skk-completion-word) 129 (with-current-buffer (skk-get-jisyo-buffer skkinput-jisyo) 130 (if first (goto-char skk-okuri-nasi-min)) 131 (save-match-data 132 ;; case-fold-search �ϡ�����Хåե��ǤϾ�� nil�� 133 (while 134 (and (not c-word) 135 (search-forward 136 (concat "\n" 137 (if skk-use-numeric-conversion 138 (skk-num-compute-henkan-key completion-word) 139 completion-word )) 140 nil t )) 141 (if (eq (following-char) ?\040) ;SPC 142 nil 143 (setq c-word (concat completion-word 144 (buffer-substring-no-properties 145 ;; ���Ф���˶���ϴޤޤ�ʤ���" /" �� 146 ;; ������ɬ�פϤʤ��� 147 (point) (1- (search-forward " ")) ))))))) 148 (and (not c-word) skk-abbrev-mode skk-use-look 149 (setq c-word (skk-look-completion)) ) 150 ;; �����˸��Ĥ����Ȥ����� cons ���롣 151 (setq skk-completion-stack (cons c-word skk-completion-stack)) ) 152 ;; ����Хåե��γ��� 153 (if (not c-word) 154 (progn 155 (setq skk-completion-depth (1+ skk-completion-depth)) 156 (if skk-japanese-message-and-error 157 (error "\"%s\" ���䴰���٤����Ф����%s����ޤ���" 158 skk-completion-word (if first "" "¾��") ) 159 (error "No %scompletions for \"%s\"" 160 (if first "" "more ") skk-completion-word )) ) 161 (delete-region skk-henkan-start-point (point)) 162 (insert c-word) ))) 163 164;;;###autoload 165(defun skk-previous-completion () 166 ;; skk-abbrev-comma, skk-insert-comma �Υ��֥롼����ľ�����䴰��Ԥä��� 167 ;; �Ф����������롣 168 ;; skk-comp.el �ʳ����䴰��ǽ�����ѤǤ���褦�˴ؿ��� funcall ������ˤ��Ƥ����� 169 (funcall skk-previous-completion-function) ) 170 171(defun skk-previous-completion-original () 172 ;; default �� skk-previous-completion-function. 173 (let ((inhibit-quit t) 174 (c-word 175 (progn 176 (setq skk-completion-depth (1+ skk-completion-depth)) 177 (nth skk-completion-depth skk-completion-stack) ))) 178 (if c-word 179 (progn 180 (delete-region skk-henkan-start-point (point)) 181 (insert c-word) ) 182 (setq skk-completion-depth (1- skk-completion-depth)) 183 (skk-error "\"%s\"���䴰���٤����Ф����¾�ˤ���ޤ���" 184 "No more previous completions for \"%s\"" 185 skk-completion-word )))) 186 187(run-hooks 'skk-comp-load-hook) 188 189(provide 'skk-comp) 190;;; Local Variables: 191;;; End: 192;;; skk-comp.el ends here 193