branch: externals/pyim commit 1e0834c456938afccbd0380e79b5cf22d3e82fae Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Revert "cl-defgeneric pyim-dcache-delete-word" This reverts commit 64d43a9a52d85c1cb17e65ec28adf37414b01c32. --- pyim-dcache.el | 5 +++-- pyim-dhashcache.el | 3 +-- pyim-dregcache.el | 3 +-- tests/pyim-tests.el | 7 +++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pyim-dcache.el b/pyim-dcache.el index 4011eef215..79e0236bab 100644 --- a/pyim-dcache.el +++ b/pyim-dcache.el @@ -261,8 +261,9 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式" (pyim-dcache-call-api 'upgrade-icode2word)) ;; ** Dcache 删词功能 -(cl-defgeneric pyim-dcache-delete-word (word) - "将中文词条 WORD 从个人词库中删除") +(defun pyim-dcache-delete-word (word) + "将中文词条 WORD 从个人词库中删除" + (pyim-dcache-call-api 'delete-word word)) ;; ** Dcache 检索功能 (defun pyim-dcache-get (code &optional from) diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el index 40cd36423f..db2b0a8ad6 100644 --- a/pyim-dhashcache.el +++ b/pyim-dhashcache.el @@ -630,8 +630,7 @@ code 对应的中文词条了。 (lambda (_) (pyim-dcache-reload-variable pyim-dhashcache-iword2priority))))) -(cl-defmethod pyim-dcache-delete-word - (word &context (pyim-dcache-backend (eql pyim-dhashcache))) +(defun pyim-dhashcache-delete-word (word) "将中文词条 WORD 从个人词库中删除" (maphash (lambda (key value) diff --git a/pyim-dregcache.el b/pyim-dregcache.el index 638d5adb28..4686b074ed 100644 --- a/pyim-dregcache.el +++ b/pyim-dregcache.el @@ -369,8 +369,7 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码. (unless (equal orig-value new-value) (puthash word new-value pyim-dregcache-iword2count)))) -(cl-defmethod pyim-dcache-delete-word - (word &context (pyim-dcache-backend (eql pyim-dregcache))) +(defun pyim-dregcache-delete-word (word) "将中文词条 WORD 从个人词库中删除." (with-temp-buffer (insert pyim-dregcache-icode2word) diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index 136a864011..3b366d296b 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -1125,8 +1125,7 @@ zuo-zuo-you-mang 作作有芒") '("你" "呢"))))) (ert-deftest pyim-tests-pyim-dhashcache-put/delete () - (let ((pyim-dcache-backend 'pyim-dhashcache) - (pyim-dhashcache-icode2word (make-hash-table :test #'equal))) + (let ((pyim-dhashcache-icode2word (make-hash-table :test #'equal))) (puthash "ni-hao" '("你好" "呢耗") pyim-dhashcache-icode2word) (pyim-dhashcache-put pyim-dhashcache-icode2word "ni-hao" @@ -1136,9 +1135,9 @@ zuo-zuo-you-mang 作作有芒") (list "你不好")) (should (equal (gethash "ni-hao" pyim-dhashcache-icode2word) '("呢毫" "你好" "呢耗"))) (should (equal (gethash "ni-bu-hao" pyim-dhashcache-icode2word) '("你不好"))) - (pyim-dcache-delete-word "你不好") + (pyim-dhashcache-delete-word "你不好") (should (equal (gethash "ni-bu-hao" pyim-dhashcache-icode2word) nil)) - (pyim-dcache-delete-word "你好") + (pyim-dhashcache-delete-word "你好") (should (equal (gethash "ni-hao" pyim-dhashcache-icode2word) '("呢毫" "呢耗"))))) (ert-deftest pyim-tests-pyim-dhashcache-update-iword2count ()