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

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

[elpa] externals/pyim 582f9c4 4/5: pyim-export -> pyim-export-words-and-


From: ELPA Syncer
Subject: [elpa] externals/pyim 582f9c4 4/5: pyim-export -> pyim-export-words-and-counts.
Date: Mon, 22 Nov 2021 05:57:25 -0500 (EST)

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

    pyim-export -> pyim-export-words-and-counts.
    
        * pyim-dregcache.el (pyim-dregcache-insert-export-content): removed.
        (pyim-dregcache-export-words-and-counts): New function.
    
        * pyim-dhashcache.el (pyim-dhashcache-insert-export-content): removed.
        (pyim-dhashcache-export-words-and-counts): New function.
    
        * pyim-dcache.el (pyim-export): rename to pyim-export-words-count.
        (pyim-dcache-export-words-and-counts): New function.
---
 pyim-dcache.el     | 18 +++++++++---------
 pyim-dhashcache.el | 35 +++++++++++++++++++----------------
 pyim-dregcache.el  |  2 +-
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 2bbe9dc..22b342f 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -176,17 +176,17 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
   t)
 
 ;; ** Dcache 导出功能
-(defalias 'pyim-export 'pyim-dcache-export)
-(defun pyim-dcache-export (file &optional confirm)
+(define-obsolete-function-alias 'pyim-export 'pyim-export-words-and-counts 
"4.0")
+
+(defalias 'pyim-export-words-and-counts 'pyim-dcache-export-words-and-counts)
+(defun pyim-dcache-export-words-and-counts (file &optional confirm)
   "将个人词条以及词条对应的词频信息导出到文件 FILE.
 
-  如果 FILE 为 nil, 提示用户指定导出文件位置, 如果 CONFIRM 为 non-nil,
-  文件存在时将会提示用户是否覆盖,默认为覆盖模式"
-  (interactive "F将词条相关信息导出到文件: ")
-  (with-temp-buffer
-    (insert ";;; -*- coding: utf-8-unix -*-\n")
-    (pyim-dcache-call-api 'insert-export-content)
-    (pyim-dcache-write-file file confirm)))
+如果 FILE 为 nil, 提示用户指定导出文件位置, 如果 CONFIRM 为
+non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
+  (interactive "F将词条和词频信息导出到文件: ")
+  (pyim-dcache-call-api 'export-words-and-counts file confirm)
+  (message "PYIM: 词条和词频信息导出完成。"))
 
 (defalias 'pyim-export-personal-words 'pyim-dcache-export-personal-words)
 (defun pyim-dcache-export-personal-words (file &optional confirm)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 302e1b8..2359c28 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -365,22 +365,6 @@ code 对应的中文词条了。
   ;; 词频
   (pyim-dcache-save-variable 'pyim-dhashcache-iword2count))
 
-(defun pyim-dhashcache-insert-export-content ()
-  (maphash
-   (lambda (key value)
-     (insert (format "%s %s\n" key value)))
-   pyim-dhashcache-iword2count)
-  ;; 在默认情况下,用户选择过的词生成的缓存中存在的词条,
-  ;; `pyim-dhashcache-iword2count' 中也一定存在,但如果用户
-  ;; 使用了特殊的方式给用户选择过的词生成的缓存中添加了
-  ;; 词条,那么就需要将这些词条也导出,且设置词频为 0
-  (maphash
-   (lambda (_ words)
-     (dolist (word words)
-       (unless (gethash word pyim-dhashcache-iword2count)
-         (insert (format "%s %s\n" word 0)))))
-   pyim-dhashcache-icode2word))
-
 (defmacro pyim-dhashcache-put (cache code &rest body)
   "这个用于保存词条,删除词条以及调整词条位置."
   (declare (indent 0))
@@ -432,6 +416,25 @@ code 对应的中文词条了。
   "导出个人词库到 FILE."
   (pyim-dhashcache-export pyim-dhashcache-icode2word file confirm))
 
+(defun pyim-dhashcache-export-words-and-counts (file &optional confirm)
+  (with-temp-buffer
+    (insert ";;; -*- coding: utf-8-unix -*-\n")
+    (maphash
+     (lambda (key value)
+       (insert (format "%s %s\n" key value)))
+     pyim-dhashcache-iword2count)
+    ;; 在默认情况下,用户选择过的词生成的缓存中存在的词条,
+    ;; `pyim-dhashcache-iword2count' 中也一定存在,但如果用户
+    ;; 使用了特殊的方式给用户选择过的词生成的缓存中添加了
+    ;; 词条,那么就需要将这些词条也导出,且设置词频为 0
+    (maphash
+     (lambda (_ words)
+       (dolist (word words)
+         (unless (gethash word pyim-dhashcache-iword2count)
+           (insert (format "%s %s\n" word 0)))))
+     pyim-dhashcache-icode2word)
+    (pyim-dcache-write-file file confirm)))
+
 ;; * Footer
 
 (provide 'pyim-dhashcache)
diff --git a/pyim-dregcache.el b/pyim-dregcache.el
index 8ad6f01..92fc357 100644
--- a/pyim-dregcache.el
+++ b/pyim-dregcache.el
@@ -349,7 +349,7 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
   ;; 词频
   (pyim-dcache-save-variable 'pyim-dregcache-iword2count))
 
-(defun pyim-dregcache-insert-export-content ()
+(defun pyim-dregcache-export-words-and-counts ()
   "TODO"
   )
 



reply via email to

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