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

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

[elpa] externals/pyim fb74c9fc93 01/12: cl-defgeneric pyim-dcache-upgrad


From: ELPA Syncer
Subject: [elpa] externals/pyim fb74c9fc93 01/12: cl-defgeneric pyim-dcache-upgrade
Date: Thu, 9 Jun 2022 10:57:52 -0400 (EDT)

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

    cl-defgeneric pyim-dcache-upgrade
---
 README.org         | 2 +-
 pyim-dcache.el     | 9 ++-------
 pyim-dhashcache.el | 7 +++++++
 pyim-dregcache.el  | 7 +++++++
 pyim.el            | 6 ++++++
 5 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/README.org b/README.org
index d278dc124e..81e423139b 100644
--- a/README.org
+++ b/README.org
@@ -33,7 +33,7 @@
 1. 五笔用户
    1. 需要 (require 'pyim-wbdict), 加载五笔 scheme 设置。
    2. 需要将自己的五笔词库文件中的 code-prefix "." 替换为 "wubi/".
-   3. 运行 `pyim-dcache-upgrade' 命令,升级 icode2word 词库缓存。
+   3. 运行 `pyim-upgrade' 命令,升级 icode2word 词库缓存。
 2. 仓颉用户
    1. 需要 (require 'pyim-cangjie5dict), 加载仓颉 scheme 设置。
    2. 需要将自己的五笔词库文件中的 code-prefix "@" 替换为 "cangjie/".
diff --git a/pyim-dcache.el b/pyim-dcache.el
index 22cf9fcf02..93f5c520ef 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -252,13 +252,8 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   (pyim-dcache-call-api 'insert-word-into-ishortcode2word word code prepend))
 
 ;; ** Dcache 升级功能
-(defun pyim-dcache-upgrade ()
-  "升级词库缓存.
-
-当前已有的功能:
-1. 基于 :code-prefix-history 信息,升级为新的 code-prefix。"
-  (interactive)
-  (pyim-dcache-call-api 'upgrade-icode2word))
+(cl-defgeneric pyim-dcache-upgrade ()
+  "升级词库缓存.")
 
 ;; ** Dcache 删词功能
 (cl-defgeneric pyim-dcache-delete-word (word)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index ddaa04f26b..3e4c13388f 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -454,6 +454,13 @@ code 对应的中文词条了。
        (pyim-dcache-reload-variable pyim-dhashcache-icode2word)
        (pyim-dhashcache-update-ishortcode2word force)))))
 
+(cl-defmethod pyim-dcache-upgrade (&context (pyim-dcache-backend (eql 
pyim-dhashcache)))
+  "升级词库缓存.
+
+当前已有的功能:
+1. 基于 :code-prefix-history 信息,升级为新的 code-prefix。"
+  (pyim-dhashcache-upgrade-icode2word))
+
 (defun pyim-dhashcache-upgrade-icode2word ()
   "升级 icode2word 缓存。"
   (let ((delete-old-key-p (yes-or-no-p "Delete old key after upgrade? "))
diff --git a/pyim-dregcache.el b/pyim-dregcache.el
index 9133e9b015..6ce1e17256 100644
--- a/pyim-dregcache.el
+++ b/pyim-dregcache.el
@@ -425,6 +425,13 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
     (setq pyim-dregcache-icode2word
           (buffer-string))))
 
+(cl-defmethod pyim-dcache-upgrade (&context (pyim-dcache-backend (eql 
pyim-dregcache)))
+  "升级词库缓存.
+
+当前已有的功能:
+1. 基于 :code-prefix-history 信息,升级为新的 code-prefix。"
+  (pyim-dregcache-upgrade-icode2word))
+
 (defun pyim-dregcache-upgrade-icode2word ()
   "升级 icode2word 缓存。
 
diff --git a/pyim.el b/pyim.el
index f6c69017d1..cf5c4f3c81 100644
--- a/pyim.el
+++ b/pyim.el
@@ -311,6 +311,12 @@ REFRESH-COMMON-DCACHE 已经废弃,不要再使用了。"
   (pyim-process-save-dcaches save-personal-dcache)
   (pyim-process-init-dcaches :force))
 
+;; ** 升级功能
+(defun pyim-upgrade ()
+  "升级 pyim 功能。"
+  (interactive)
+  (pyim-dcache-upgrade))
+
 ;; ** 键盘输入处理功能
 (defun pyim-self-insert-command ()
   "Pyim 默认的 self-insert-command."



reply via email to

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