branch: externals/pyim commit be4678058d90751a261ba8f54b971e1697ee0f18 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
pyim-process-create-word do not return message string. --- pyim-process.el | 16 +++++----------- pyim.el | 27 ++++++++++++--------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/pyim-process.el b/pyim-process.el index 9bbd1d83fe..35ff7cde88 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -864,11 +864,7 @@ BUG:拼音无法有效地处理多音字。" ;; 不导出这些带标记的词。 (propertize word :noexport t) word) - (concat (or code-prefix "") code) prepend))) - ;; 返回 codes 和 word, 用于 message 命令。 - (mapconcat (lambda (code) - (format "%s -> %s" (concat (or code-prefix "") code) word)) - codes "; "))) + (concat (or code-prefix "") code) prepend))))) (defun pyim-process-get-select-result () "返回 PYIM 选择操作的结果。" @@ -976,12 +972,10 @@ BUG:拼音无法有效地处理多音字。" (defun pyim-process-create-word-at-point (&optional number silent) "将光标前字符数为 NUMBER 的中文字符串添加到个人词库中,当 SILENT 设置为 t 是,不显示提醒信息。" - (let* ((string (pyim-cstring-at-point (or number 2))) - output) - (when string - (setq output (pyim-process-create-word string)) - (unless silent - (message "将词条: %S 加入 personal 缓冲。" output))))) + (when-let* ((string (pyim-cstring-at-point (or number 2)))) + (pyim-process-create-word string) + (unless silent + (message "将词条: %S 加入词库。" string)))) (defun pyim-process--trigger-call-function-p () "当光标之前是中文但不是标点符号时,返回 t." diff --git a/pyim.el b/pyim.el index 64ee881a0e..38b13c38d0 100644 --- a/pyim.el +++ b/pyim.el @@ -281,14 +281,13 @@ REFRESH-COMMON-DCACHE 已经废弃,不要再使用了。" "Add the selected text as a Chinese word into the personal dictionary." (interactive) (when (region-active-p) - (let ((string (buffer-substring-no-properties (region-beginning) (region-end))) - output) + (let ((string (buffer-substring-no-properties (region-beginning) (region-end)))) (if (> (length string) 6) (error "词条太长") (if (not (string-match-p "^\\cc+\\'" string)) (error "不是纯中文字符串") - (setq output (pyim-process-create-word string)) - (message "将词条: %S 插入 personal file。" output))) + (pyim-process-create-word string) + (message "将词条: %S 插入 personal file。" string))) (deactivate-mark) ;; NOTE: 这里必须返回 t, 因为这个函数的返回结果会被用来做为判断条件。 t))) @@ -327,18 +326,16 @@ MERGE-METHOD 是一个函数,这个函数需要两个数字参数,代表词 (word (car content)) (count (string-to-number (or (car (cdr content)) "0"))) - (criteria (car (cdr (cdr content)))) - output) - (setq output - (pyim-process-create-word - word nil - (lambda (x) - (funcall (or merge-method #'max) - (or x 0) - count)) - criteria)) + (criteria (car (cdr (cdr content))))) + (pyim-process-create-word + word nil + (lambda (x) + (funcall (or merge-method #'max) + (or x 0) + count)) + criteria) (unless silent - (message "* 导入 %S" output))) + (message "* 导入 %S" word))) (forward-line 1))) ;; 保存一下用户选择过的词生成的缓存和词频缓存, ;; 因为使用 async 机制更新 dcache 时,需要从 dcache 文件