| 1 |
;;; skk-pre-henkan.el --- SKK $B8+=P$78l$NBe$o$j$K8uJd$rI=<((B -*- coding: iso-2022-jp -*- |
| 2 |
|
| 3 |
;; Copyright (C) 2017 Tsuyoshi Kitamoto <[email protected]> |
| 4 |
|
| 5 |
;; Author: Tsuyoshi Kitamoto <[email protected]> |
| 6 |
;; Maintainer: SKK Development Team |
| 7 |
;; URL: https://github.com/skk-dev/ddskk |
| 8 |
;; Keywords: japanese, mule, input method |
| 9 |
|
| 10 |
;; This file is part of Daredevil SKK. |
| 11 |
|
| 12 |
;; This program is free software: you can redistribute it and/or |
| 13 |
;; modify it under the terms of the GNU General Public License as |
| 14 |
;; published by the Free Software Foundation, either version 3 of |
| 15 |
;; the License, or (at your option) any later version. |
| 16 |
|
| 17 |
;; This program is distributed in the hope that it will be |
| 18 |
;; useful, but WITHOUT ANY WARRANTY; without even the implied |
| 19 |
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 |
;; PURPOSE. See the GNU General Public License for more details. |
| 21 |
|
| 22 |
;; You should have received a copy of the GNU General Public License |
| 23 |
;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 |
|
| 25 |
;;; Commentary: |
| 26 |
|
| 27 |
;; skk-dcomp-multiple-get-candidates() |
| 28 |
;; => skk-comp-get-candidate(first) |
| 29 |
;; => when first setq skk-comp-first t |
| 30 |
;; eval skk-completion-prog-list |
| 31 |
;; setq skk-comp-first nil |
| 32 |
|
| 33 |
;; (defcustom skk-completion-prog-list '((skk-comp-by-history) |
| 34 |
;; (skk-comp-from-jisyo skk-jisyo) |
| 35 |
;; (skk-look-completion)) |
| 36 |
|
| 37 |
;;; How to use: |
| 38 |
|
| 39 |
;; (require 'skk-pre-henkan) |
| 40 |
|
| 41 |
;;; Code: |
| 42 |
|
| 43 |
(setq skk-dcomp-activate nil) |
| 44 |
(setq skk-completion-prog-list '((skk-pre-henkan))) |
| 45 |
|
| 46 |
;; internal variable. |
| 47 |
(defvar skk-pre-henkan-candidates nil) |
| 48 |
|
| 49 |
(defun skk-pre-henkan () |
| 50 |
"$B%j%9%H(B `skk-completion-prog-list' $B$NMWAG$H$7$F;HMQ(B." |
| 51 |
;; `skk-pre-henkan-candidates' $B$N(B car $B$rJV$9!#(B`skk-pre-henkan-candidates' $B$O=L$`!#(B |
| 52 |
;; `skk-comp-first' $B$,(B t $B$J$i!"?7$?$J(B `skk-pre-henkan-candidates' $B$r:n$k!#(B |
| 53 |
(unless (string= skk-comp-key "") |
| 54 |
(when skk-comp-first |
| 55 |
(setq skk-pre-henkan-candidates (skk-pre-henkan-make-candidates))) |
| 56 |
(prog1 |
| 57 |
(car (skk-treat-strip-note-from-word (car skk-pre-henkan-candidates))) |
| 58 |
(setq skk-pre-henkan-candidates (cdr skk-pre-henkan-candidates))))) |
| 59 |
|
| 60 |
(defun skk-pre-henkan-make-candidates () |
| 61 |
"`skk-comp-key' $B$r%-!<!J@hF,0lCW!K$H$7$F!"8uJd$N%j%9%H$rJV$9(B." |
| 62 |
(let ((list-jisyo '(skk-jisyo skk-large-jisyo)) |
| 63 |
;; skk-comp-key $B$O(B buffer-local $B$J$N$G(B with-current-buffer() $BFb$G$O(B nil $B$K$J$k!#(B |
| 64 |
(key (format "^%s.* /" (car (split-string skk-comp-key "*" t)))) |
| 65 |
(i 0) |
| 66 |
candidates) |
| 67 |
(dolist (jisyo list-jisyo) |
| 68 |
(with-current-buffer (skk-get-jisyo-buffer (symbol-value jisyo) 'nomsg) |
| 69 |
(goto-char skk-okuri-nasi-min) |
| 70 |
(while (and (re-search-forward key nil t) |
| 71 |
(< i 100)) |
| 72 |
(setq candidates (concat candidates |
| 73 |
(buffer-substring-no-properties (point) |
| 74 |
(progn (end-of-line) |
| 75 |
(point))))) |
| 76 |
(setq i (1+ i))))) |
| 77 |
(when candidates |
| 78 |
(split-string candidates "/" t)))) |
| 79 |
|
| 80 |
(provide 'skk-pre-henkan) |
| 81 |
|
| 82 |
;; Local Variables: |
| 83 |
;; indent-tabs-mode: nil |
| 84 |
;; End: |
| 85 |
|
| 86 |
;;; skk-pre-henkan.el ends here |