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

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

[elpa] externals/pyim dc392af 3/4: pyim-dcache-save-variable: make value


From: ELPA Syncer
Subject: [elpa] externals/pyim dc392af 3/4: pyim-dcache-save-variable: make value argument no optional.
Date: Tue, 14 Dec 2021 09:57:36 -0500 (EST)

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

    pyim-dcache-save-variable: make value argument no optional.
    
        * pyim-dregcache.el (pyim-dregcache-save-personal-dcache-to-file): 
update.
    
        * pyim-dhashcache.el (pyim-dhashcache-update-icode2word)
        (pyim-dhashcache-save-personal-dcache-to-file): update.
    
        * pyim-dcache.el (pyim-dcache-save-variable): make value argument no 
optional.
---
 pyim-dcache.el     |  5 ++---
 pyim-dhashcache.el | 12 +++++++++---
 pyim-dregcache.el  |  9 ++++++---
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 554af2f..113016a 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -103,11 +103,10 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
                         fallback-value
                         (make-hash-table :test #'equal))))))
 
-(defun pyim-dcache-save-variable (variable &optional value)
+(defun pyim-dcache-save-variable (variable value)
   "将 VARIABLE 变量的取值保存到 `pyim-dcache-directory' 中对应文件中."
   (let ((file (expand-file-name (symbol-name variable)
-                                pyim-dcache-directory))
-        (value (or value (symbol-value variable))))
+                                pyim-dcache-directory)))
     (pyim-dcache-save-value-to-file value file)))
 
 (defun pyim-dcache-save-value-to-file (value file)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index adfe9d3..eb9e430 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -346,7 +346,9 @@ code 对应的中文词条了。
            (puthash key (pyim-dhashcache-sort-words value 
pyim-dhashcache-iword2count)
                     pyim-dhashcache-icode2word))
          pyim-dhashcache-icode2word)
-        (pyim-dcache-save-variable 'pyim-dhashcache-icode2word)
+        (pyim-dcache-save-variable
+         'pyim-dhashcache-icode2word
+         pyim-dhashcache-icode2word)
         nil)
      (lambda (_)
        (pyim-dcache-set-variable 'pyim-dhashcache-icode2word t)
@@ -396,9 +398,13 @@ code 对应的中文词条了。
 
 (defun pyim-dhashcache-save-personal-dcache-to-file ()
   ;; 用户选择过的词
-  (pyim-dcache-save-variable 'pyim-dhashcache-icode2word)
+  (pyim-dcache-save-variable
+   'pyim-dhashcache-icode2word
+   pyim-dhashcache-icode2word)
   ;; 词频
-  (pyim-dcache-save-variable 'pyim-dhashcache-iword2count))
+  (pyim-dcache-save-variable
+   'pyim-dhashcache-iword2count
+   pyim-dhashcache-iword2count))
 
 (defmacro pyim-dhashcache-put (cache code &rest body)
   "将 BODY 的返回值保存到 CACHE 对应的 CODE 中。
diff --git a/pyim-dregcache.el b/pyim-dregcache.el
index bb93515..23b0367 100644
--- a/pyim-dregcache.el
+++ b/pyim-dregcache.el
@@ -343,10 +343,13 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
   (when pyim-debug (message "pyim-dregcache-save-personal-dcache-to-file 
called"))
   ;; 用户选择过的词存为标准辞典格式保存
   (when pyim-dregcache-icode2word
-    (pyim-dregcache-save-variable 'pyim-dregcache-icode2word
-                                  pyim-dregcache-icode2word))
+    (pyim-dregcache-save-variable
+     'pyim-dregcache-icode2word
+     pyim-dregcache-icode2word))
   ;; 词频
-  (pyim-dcache-save-variable 'pyim-dregcache-iword2count))
+  (pyim-dcache-save-variable
+   'pyim-dregcache-iword2count
+   pyim-dregcache-iword2count))
 
 (defun pyim-dregcache-export-words-and-counts ()
   "TODO"



reply via email to

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