branch: externals/pyim commit 20a708e9b283f0e5ffa907322ccbeebebf70b122 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Use (&context ((pyim-dcache-backend) (eql xxx))) --- pyim-dhashcache.el | 24 ++++++++++++------------ pyim-dregcache.el | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el index b86cf46e57..1a4250ec56 100644 --- a/pyim-dhashcache.el +++ b/pyim-dhashcache.el @@ -81,7 +81,7 @@ ;; ** 初始化 dhashcache 相关函数 (cl-defmethod pyim-dcache-init-variables - (&context (pyim-dcache-backend (eql pyim-dhashcache))) + (&context ((pyim-dcache-backend) (eql pyim-dhashcache))) "初始化 dcache 缓存相关变量." (when (and (not pyim-dhashcache-icode2word) pyim-dcache-directory @@ -106,7 +106,7 @@ ;; ** 从 dhashcache 搜索词条相关函数 (cl-defmethod pyim-dcache-get - (code &context (pyim-dcache-backend (eql pyim-dhashcache)) + (code &context ((pyim-dcache-backend) (eql pyim-dhashcache)) &optional from) "从 FROM 对应的 dcaches 中搜索 CODE, 得到对应的词条. @@ -136,13 +136,13 @@ code 对应的中文词条了。 ;; ** 从 dhashcache 搜索代码相关函数 (cl-defmethod pyim-dcache-search-word-code - (string &context (pyim-dcache-backend (eql pyim-dhashcache))) + (string &context ((pyim-dcache-backend) (eql pyim-dhashcache))) (gethash string pyim-dhashcache-word2code)) ;; ** 给 dhashcache 添加词条相关函数 (cl-defmethod pyim-dcache-insert-word (word code prepend - &context (pyim-dcache-backend (eql pyim-dhashcache))) + &context ((pyim-dcache-backend) (eql pyim-dhashcache))) "将词条 WORD 插入到下面两个词库缓存中。 1. `pyim-dhashcache-icode2word' @@ -210,7 +210,7 @@ code 对应的中文词条了。 ;; ** 从 dhashcache 删除词条相关函数 (cl-defmethod pyim-dcache-delete-word - (word &context (pyim-dcache-backend (eql pyim-dhashcache))) + (word &context ((pyim-dcache-backend) (eql pyim-dhashcache))) "将中文词条 WORD 从个人词库中删除" (maphash (lambda (key value) @@ -235,7 +235,7 @@ code 对应的中文词条了。 ;; ** 更新 dhashcache 相关函数 (cl-defmethod pyim-dcache-update - (&context (pyim-dcache-backend (eql pyim-dhashcache)) &optional force) + (&context ((pyim-dcache-backend) (eql pyim-dhashcache)) &optional force) "读取并加载所有相关词库 dcache. 如果 FORCE 为真,强制加载。" @@ -559,7 +559,7 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf ;; ** 更新 dhashcache 词频功能 (cl-defmethod pyim-dcache-update-wordcount - (word &context (pyim-dcache-backend (eql pyim-dhashcache)) + (word &context ((pyim-dcache-backend) (eql pyim-dhashcache)) &optional wordcount-handler) (pyim-dhashcache-update-iword2count word wordcount-handler)) @@ -627,7 +627,7 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf ;; ** 根据 dhashcache 信息对词条进行排序 (cl-defmethod pyim-dcache-sort-words - (words-list &context (pyim-dcache-backend (eql pyim-dhashcache))) + (words-list &context ((pyim-dcache-backend) (eql pyim-dhashcache))) "对 WORDS-LIST 排序" (let ((iword2count pyim-dhashcache-iword2count) (iword2priority pyim-dhashcache-iword2priority)) @@ -646,7 +646,7 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf ;; ** 升级 dhashcache 相关函数 (cl-defmethod pyim-dcache-upgrade - (&context (pyim-dcache-backend (eql pyim-dhashcache))) + (&context ((pyim-dcache-backend) (eql pyim-dhashcache))) "升级词库缓存. 当前已有的功能: @@ -685,7 +685,7 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf ;; ** 保存 dhashcache 相关函数 (cl-defmethod pyim-dcache-save-caches - (&context (pyim-dcache-backend (eql pyim-dhashcache))) + (&context ((pyim-dcache-backend) (eql pyim-dhashcache))) (pyim-dhashcache-save-personal-dcache-to-file)) (defun pyim-dhashcache-save-personal-dcache-to-file () @@ -708,7 +708,7 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf ;; ** 导出相关函数 (cl-defmethod pyim-dcache-export-personal-words - (file &context (pyim-dcache-backend (eql pyim-dhashcache)) + (file &context ((pyim-dcache-backend) (eql pyim-dhashcache)) &optional confirm) "导出个人词库到 FILE." (pyim-dcache-init-variables) @@ -738,7 +738,7 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf (pyim-dcache-write-file file confirm))) (cl-defmethod pyim-dcache-export-words-and-counts - (file &context (pyim-dcache-backend (eql pyim-dhashcache)) + (file &context ((pyim-dcache-backend) (eql pyim-dhashcache)) &optional confirm ignore-counts) (pyim-dcache-init-variables) (with-temp-buffer diff --git a/pyim-dregcache.el b/pyim-dregcache.el index 5ef111ce28..0cab78cc88 100644 --- a/pyim-dregcache.el +++ b/pyim-dregcache.el @@ -46,7 +46,7 @@ ;; ** 初始化 dregcache 相关函数 (cl-defmethod pyim-dcache-init-variables - (&context (pyim-dcache-backend (eql pyim-dregcache))) + (&context ((pyim-dcache-backend) (eql pyim-dregcache))) "初始化 cache 缓存相关变量." (pyim-dcache-init-variable pyim-dregcache-iword2count @@ -59,7 +59,7 @@ ;; ** 从 dregcache 搜索词条相关函数 (cl-defmethod pyim-dcache-get - (code &context (pyim-dcache-backend (eql pyim-dregcache)) + (code &context ((pyim-dcache-backend) (eql pyim-dregcache)) &optional from) "从 `pyim-dregcache-cache' 搜索 CODE, 得到对应的词条." (when code @@ -191,7 +191,7 @@ ;; ** 从 dregcache 搜索代码相关函数 (cl-defmethod pyim-dcache-search-word-code - (word &context (pyim-dcache-backend (eql pyim-dregcache))) + (word &context ((pyim-dcache-backend) (eql pyim-dregcache))) "从 `pyim-dregcache-cache' 和 `pyim-dregcache-icode2word' 搜索 word, 得到对应的code." (when pyim-debug (message "pyim-dregcache-search-word-code word=%s" word)) (when pyim-dregcache-cache @@ -217,7 +217,7 @@ ;; ** 给 dregcache 添加词条相关函数 (cl-defmethod pyim-dcache-insert-word (word code prepend - &context (pyim-dcache-backend (eql pyim-dregcache))) + &context ((pyim-dcache-backend) (eql pyim-dregcache))) "将词条 WORD 插入到 `pyim-dregcache-icode2word'." (pyim-dregcache-insert-word-into-icode2word word code prepend)) @@ -251,7 +251,7 @@ ;; ** 从 dregcache 删除词条相关函数 (cl-defmethod pyim-dcache-delete-word - (word &context (pyim-dcache-backend (eql pyim-dregcache))) + (word &context ((pyim-dcache-backend) (eql pyim-dregcache))) "将中文词条 WORD 从个人词库中删除." (with-temp-buffer (insert pyim-dregcache-icode2word) @@ -277,7 +277,7 @@ ;; ** 更新 dregcache 相关函数 (cl-defmethod pyim-dcache-update - (&context (pyim-dcache-backend (eql pyim-dregcache)) &optional force) + (&context ((pyim-dcache-backend) (eql pyim-dregcache)) &optional force) "读取并加载所有相关词库 dcache. 如果 FORCE 为真,强制加载。" @@ -395,7 +395,7 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码. ;; ** 更新 dregcache 词频功能。 (cl-defmethod pyim-dcache-update-wordcount - (word &context (pyim-dcache-backend (eql pyim-dregcache)) + (word &context ((pyim-dcache-backend) (eql pyim-dregcache)) &optional wordcount-handler) (pyim-dregcache-update-iword2count word wordcount-handler)) @@ -414,7 +414,7 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码. (puthash word new-value pyim-dregcache-iword2count)))) ;; ** 升级 dregcache 相关函数 -(cl-defmethod pyim-dcache-upgrade (&context (pyim-dcache-backend (eql pyim-dregcache))) +(cl-defmethod pyim-dcache-upgrade (&context ((pyim-dcache-backend) (eql pyim-dregcache))) "升级词库缓存. 当前已有的功能: @@ -441,7 +441,7 @@ update-icode2word 目前只要是用于更新型码输入法的 code-prefix, 所 ;; ** 保存 dregcache 相关函数 (cl-defmethod pyim-dcache-save-caches - (&context (pyim-dcache-backend (eql pyim-dregcache))) + (&context ((pyim-dcache-backend) (eql pyim-dregcache))) (pyim-dregcache-save-personal-dcache-to-file)) (defun pyim-dregcache-save-personal-dcache-to-file () @@ -468,12 +468,12 @@ update-icode2word 目前只要是用于更新型码输入法的 code-prefix, 所 ;; ** 导出 dregcache 相关函数 (cl-defmethod pyim-dcache-export-words-and-counts - (file &context (pyim-dcache-backend (eql pyim-dregcache)) + (file &context ((pyim-dcache-backend) (eql pyim-dregcache)) &optional confirm) "TODO") (cl-defmethod pyim-dcache-export-personal-words - (file &context (pyim-dcache-backend (eql pyim-dregcache)) + (file &context ((pyim-dcache-backend) (eql pyim-dregcache)) &optional confirm) "将个人词库存入 FILE." (pyim-dcache-init-variables)