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

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

[elpa] externals/pyim 8d5879ee9d 1/3: pyim-cloudim: 'pinyin -> 'quanpin,


From: ELPA Syncer
Subject: [elpa] externals/pyim 8d5879ee9d 1/3: pyim-cloudim: 'pinyin -> 'quanpin, input-method -> scheme-name.
Date: Sun, 8 May 2022 22:57:44 -0400 (EDT)

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

    pyim-cloudim: 'pinyin -> 'quanpin, input-method -> scheme-name.
    
            * pyim-cloudim.el (pyim-cloudim, pyim-cloudim:baidu)
            (pyim-cloudim:google): 'pinyin -> 'quanpin, input-method -> 
scheme-name.
    
            * pyim-candidates.el (pyim-candidates-create:quanpin): 'pinyin -> 
'quanpin.
            (pyim-candidates-cloud-search): input-method -> scheme-name.
    
        pyim-tests: 'pinyin -> 'quanpin.
---
 pyim-candidates.el  |  6 +++---
 pyim-cloudim.el     | 18 +++++++++---------
 tests/pyim-tests.el | 18 +++++++++---------
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/pyim-candidates.el b/pyim-candidates.el
index 2a17d1d275..1c485d8b8b 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -158,7 +158,7 @@ IMOBJS 获得候选词条。"
             pyim-candidates
           ;; NOTE: 让第一个词保持不变是不是合理,有待进一步的观察。
           `(,(car pyim-candidates)
-            ,@(pyim-candidates-cloud-search str 'pinyin)
+            ,@(pyim-candidates-cloud-search str 'quanpin)
             ,@(pyim-candidates-search-buffer
                (pyim-cregexp-build str 3 t))
             ,@(cdr pyim-candidates))))
@@ -180,10 +180,10 @@ IMOBJS 获得候选词条。"
       (append (pyim-subconcat (nreverse output) "")
               candidates))))
 
-(defun pyim-candidates-cloud-search (string input-method)
+(defun pyim-candidates-cloud-search (string scheme-name)
   "云搜索 STRING, 返回候选词条列表."
   (ignore-errors
-    (funcall pyim-candidates-cloud-search-function string input-method)))
+    (funcall pyim-candidates-cloud-search-function string scheme-name)))
 
 (defun pyim-candidates-search-buffer (regexp)
   "在当前 buffer 中使用 REGEXP 搜索词条。"
diff --git a/pyim-cloudim.el b/pyim-cloudim.el
index 59498c5b2b..49193e2ec0 100644
--- a/pyim-cloudim.el
+++ b/pyim-cloudim.el
@@ -42,19 +42,19 @@
           (const :tag "Use baidu cloud input method." baidu)
           (const :tag "Use google cloud input method." google)))
 
-(defun pyim-cloudim (string input-method)
-  "使用云 INPUT-METHOD 输入法引擎搜索 STRING 获取词条列表.
+(defun pyim-cloudim (string scheme-name)
+  "使用云输入法引擎搜索 STRING 获取词条列表.
 云输入法由 `pyim-cloudim' 设置。"
   (when (and pyim-cloudim (symbolp pyim-cloudim))
     (let ((func (intern (format "pyim-cloudim:%s" pyim-cloudim))))
       (when (functionp func)
-        (funcall func string input-method)))))
+        (funcall func string scheme-name)))))
 
 (setq pyim-candidates-cloud-search-function #'pyim-cloudim)
 
-(defun pyim-cloudim:baidu (string input-method)
-  "使用 baidu 云 INPUT-METHOD 输入法引擎搜索 STRING, 获取词条列表。"
-  (when (and (equal input-method 'pinyin)
+(defun pyim-cloudim:baidu (string scheme-name)
+  "使用 baidu 云输入法引擎搜索 STRING, 获取词条列表。"
+  (when (and (equal scheme-name 'quanpin)
              (functionp 'json-parse-buffer))
     (with-current-buffer (url-retrieve-synchronously
                           (format "https://olime.baidu.com/py?py=%s"; string)
@@ -69,9 +69,9 @@
   (let ((data (funcall 'json-parse-buffer)))
     (list (elt (elt (elt (gethash "0" data) 0) 0) 0))))
 
-(defun pyim-cloudim:google (string input-method)
-  "使用 google 云 INPUT-METHOD 输入法引擎搜索 STRING, 获取词条列表。"
-  (when (and (eq input-method 'pinyin)
+(defun pyim-cloudim:google (string scheme-name)
+  "使用 google 云输入法引擎搜索 STRING, 获取词条列表。"
+  (when (and (eq scheme-name 'quanpin)
              (functionp 'json-parse-buffer))
     (with-current-buffer (url-retrieve-synchronously
                           (format 
"https://www.google.cn/inputtools/request?ime=pinyin&text=%s"; string)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index ead64cebce..5a99628b2e 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -403,13 +403,13 @@
   (let ((pyim-candidates-cloud-search-function
          (lambda (x y)
            (list x y "b"))))
-    (should (equal (pyim-candidates-cloud-search "a" 'pinyin) '("a" pinyin 
"b"))))
+    (should (equal (pyim-candidates-cloud-search "a" 'quanpin) '("a" pinyin 
"b"))))
 
   (let ((pyim-candidates-cloud-search-function nil))
-    (should (not (pyim-candidates-cloud-search "a" 'pinyin))))
+    (should (not (pyim-candidates-cloud-search "a" 'quanpin))))
 
   (let ((pyim-candidates-cloud-search-function "xxx"))
-    (should (not (pyim-candidates-cloud-search "a" 'pinyin)))))
+    (should (not (pyim-candidates-cloud-search "a" 'quanpin)))))
 
 ;; ** pyim-cstring 相关单元测试
 (ert-deftest pyim-tests-pyim-cstring-partition ()
@@ -969,20 +969,20 @@ Transfer-Encoding: chunked
       (should (equal (pyim-cloudim-parse-google-buffer) '("你好"))))
 
     (when (not noninteractive)
-      (should (equal (pyim-cloudim:baidu "nihao" 'pinyin) '("你好")))
-      (should (equal (pyim-cloudim:google "nihao" 'pinyin) '("你好")))
+      (should (equal (pyim-cloudim:baidu "nihao" 'quanpin) '("你好")))
+      (should (equal (pyim-cloudim:google "nihao" 'quanpin) '("你好")))
 
       (let ((pyim-cloudim 'baidu))
-        (should (equal (pyim-cloudim "nihao" 'pinyin) '("你好"))))
+        (should (equal (pyim-cloudim "nihao" 'quanpin) '("你好"))))
 
       (let ((pyim-cloudim 'google))
-        (should (equal (pyim-cloudim "nihao" 'pinyin) '("你好"))))
+        (should (equal (pyim-cloudim "nihao" 'quanpin) '("你好"))))
 
       (let ((pyim-cloudim 'xxx))
-        (should (not (pyim-cloudim "nihao" 'pinyin))))
+        (should (not (pyim-cloudim "nihao" 'quanpin))))
 
       (let ((pyim-cloudim nil))
-        (should (not (pyim-cloudim "nihao" 'pinyin)))))))
+        (should (not (pyim-cloudim "nihao" 'quanpin)))))))
 
 (ert-run-tests-batch-and-exit)
 ;; * Footer



reply via email to

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