branch: externals/pyim commit 4d2d02aa248f7c97bfb88dbb51f45ebf6a894ac4 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add pyim-process-create-word-at-point --- pyim-process.el | 13 +++++++++++-- pyim.el | 10 +--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pyim-process.el b/pyim-process.el index 2b02d5b1c0..f499ecb7b7 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -860,7 +860,6 @@ BUG:拼音无法有效地处理多音字。" (pyim-process-terminate)) ;; Fix compile warn. -(declare-function pyim-create-word-at-point "pyim") (declare-function pyim-delete-word-at-point "pyim") (defun pyim-process-select-handle-char (char) @@ -879,7 +878,7 @@ BUG:拼音无法有效地处理多音字。" ((pyim-process--trigger-create-word-p char) (let ((str-before-1 (pyim-char-before-to-string 0))) (delete-char -1) - (pyim-create-word-at-point + (pyim-process-create-word-at-point (string-to-number str-before-1))) "") @@ -926,6 +925,16 @@ BUG:拼音无法有效地处理多音字。" (pyim-string-match-p "\\cc" str-before-2) (pyim-outcome-trigger-p str)))) +(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))))) + (defun pyim-process--call-trigger-function-p (char) "判断是否触发 `pyim-outcome-trigger-function'." (let* ((str (char-to-string char)) diff --git a/pyim.el b/pyim.el index e2d541119f..4ace0f4880 100644 --- a/pyim.el +++ b/pyim.el @@ -274,15 +274,7 @@ REFRESH-COMMON-DCACHE 已经废弃,不要再使用了。" (pyim-process-register-self-insert-command 'pyim-self-insert-command) ;; ** 加词功能 -(defun pyim-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))))) +(defalias 'pyim-create-word-at-point #'pyim-process-create-word-at-point) (defun pyim-create-2cchar-word-at-point () "将光标前2个中文字符组成的字符串加入个人词库。"