emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim f2b43ce74b: pyim-candidates-create-delay add orig-


From: ELPA Syncer
Subject: [elpa] externals/pyim f2b43ce74b: pyim-candidates-create-delay add orig-candidates arg.
Date: Mon, 6 Jun 2022 21:57:47 -0400 (EDT)

branch: externals/pyim
commit f2b43ce74be5238af6452f46e77af2131c068d87
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    pyim-candidates-create-delay add orig-candidates arg.
    
            * pyim-process.el (pyim-process-get-candidates-delay-1): Update.
    
            * pyim-candidates.el (pyim-candidates-create-delay): Add 
orig-candidates arg.
---
 pyim-candidates.el | 18 +++++++++---------
 pyim-liberime.el   |  2 +-
 pyim-process.el    |  5 ++++-
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/pyim-candidates.el b/pyim-candidates.el
index e3133afe25..da6f0b2b49 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -280,7 +280,7 @@
                                 (pyim-pymap-py2cchar-get pinyin))))))
     (cl-subseq chars 0 num)))
 
-(cl-defgeneric pyim-candidates-create-delay (imobjs scheme)
+(cl-defgeneric pyim-candidates-create-delay (imobjs scheme orig-candidates)
   "按照 SCHEME, 使用延迟的方式从 IMOBJS 获得候选词条。
 
 如果用户输入等待时间超过某个阈值时,输入法就会调用这个函数来获取额
@@ -289,23 +289,23 @@
 2. 这个函数运行有时间限制,运行超过某个时间后,无论有没有结果,必须结束。
 3. 这个函数需要探测用户是否输入,如果用户开始输入,这个函数运行必须结束。")
 
-(cl-defmethod pyim-candidates-create-delay (_imobjs _scheme)
+(cl-defmethod pyim-candidates-create-delay (_imobjs _scheme orig-candidates)
   "按照 SCHEME, 使用延迟的方式从 IMOBJS 获得候选词条。"
-  nil)
+  orig-candidates)
 
-(cl-defmethod pyim-candidates-create-delay (imobjs (scheme 
pyim-scheme-quanpin))
+(cl-defmethod pyim-candidates-create-delay (imobjs (scheme 
pyim-scheme-quanpin) orig-candidates)
   "按照 SCHEME, 用延迟的方式从 IMOBJS 获得候选词条,用于全拼输入法。"
   ;; 构建一个搜索中文的正则表达式, 然后使用这个正则表达式在当前 buffer 中搜
   ;; 索词条。
   (let ((str (string-join (pyim-codes-create (car imobjs) scheme))))
     (if (< (length str) 1)
-        pyim-candidates
+        orig-candidates
       ;; NOTE: 让第一个词保持不变是不是合理,有待进一步的观察。
-      `(,(car pyim-candidates)
+      `(,(car orig-candidates)
         ,@(pyim-candidates-cloud-search str scheme)
         ,@(pyim-candidates-search-buffer
            (pyim-cregexp-create str scheme 3 t))
-        ,@(cdr pyim-candidates)))))
+        ,@(cdr orig-candidates)))))
 
 (cl-defgeneric pyim-candidates-cloud-search (string scheme)
   "云搜索 STRING, 返回候选词条列表.")
@@ -336,11 +336,11 @@
                       (> (or (gethash a counts) 0)
                          (or (gethash b counts) 0))))))))
 
-(cl-defmethod pyim-candidates-create-delay (imobjs (_scheme 
pyim-scheme-shuangpin))
+(cl-defmethod pyim-candidates-create-delay (imobjs (_scheme 
pyim-scheme-shuangpin) orig-candidates)
   "按照 SCHEME, 用延迟的方式从 IMOBJS 获得候选词条,用于双拼输入法。"
   ;; 注意:pyim 支持的双拼输入法,内部使用全拼的 imobjs, 所以这里直接调用全拼的
   ;; `pyim-candidates-create-delay' 方法来处理 imobjs。
-  (cl-call-next-method imobjs (pyim-scheme-get 'quanpin)))
+  (cl-call-next-method imobjs (pyim-scheme-get 'quanpin) orig-candidates))
 
 ;; * Footer
 (provide 'pyim-candidates)
diff --git a/pyim-liberime.el b/pyim-liberime.el
index 1da74f13b6..efd6faaaa2 100644
--- a/pyim-liberime.el
+++ b/pyim-liberime.el
@@ -141,7 +141,7 @@
          (words (liberime-search s (* pyim-page-length 2))))
     words))
 
-(cl-defmethod pyim-candidates-create-delay (imobjs (scheme pyim-scheme-rime))
+(cl-defmethod pyim-candidates-create-delay (imobjs (scheme pyim-scheme-rime) 
_orig-candidates)
   "适用于 rime 的 `pyim-candidates-create-delay' 方法。"
   (let* ((code (car (pyim-codes-create (car imobjs) scheme)))
          (code-prefix (pyim-scheme-code-prefix scheme))
diff --git a/pyim-process.el b/pyim-process.el
index 11c921fcf2..4d6ee630f8 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -369,7 +369,10 @@ entered (nihaom) 的第一个候选词。
 (defun pyim-process-get-candidates-delay-1 ()
   "Function used by `pyim-process-get-candidates-delay-timer'"
   (let* ((scheme (pyim-scheme-current))
-         (words (delete-dups (pyim-candidates-create-delay pyim-imobjs 
scheme))))
+         (words (delete-dups
+                 (pyim-candidates-create-delay
+                  pyim-imobjs scheme
+                  pyim-candidates))))
     (when words
       (setq pyim-candidates words)
       (pyim-process-ui-refresh))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]