Debian Codegraph @

nicola/skk-nicola-dcomp.el

raw
1 ;;; skk-nicola-dcomp.el --- skk-dcomp support for NICOLA-DDSKK
2
3 ;; Copyright (C) 2001 Tetsuo Tsukamoto <[email protected]>
4
5 ;; Author: Tetsuo Tsukamoto <[email protected]>
6 ;; Keywords: hardware, japanese, mule, input method
7
8 ;; This file is part of Daredevil SKK.
9
10 ;; This program is free software: you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation, either version 3 of
13 ;; the License, or (at your option) any later version.
14
15 ;; This program is distributed in the hope that it will be
16 ;; useful, but WITHOUT ANY WARRANTY; without even the implied
17 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 ;; PURPOSE. See the GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;;; Code:
26
27 (eval-when-compile
28 (require 'cl-lib)
29 (require 'skk-macs))
30
31 ;;;###autoload
32 (add-hook 'skk-mode-hook
33 #'(lambda ()
34 (when (and (featurep 'skk-dcomp)
35 (featurep 'skk-nicola))
36 (require 'skk-nicola-dcomp))))
37
38 (defadvice skk-nicola-self-insert-lshift-1 (around skk-nicola-dcomp activate)
39 (cond
40 ((or (not skk-dcomp-activate)
41 skk-hint-inhibit-dcomp
42 (eq skk-henkan-mode 'active))
43 ad-do-it)
44 (t
45 (let (pos)
46 (cond
47 ((or (eq skk-henkan-mode 'active)
48 (skk-get-prefix skk-current-rule-tree)
49 (not skk-comp-stack))
50 (skk-set-marker skk-dcomp-start-point nil)
51 (skk-set-marker skk-dcomp-end-point nil))
52 ((skk-dcomp-marked-p)
53 (skk-dcomp-face-off)
54 (unless (member (this-command-keys) skk-dcomp-keep-completion-keys)
55 ;;
56 (if (eq this-command 'skk-nicola-self-insert-rshift)
57 (setq pos (point))
58 (ignore-errors
59 (delete-region skk-dcomp-start-point skk-dcomp-end-point))))))
60 ad-do-it
61 ;;
62 (when (and (eq this-command 'skk-nicola-self-insert-rshift)
63 (eq skk-henkan-mode 'on))
64 (when (and (markerp skk-dcomp-start-point)
65 (marker-position skk-dcomp-start-point)
66 pos
67 (< (marker-position skk-dcomp-start-point) pos))
68 (delete-region skk-dcomp-start-point pos))
69 (when (and (markerp skk-dcomp-end-point)
70 (marker-position skk-dcomp-end-point)
71 (< (point) (marker-position skk-dcomp-end-point)))
72 (delete-region skk-dcomp-end-point (point))))
73 ;;
74 (skk-dcomp-do-completion (point))))))
75
76 (provide 'skk-nicola-dcomp)
77
78 ;; Local Variables:
79 ;; indent-tabs-mode: nil
80 ;; End:
81
82 ;;; skk-nicola-dcomp.el ends here