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

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

[elpa] externals/pyim 55ab087: pyim-dhashcache-insert-word-into-ishortco


From: ELPA Syncer
Subject: [elpa] externals/pyim 55ab087: pyim-dhashcache-insert-word-into-ishortcode2word add prepend arg.
Date: Mon, 6 Dec 2021 21:57:34 -0500 (EST)

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

    pyim-dhashcache-insert-word-into-ishortcode2word add prepend arg.
    
        * pyim-dcache.el (pyim-dcache-insert-word):
    
        * pyim-dhashcache.el 
(pyim-dhashcache-insert-word-into-ishortcode2word): Add prepend arg.
---
 pyim-dcache.el     |  2 +-
 pyim-dhashcache.el | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 38dd139..06dbe1b 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -266,7 +266,7 @@ non-nil,文件存在时将会提示用户是否覆盖,默认为覆盖模式"
   ;; 临时写入一份,供当前 Emacs session 使用,但退出时 pyim 不会保存
   ;; ishortcode2word 词库缓存到文件,因为下次启动 Emacs 的时候,ishortcode2word
   ;; 词库缓存会从 icode2word 再次重建。
-  (pyim-dcache-call-api 'insert-word-into-ishortcode2word word code))
+  (pyim-dcache-call-api 'insert-word-into-ishortcode2word word code prepend))
 
 ;; ** Dcache 升级功能
 (defun pyim-dcache-upgrade-icode2word ()
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index f108deb..e02763a 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -421,8 +421,11 @@ code 对应的中文词条了。
         `(,word ,@(remove word orig-value))
       `(,@(remove word orig-value) ,word))))
 
-(defun pyim-dhashcache-insert-word-into-ishortcode2word (word code)
-  "将词条 WORD 插入到 ishortcode2word 词库缓存 CODE 首字母字符串对应的位置."
+(defun pyim-dhashcache-insert-word-into-ishortcode2word (word code prepend)
+  "将词条 WORD 插入到 ishortcode2word 词库缓存 CODE 首字母字符串对应的位置.
+
+默认 WORD 放到已有词条的最后,如果 PREPEND 为 non-nil, WORD 将放
+到已有词条的最前面。"
   (when (string-match-p "-" code)
     (pyim-dhashcache-put
       pyim-dhashcache-ishortcode2word
@@ -431,7 +434,9 @@ code 对应的中文词条了。
                    (substring x 0 1))
                  (split-string code "-")
                  "-")
-      `(,word ,@(remove word orig-value)))))
+      (if prepend
+          `(,word ,@(remove word orig-value))
+        `(,@(remove word orig-value) ,word)))))
 
 (defun pyim-dhashcache-search-word-code (string)
   (gethash string pyim-dhashcache-word2code))



reply via email to

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