branch: externals/pyim commit a09d1871015ccfe1fca18e3301f556a4c32eec26 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Remove pyim-dcache-load-backend. 不支持动态 require dache-backend 功能了,如果用户需要使用某个 dcache-backend, 那 就需要用户自己手工 require. --- pyim-dcache.el | 13 ++++--------- pyim-process.el | 1 - pyim.el | 9 +++++++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pyim-dcache.el b/pyim-dcache.el index 8ea059a25c..119a969e8d 100644 --- a/pyim-dcache.el +++ b/pyim-dcache.el @@ -50,8 +50,9 @@ `pyim-dregcache' 速度和词库大小成正比. 当词库接近100M大小时, 在六年历史的笔记本上会有一秒的延迟. 这时建议换用 `pyim-dhashcache'. -注意:`pyim-dregcache' 只支持全拼和双拼输入法,不支持其它型码输入 -法。" +注意事项: +1. `pyim-dregcache' 只支持全拼和双拼输入法,不支持其它型码输入法。 +2. 如果使用这个后端,用户需要: (require \\='pyim-dregcache)." :type 'symbol) (defvar pyim-dcache-auto-update t @@ -174,13 +175,7 @@ AUTO-BACKUP-THRESHOLD 倍, 那么原值将自动备份到 FILE 对应的备份 (setq ,variable (or (pyim-dcache-get-value ',variable) (make-hash-table :test #'equal))))) -;; ** Dcache 后端加载相关函数 -(defun pyim-dcache-load-backend () - "检查 `pyim-dcache-backend' 设置并 require 相应 package." - (let ((backend pyim-dcache-backend)) - (unless (featurep backend) - (require backend)))) - +;; ** Dcache 获取当前可用后端 (defun pyim-dcache-backend () "返回当前可用的 dcache backend." (if (and (eq pyim-dcache-backend 'pyim-dregcache) diff --git a/pyim-process.el b/pyim-process.el index cc97e580ba..9d95b44d04 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -205,7 +205,6 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: "PYIM 流程,词库相关的初始化工作。" (pyim-recreate-local-variables) (pyim-pymap-cache-create) - (pyim-dcache-load-backend) (pyim-dcache-init-variables) (pyim-dcache-update force)) diff --git a/pyim.el b/pyim.el index db9b0905e1..f27e1df480 100644 --- a/pyim.el +++ b/pyim.el @@ -37,6 +37,11 @@ (require 'pyim-autoselector) (require 'pyim-common) (require 'pyim-cstring) +(require 'pyim-dhashcache) +;; NOTE: pyim 默认使用 dhashcache, 按理说不需要加载 dregcache, 但以前 pyim 支持 +;; 动态加载后端,由于简化代码的原因,这个功能取消了,require dregcache 是为了向 +;; 后兼容,未来也许会取消加载。 +(require 'pyim-dregcache) (require 'pyim-indicator) (require 'pyim-page) (require 'pyim-preview) @@ -442,7 +447,7 @@ MERGE-METHOD 是一个函数,这个函数需要两个数字参数,代表词 如果 FILE 为 nil, 提示用户指定导出文件位置, 如果 CONFIRM 为 non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式" (interactive "F将词条和词频信息导出到文件: ") - (pyim-process-init-dcaches) + (pyim-dcache-init-variables) (pyim-dcache-export-words-and-counts file confirm ignore-counts) (message "PYIM: 词条和词频信息导出完成。")) @@ -452,7 +457,7 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式" 如果 FILE 为 nil, 提示用户指定导出文件位置, 如果 CONFIRM 为 non-nil, 文件存在时将会提示用户是否覆盖,默认为覆盖模式。" (interactive "F将个人词条导出到文件:") - (pyim-process-init-dcaches) + (pyim-dcache-init-variables) (pyim-dcache-export-personal-words file confirm) (message "PYIM: 个人词条导出完成。"))