branch: externals/pyim commit 41564f3d74eacda5f9a5fc9746d8fddff2acb561 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Sort dregcache --- pyim-dregcache.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pyim-dregcache.el b/pyim-dregcache.el index 8cacf5a9e7..ef4d5d6e8c 100644 --- a/pyim-dregcache.el +++ b/pyim-dregcache.el @@ -90,6 +90,9 @@ (when pyim-dregcache-icode2word (nreverse (pyim-dregcache-get-1 pyim-dregcache-icode2word code)))) +(defmacro pyim-dregcache-match-line (code) + `(concat "^" (pyim-dregcache-code2regexp ,code) " \\(.+\\)")) + (defun pyim-dregcache-get-1 (content code) (let ((case-fold-search t) (start 0) @@ -113,8 +116,14 @@ (setq start (+ start 2 (length code) (length word)))) output)) -(defmacro pyim-dregcache-match-line (code) - `(concat "^" (pyim-dregcache-code2regexp ,code) " \\(.+\\)")) +(defmacro pyim-dregcache-is-shenmu (code) + "判断CODE 是否是一个声母." + `(and (eq (length ,code) 1) + (not (string-match ,code "aeo")))) + +(defmacro pyim-dregcache-shenmu2regexp (char) + "将声母 CHAR 转换为通用正则表达式匹配所有以该声母开头的汉字." + `(concat ,char "[a-z]*")) (defun pyim-dregcache-code2regexp (code) "将 CODE 转换成正则表达式用来搜索辞典缓存中的匹配项目. @@ -154,15 +163,6 @@ ;; tian-an-men => tian-an-men[a-z-]* (concat s "[a-z-]*")))))))) -(defmacro pyim-dregcache-is-shenmu (code) - "判断CODE 是否是一个声母." - `(and (eq (length ,code) 1) - (not (string-match ,code "aeo")))) - -(defmacro pyim-dregcache-shenmu2regexp (char) - "将声母 CHAR 转换为通用正则表达式匹配所有以该声母开头的汉字." - `(concat ,char "[a-z]*")) - (defun pyim-dregcache-all-dict-files () "所有词典文件." (let* (rlt)