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

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

[elpa] externals/pyim 156d282073 06/12: cl-defgeneric pyim-dcache-save-c


From: ELPA Syncer
Subject: [elpa] externals/pyim 156d282073 06/12: cl-defgeneric pyim-dcache-save-caches
Date: Thu, 9 Jun 2022 10:57:53 -0400 (EDT)

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

    cl-defgeneric pyim-dcache-save-caches
---
 pyim-dcache.el     | 11 +++--------
 pyim-dhashcache.el |  4 ++++
 pyim-dregcache.el  |  4 ++++
 pyim-process.el    |  3 ++-
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 68bacf8a42..d6d072c2fe 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -181,16 +181,11 @@ AUTO-BACKUP-THRESHOLD 倍, 那么原值将自动备份到 FILE 对应的备份
     (write-region (point-min) (point-max) filename nil :silent)
     (message "Saving file %s..." filename)))
 
-(defun pyim-dcache-save-caches ()
+(cl-defgeneric pyim-dcache-save-caches ()
   "保存 dcache.
 
-  将用户选择过的词生成的缓存和词频缓存的取值
-  保存到它们对应的文件中.
-
-  这个函数默认作为 `kill-emacs-hook' 使用。"
-  (interactive)
-  (pyim-dcache-call-api 'save-personal-dcache-to-file)
-  t)
+将用户选择过的词生成的缓存和词频缓存的取值
+保存到它们对应的文件中.")
 
 ;; ** Dcache 导出功能
 (cl-defgeneric pyim-dcache-export-words-and-counts (file &optional confirm 
ignore-counts)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 913d77bf14..7cd08f4181 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -518,6 +518,10 @@ code 对应的中文词条了。
   (pyim-dcache-init-variable pyim-dhashcache-iword2count-recent-50-words)
   (pyim-dcache-init-variable pyim-dhashcache-iword2priority))
 
+(cl-defmethod pyim-dcache-save-caches
+  (&context (pyim-dcache-backend (eql pyim-dhashcache)))
+  (pyim-dhashcache-save-personal-dcache-to-file))
+
 (defun pyim-dhashcache-save-personal-dcache-to-file ()
   ;; 用户选择过的词
   (pyim-dcache-save-variable
diff --git a/pyim-dregcache.el b/pyim-dregcache.el
index ad33976ae4..9197be914b 100644
--- a/pyim-dregcache.el
+++ b/pyim-dregcache.el
@@ -342,6 +342,10 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
   (unless pyim-dregcache-icode2word
     (pyim-dregcache-update-personal-words t)))
 
+(cl-defmethod pyim-dcache-save-caches
+  (&context (pyim-dcache-backend (eql pyim-dregcache)))
+  (pyim-dregcache-save-personal-dcache-to-file))
+
 (defun pyim-dregcache-save-personal-dcache-to-file ()
   "保存缓存内容到默认目录."
   (when pyim-debug (message "pyim-dregcache-save-personal-dcache-to-file 
called"))
diff --git a/pyim-process.el b/pyim-process.el
index cafea2b7f7..a01efefa04 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -210,7 +210,8 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如:
 (defun pyim-process-save-dcaches (&optional force)
   "PYIM 流程,保存 dcache."
   (when force
-    (pyim-dcache-save-caches)))
+    (pyim-dcache-save-caches))
+  t)
 
 (defun pyim-process-update-personal-words ()
   (pyim-dcache-call-api 'update-personal-words t))



reply via email to

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