Mercurial > emacs
comparison lisp/international/kkc.el @ 18644:69c91eee7ba1
(kkc-region): Call skkdic-lookup-key with
t for arg PREFER-NOUN while looking up key sequences shorter than
what a user requested.
(kkc-next-phrace): Likewise.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 07 Jul 1997 00:53:02 +0000 |
parents | 8b4a66c66dd6 |
children | 0933bf4b82c9 |
comparison
equal
deleted
inserted
replaced
18643:c9b94c6ab8f1 | 18644:69c91eee7ba1 |
---|---|
165 ;; Lookup SKK dictionary to set list of conversions in | 165 ;; Lookup SKK dictionary to set list of conversions in |
166 ;; kkc-current-conversions for key sequence kkc-current-key of length | 166 ;; kkc-current-conversions for key sequence kkc-current-key of length |
167 ;; LEN. If no conversion is found in the dictionary, don't change | 167 ;; LEN. If no conversion is found in the dictionary, don't change |
168 ;; kkc-current-conversions and return nil. | 168 ;; kkc-current-conversions and return nil. |
169 ;; Postfixes are handled only if POSTFIX is non-nil. | 169 ;; Postfixes are handled only if POSTFIX is non-nil. |
170 (defun kkc-lookup-key (len &optional postfix) | 170 (defun kkc-lookup-key (len &optional postfix prefer-noun) |
171 ;; At first, prepare cache data if any. | 171 ;; At first, prepare cache data if any. |
172 (if (not kkc-init-file-flag) | 172 (if (not kkc-init-file-flag) |
173 (progn | 173 (progn |
174 (setq kkc-init-file-flag t) | 174 (setq kkc-init-file-flag t) |
175 (add-hook 'kill-emacs-hook 'kkc-save-init-file) | 175 (add-hook 'kill-emacs-hook 'kkc-save-init-file) |
181 (let ((entry (lookup-nested-alist kkc-current-key kkc-lookup-cache len 0 t))) | 181 (let ((entry (lookup-nested-alist kkc-current-key kkc-lookup-cache len 0 t))) |
182 (if (consp (car entry)) | 182 (if (consp (car entry)) |
183 (setq kkc-length-converted len | 183 (setq kkc-length-converted len |
184 kkc-current-conversions-width nil | 184 kkc-current-conversions-width nil |
185 kkc-current-conversions (car entry)) | 185 kkc-current-conversions (car entry)) |
186 (setq entry (skkdic-lookup-key kkc-current-key len postfix)) | 186 (setq entry (skkdic-lookup-key kkc-current-key len postfix prefer-noun)) |
187 (if entry | 187 (if entry |
188 (progn | 188 (progn |
189 (setq kkc-length-converted len | 189 (setq kkc-length-converted len |
190 kkc-current-conversions-width nil | 190 kkc-current-conversions-width nil |
191 kkc-current-conversions (cons 1 entry)) | 191 kkc-current-conversions (cons 1 entry)) |
220 (setq kkc-overlay-tail (make-overlay to to nil nil t)) | 220 (setq kkc-overlay-tail (make-overlay to to nil nil t)) |
221 (overlay-put kkc-overlay-tail 'face 'underline)) | 221 (overlay-put kkc-overlay-tail 'face 'underline)) |
222 | 222 |
223 ;; After updating the conversion region with the first candidate of | 223 ;; After updating the conversion region with the first candidate of |
224 ;; conversion, jump into a recursive editing environment with KKC | 224 ;; conversion, jump into a recursive editing environment with KKC |
225 ;; mode . | 225 ;; mode. |
226 (let ((overriding-local-map nil) | 226 (let ((overriding-local-map nil) |
227 (previous-local-map (current-local-map)) | 227 (previous-local-map (current-local-map)) |
228 (minor-mode-alist nil) | 228 (minor-mode-alist nil) |
229 (minor-mode-map-alist nil) | 229 (minor-mode-map-alist nil) |
230 (current-input-method-title kkc-input-method-title) | 230 (current-input-method-title kkc-input-method-title) |
231 major-mode mode-name) | 231 major-mode mode-name) |
232 (unwind-protect | 232 (unwind-protect |
233 (progn | 233 (let (len) |
234 (setq kkc-canceled nil) | 234 (setq kkc-canceled nil) |
235 (setq kkc-current-key (string-to-vector kkc-original-kana)) | 235 (setq kkc-current-key (string-to-vector kkc-original-kana)) |
236 (setq kkc-length-head (length kkc-current-key)) | 236 (setq kkc-length-head (length kkc-current-key)) |
237 (setq len kkc-length-head) | |
237 (setq kkc-length-converted 0) | 238 (setq kkc-length-converted 0) |
238 (while (not (kkc-lookup-key kkc-length-head)) | 239 (while (not (kkc-lookup-key kkc-length-head nil |
240 (< kkc-length-head len))) | |
239 (setq kkc-length-head (1- kkc-length-head))) | 241 (setq kkc-length-head (1- kkc-length-head))) |
240 (goto-char to) | 242 (goto-char to) |
241 (kkc-update-conversion 'all) | 243 (kkc-update-conversion 'all) |
242 (kkc-mode) | 244 (kkc-mode) |
243 (recursive-edit)) | 245 (recursive-edit)) |
398 (setq kkc-length-head (1- kkc-length-head))) | 400 (setq kkc-length-head (1- kkc-length-head))) |
399 (if (= kkc-length-head 0) | 401 (if (= kkc-length-head 0) |
400 (kkc-terminate) | 402 (kkc-terminate) |
401 (let ((newkey (make-vector kkc-length-head 0)) | 403 (let ((newkey (make-vector kkc-length-head 0)) |
402 (idx (- (length kkc-current-key) kkc-length-head)) | 404 (idx (- (length kkc-current-key) kkc-length-head)) |
405 (len kkc-length-head) | |
403 (i 0)) | 406 (i 0)) |
404 ;; For the moment, (setq kkc-original-kana (concat newkey)) | 407 ;; For the moment, (setq kkc-original-kana (concat newkey)) |
405 ;; doesn't work. | 408 ;; doesn't work. |
406 (setq kkc-original-kana "") | 409 (setq kkc-original-kana "") |
407 (while (< i kkc-length-head) | 410 (while (< i kkc-length-head) |
409 (setq kkc-original-kana | 412 (setq kkc-original-kana |
410 (concat kkc-original-kana (char-to-string (aref newkey i)))) | 413 (concat kkc-original-kana (char-to-string (aref newkey i)))) |
411 (setq i (1+ i))) | 414 (setq i (1+ i))) |
412 (setq kkc-current-key newkey) | 415 (setq kkc-current-key newkey) |
413 (setq kkc-length-converted 0) | 416 (setq kkc-length-converted 0) |
414 (while (and (not (kkc-lookup-key kkc-length-head)) | 417 (while (and (not (kkc-lookup-key kkc-length-head nil |
418 (< kkc-length-head len))) | |
415 (> kkc-length-head 1)) | 419 (> kkc-length-head 1)) |
416 (setq kkc-length-head (1- kkc-length-head))) | 420 (setq kkc-length-head (1- kkc-length-head))) |
417 (let ((pos (point)) | 421 (let ((pos (point)) |
418 (tail (overlay-end kkc-overlay-tail))) | 422 (tail (overlay-end kkc-overlay-tail))) |
419 (move-overlay kkc-overlay-head pos tail) | 423 (move-overlay kkc-overlay-head pos tail) |