[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim abcaad950e 1/3: Add pyim-candidates-sort and use i
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim abcaad950e 1/3: Add pyim-candidates-sort and use it. |
Date: |
Fri, 31 Dec 2021 22:57:45 -0500 (EST) |
branch: externals/pyim
commit abcaad950e33bbba8aabaf41273a430e6015f86b
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
Add pyim-candidates-sort and use it.
* pyim-candidates.el (pyim-candidates-sort): New function.
(pyim-candidates-create:xingma, pyim-candidates-create-quanpin):
Use pyim-candidates-sort.
---
pyim-candidates.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/pyim-candidates.el b/pyim-candidates.el
index f9e1fac446..2f28e8888c 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -56,6 +56,10 @@
'(pyim-candidates pyim-candidate-position))
;; ** 获取备选词列表
+(defun pyim-candidates-sort (candidates)
+ "对 CANDIDATES 进行排序。"
+ (pyim-dcache-call-api 'sort-words candidates))
+
(defun pyim-candidates-create (imobjs scheme-name &optional async)
"按照 SCHEME-NAME 对应的输入法方案, 从输入法内部对象列表:
IMOBJS 获得候选词条。"
@@ -105,8 +109,8 @@ IMOBJS 获得候选词条。"
(mapcar (lambda (word)
(concat prefix word))
`(,first-word
- ,@(pyim-dcache-call-api 'sort-words chars)
- ,@(pyim-dcache-call-api 'sort-words all-words)))))
+ ,@(pyim-candidates-sort chars)
+ ,@(pyim-candidates-sort all-words)))))
(setq output (remove "" (or output (list prefix))))
(setq result (append result output))))
(when (car result)
@@ -248,8 +252,7 @@ IMOBJS 获得候选词条。"
;; comment.
(setq personal-words
`(,(car personal-words)
- ,@(pyim-dcache-call-api
- 'sort-words (cdr personal-words))))
+ ,@(pyim-candidates-sort (cdr personal-words))))
;; 调试输出
(when pyim-debug