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

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

[elpa] externals/pyim 73cb9a9: Fix warn.


From: ELPA Syncer
Subject: [elpa] externals/pyim 73cb9a9: Fix warn.
Date: Tue, 25 May 2021 21:57:10 -0400 (EDT)

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

    Fix warn.
    
        * pyim-cstring.el (pyim-dcache, pyim-scheme, pyim-pymap): require.
    
        * pyim-dcache.el (pyim-dcache-code-split): Move from pyim-dhashcache.el
    
        * pyim-dhashcache.el (pyim-dhashcache-upgrade-icode2word): value -> 
_value.
        (pyim-dcache-code-split): Move to pyim-dcache.el.
    
        * pyim.el (pyim-cstring-to-code-criteria): Fix warn.
        (pyim-create-pyim-word): removed class var.
        (pyim-search-word-code): code -> codes.
---
 pyim-cstring.el    |  3 +++
 pyim-dcache.el     | 19 +++++++++++++++++++
 pyim-dhashcache.el | 20 +-------------------
 pyim.el            |  6 ++++--
 4 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/pyim-cstring.el b/pyim-cstring.el
index 2d5a82c..11182e3 100644
--- a/pyim-cstring.el
+++ b/pyim-cstring.el
@@ -29,6 +29,9 @@
 ;; * 代码                                                           :code:
 (require 'cl-lib)
 (require 'pyim-common)
+(require 'pyim-dcache)
+(require 'pyim-scheme)
+(require 'pyim-pymap)
 
 (defgroup pyim-cstring nil
   "Chinese string tools for pyim."
diff --git a/pyim-dcache.el b/pyim-dcache.el
index 3dbbb9c..a03c9ac 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -314,6 +314,25 @@ scheme 中的 :code-prefix-history 信息。"
 code 对应的中文词条了."
   (pyim-dcache-call-api 'get code from))
 
+;; ** 分割 code
+(defun pyim-dcache-code-split (code)
+  "将 CODE 分成 code-prefix 和 rest code."
+  (cond
+   ;; 处理 nil
+   ((not code) nil)
+   ;; 兼容性代码:旧版本的 pyim 使用一个标点符号作为 code-prefix
+   ((pyim-string-match-p "^[[:punct:]]" code)
+    (list (substring code 0 1) (substring code 1)))
+   ;; 拼音输入法不使用 code-prefix, 并且包含 -
+   ((pyim-string-match-p "-" code)
+    (list "" code))
+   ((not (pyim-string-match-p "[[:punct:]]" code))
+    (list "" code))
+   ;; 新 code-prefix 使用类似 "wubi/" 的格式。
+   (t (let ((x (split-string code "/")))
+        (list (concat (nth 0 x) "/")
+              (nth 1 x))))))
+
 ;; * Footer
 (provide 'pyim-dcache)
 
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 0d0c7d6..8bd57b9 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -59,24 +59,6 @@
           (> (or (gethash a pyim-dhashcache-iword2count) 0)
              (or (gethash b pyim-dhashcache-iword2count) 0)))))
 
-(defun pyim-dcache-code-split (code)
-  "将 CODE 分成 code-prefix 和 rest code."
-  (cond
-   ;; 处理 nil
-   ((not code) nil)
-   ;; 兼容性代码:旧版本的 pyim 使用一个标点符号作为 code-prefix
-   ((pyim-string-match-p "^[[:punct:]]" code)
-    (list (substring code 0 1) (substring code 1)))
-   ;; 拼音输入法不使用 code-prefix, 并且包含 -
-   ((pyim-string-match-p "-" code)
-    (list "" code))
-   ((not (pyim-string-match-p "[[:punct:]]" code))
-    (list "" code))
-   ;; 新 code-prefix 使用类似 "wubi/" 的格式。
-   (t (let ((x (split-string code "/")))
-        (list (concat (nth 0 x) "/")
-              (nth 1 x))))))
-
 (defun pyim-dhashcache-get-shortcode (code)
   "获取一个 CODE 的所有简写.
 
@@ -341,7 +323,7 @@ code 对应的中文词条了。
             (new-prefix (cdr ruler)))
         (dolist (old-prefix old-prefix-list)
           (maphash
-           (lambda (key value)
+           (lambda (key _value)
              (when (string-prefix-p old-prefix key)
                (let* ((key-words (gethash key pyim-dhashcache-icode2word))
                       (new-key (concat new-prefix (string-remove-prefix 
old-prefix key)))
diff --git a/pyim.el b/pyim.el
index 396207a..ce11b01 100644
--- a/pyim.el
+++ b/pyim.el
@@ -173,6 +173,9 @@ Tip: 用户也可以利用 `pyim-outcome-trigger-function-default' 函数
    ;;pyim-english-input-switch-functions
    describe-current-input-method-function))
 
+;; Fix warn
+(defvar pyim-cstring-to-code-criteria)
+
 ;; ** pyim 输入法定义
 (defun pyim-input-method (key)
   "得到需要插入到 buffer 的字符串, 并将其插入到待输入 buffer.
@@ -465,7 +468,6 @@ BUG:拼音无法有效地处理多音字。"
     ;; 记录最近创建的词条,用于快速删词功能。
     (setq pyim-last-created-word word)
     (let* ((scheme-name (pyim-scheme-name))
-           (class (pyim-scheme-get-option scheme-name :class))
            (code-prefix (pyim-scheme-get-option scheme-name :code-prefix))
            (codes (pyim-cstring-to-codes word scheme-name 
pyim-cstring-to-code-criteria)))
       ;; 保存对应词条的词频
@@ -853,7 +855,7 @@ FILE 的格式与 `pyim-dcache-export' 生成的文件格式相同,
   (interactive)
   (when (region-active-p)
     (let* ((string (buffer-substring-no-properties (region-beginning) 
(region-end)))
-           code)
+           codes)
       (if (not (string-match-p "^\\cc+\\'" string))
           (error "PYIM: 不是纯中文字符串。")
         (setq codes (pyim-cstring-to-codes string pyim-default-scheme))



reply via email to

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