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

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

[elpa] externals/pyim 708e8de 1/2: Remove pyim-dcache-code-split again.


From: ELPA Syncer
Subject: [elpa] externals/pyim 708e8de 1/2: Remove pyim-dcache-code-split again.
Date: Tue, 14 Dec 2021 11:57:25 -0500 (EST)

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

    Remove pyim-dcache-code-split again.
    
        * pyim-dcache.el (pyim-dcache-code-split): removed again.
    
        * pyim-cstring.el (pyim-cstring-to-xingma): Do not use 
pyim-dcache-code-split.
---
 pyim-cstring.el | 16 ++++++----------
 pyim-dcache.el  | 19 -------------------
 2 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/pyim-cstring.el b/pyim-cstring.el
index f6d170d..b82444d 100644
--- a/pyim-cstring.el
+++ b/pyim-cstring.el
@@ -275,16 +275,12 @@ code-prefix)。当RETURN-LIST 设置为 t 时,返回一个 code list。"
   (when (string-match-p "^\\cc+\\'" string)
     (let* ((prefix (pyim-scheme-get-option scheme-name :code-prefix))
            (func (intern (concat "pyim-cstring-to-xingma:" (symbol-name 
scheme-name))))
-           (dcache-codes (cl-remove-if-not
-                          (lambda (x)
-                            (equal (nth 0 (pyim-dcache-code-split x))
-                                   prefix))
-                          (sort (cl-copy-list (pyim-dcache-call-api 
'search-word-code string))
-                                (lambda (a b) (> (length a) (length b))))))
-           (codes (or (mapcar
-                       (lambda (x)
-                         (nth 1 (pyim-dcache-code-split x)))
-                       dcache-codes)
+           (dcache-codes (mapcar (lambda (x)
+                                   (when (string-prefix-p prefix x)
+                                     (string-remove-prefix prefix x)))
+                                 (sort (cl-copy-list (pyim-dcache-call-api 
'search-word-code string))
+                                       (lambda (a b) (> (length a) (length 
b))))))
+           (codes (or (remove nil dcache-codes)
                       (and (functionp func)
                            (funcall func string scheme-name)))))
       (when codes
diff --git a/pyim-dcache.el b/pyim-dcache.el
index d34b541..0a43521 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -272,25 +272,6 @@ code 对应的中文词条了."
   `(,@(pyim-dcache-call-api 'get code from)
     ,@(pyim-pymap-py2cchar-get code t t)))
 
-;; ** 分割 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)
 



reply via email to

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