branch: externals/pyim commit 58f55d990c82b98739dde0a2d7c9b84ecf691c8a Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add pyim-process-delete-word-at-point --- pyim-process.el | 14 ++++++++++---- pyim.el | 10 ++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyim-process.el b/pyim-process.el index f499ecb7b7..e4819e7932 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -859,9 +859,6 @@ BUG:拼音无法有效地处理多音字。" (pyim-process-select-handle-char last-command-event))) (pyim-process-terminate)) -;; Fix compile warn. -(declare-function pyim-delete-word-at-point "pyim") - (defun pyim-process-select-handle-char (char) "Pyim 字符转换函数,CHAR 代表 *待输入* 的字符。" (let ((str (char-to-string char))) @@ -871,7 +868,7 @@ BUG:拼音无法有效地处理多音字。" ((pyim-process--trigger-delete-word-p char) (let ((str-before-2 (pyim-char-before-to-string 1))) (delete-char -2) - (pyim-delete-word-at-point + (pyim-process-delete-word-at-point (string-to-number str-before-2))) "") @@ -917,6 +914,15 @@ BUG:拼音无法有效地处理多音字。" (pyim-string-match-p "\\cc" str-before-3) (pyim-outcome-trigger-p str)))) +(defun pyim-process-delete-word-at-point (&optional number silent) + "将光标前字符数为 NUMBER 的中文字符串从个人词库中删除 +当 SILENT 设置为 t 是,不显示提醒信息。" + (let ((string (pyim-cstring-at-point (or number 2)))) + (when string + (pyim-process-delete-word string) + (unless silent + (message "词条: \"%s\" 已经从个人词库缓冲中删除。" string))))) + (defun pyim-process--trigger-create-word-p (char) "当光标之前的字符串类似“[2-9]<trigger char>”时,比如 “你好2v” ,返回 t." (let* ((str (char-to-string char)) diff --git a/pyim.el b/pyim.el index 4ace0f4880..85aca6f930 100644 --- a/pyim.el +++ b/pyim.el @@ -413,14 +413,8 @@ FILE 的格式与 `pyim-dcache-export' 生成的文件格式相同, (pyim-process-delete-word word) (message "pyim: 从个人词库中删除词条 “%s” !" word)))) -(defun pyim-delete-word-at-point (&optional number silent) - "将光标前字符数为 NUMBER 的中文字符串从个人词库中删除 -当 SILENT 设置为 t 是,不显示提醒信息。" - (let ((string (pyim-cstring-at-point (or number 2)))) - (when string - (pyim-process-delete-word string) - (unless silent - (message "词条: \"%s\" 已经从个人词库缓冲中删除。" string))))) +(defalias 'pyim-delete-word-at-point + #'pyim-process-delete-word-at-point) (defun pyim-delete-word () "从个人词库中删除词条。"