-
Notifications
You must be signed in to change notification settings - Fork 42
/
skk-decor.el
136 lines (111 loc) · 5.27 KB
/
skk-decor.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
;;; skk-decor.el --- decorate the candidate for SKK -*- mode: emacs-lisp; coding: iso-2022-jp -*-
;; Copyright (C) 2020 Tsuyoshi Kitamoto <[email protected]>
;; Author: 2020 Tsuyoshi Kitamoto <[email protected]>
;; Maintainer: SKK Development Team
;; URL: https://github.com/skk-dev/ddskk
;; Keywords: japanese, mule, input method
;; This file is part of Daredevil SKK.
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of
;; the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be
;; useful, but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE. See the GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; skk-insert()
;; |- skk-start-henkan()
;; |- skk-henkan()
;; |- skk-henkan-1()
;; |- skk-insert-new-word()
;; | |- skk-henkan-face-on()
;; | |- skk-face-on() @ skk-macs.el
;; |- skk-henkan-show-candidates()
;; |- skk-henkan-show-candidate-subr()
;; |- skk-henkan-candidate-list()
;; |- skk-treat-candidate-appearance()
;; $BJ8=q%P%C%U%!$N"'%b!<%I$K$*$1$kJQ498uJd$NI=<($rAu>~$9$k$K$O(B
;; skk-henkan-face $B$r@_Dj$7$^$9!#EvA3$G$9$,!"J8=q%P%C%U%!$NJQ498uJd$K$7(B
;; $B$+:nMQ$7$^$;$s!#(B
;; $B%$%s%i%$%s!"(Btooltip $BKt$O(B $B8uJd%P%C%U%!$NJQ498uJd$NI=<($rAu>~$9$k$K$O(B
;; skk-treat-candidate-appearance-function $B$r@_Dj$7$^$9!#(B
;; $B$7$+$7!"(Bskk-treat-candidate-appearance-function $B$N@_Dj$O!"(B
;; o $BJ8=q%P%C%U%!$N"'%b!<%I$K$*$1$kJQ498uJd$NI=<($K$b1F6A(B
;; $B!J(Bskk-henkan-face $B$h$j$bM%@h$7$FE,MQ$5$l$k!K(B
;; o $B%$%s%i%$%s!"(Btooltip $B5Z$S(B $B8uJd%P%C%U%!$N#3$D$9$Y$F$K1F6A(B
;; $B$H$$$&8z2L$,$"$j$^$9!#(B
;; $BNc$($P!"8uJd%P%C%U%!$NJQ498uJd$NI=<($rBg$-$/$7$h$&$H;W$C$?$H$-!"(B
;; skk-henkan-face $B$G$O8uJd%P%C%U%!$NAu>~$rJQ$($k$3$H$,$G$-$J$$$?$a!"(B
;; skk-treat-candidate-appearance-function $B$r;HMQ$7$F%5%$%:$NBg$-$J(B
;; face $B$rE,MQ$5$;$^$9!#$7$+$7!"(Bskk-treat-candidate-appearance-function $B$O(B
;; $BJ8=q%P%C%U%!$NAu>~$K$b1F6A$,5Z$V$3$H$+$i!"I=<($,%,%?%,%?$K$J$C$F$7$^(B
;; $B$$$^$9!#(B
;; $B$=$3$G!"!VJ8=q%P%C%U%!$K1F6A$;$:!"8uJd%P%C%U%!$K8B$C$?I=<($NAu>~!W$r(B
;; $B$7$?$$J}$N$?$a$K:n$C$F$_$^$7$?!#(B
;;; Howto:
;; (setq skk-inline-show-vertically-decor
;; #'skk-inline-show-vertically-decor-func)
;; (setq skk-tooltip-show-at-point-decor
;; #'skk-tooltip-show-at-point-decor-func)
;; (setq skk-henkan-show-candidates-buffer-decor
;; #'skk-henkan-show-candidates-buffer-decor-func)
;;; Code:
(require 'skk)
;; skk-show-inline 'vertical $B$K8B$C$F%U%'%$%9$r:nMQ$5$;$k(B.
;;;###autoload
(defun skk-inline-show-vertically-decor-func (string)
(let* ((sp (reverse (split-string string "\n")))
(rest (car sp))
(cands (reverse (cdr sp))))
(concat (mapconcat
(lambda (x)
(let* ((d (skk-treat-strip-note-from-word (substring x 2)))
(c (car d))
(n (cdr d)))
(concat (substring x 0 2)
(propertize c 'face 'skk-inline-show-vertically-cand-face)
(when n
(concat " " (propertize n 'face 'skk-inline-show-vertically-anno-face))))))
cands "\n")
"\n" rest)))
;; tooltip $B$K8B$C$F%U%'%$%9$r:nMQ$5$;$k(B
;;;###autoload
(defun skk-tooltip-show-at-point-decor-func (text)
(let* ((sp (reverse (split-string text "\n")))
(rest (car sp))
(cands (reverse (cdr sp))))
(concat (mapconcat
(lambda (x)
(let* ((d (skk-treat-strip-note-from-word (substring x 2)))
(c (car d))
(n (cdr d)))
(concat (substring x 0 2)
(propertize c 'face 'skk-tooltip-show-at-point-cand-face)
(when n
(concat " " (propertize n 'face 'skk-tooltip-show-at-point-anno-face))))))
cands "\n")
"\n" rest)))
;; $B8uJd%P%C%U%!$K8B$C$F%U%'%$%9$r:nMQ$5$;$k(B
;;;###autoload
(defun skk-henkan-show-candidates-buffer-decor-func (str)
(let* ((cand (reverse (split-string str " " t)))
(nokori (car cand))
(cand (reverse (cdr cand))))
(concat (mapconcat (lambda (x)
(let* ((d (skk-treat-strip-note-from-word (substring x 2)))
(c (car d))
(n (cdr d)))
(concat (substring x 0 2) ; `A:'
(propertize c 'face 'skk-henkan-show-candidates-buffer-cand-face)
(when n
(concat " " (propertize n 'face 'skk-henkan-show-candidates-buffer-anno-face))))))
cand " ")
" " nokori)))
(provide 'skk-decor)
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
;;; skk-decor.el ends here