branch: externals/pyim commit 7270c99e15cf66c73a4f7a4e5e989a9d5b53a160 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Simplify pyim-select-finish-hook's code. --- pyim-liberime.el | 4 +--- pyim-process.el | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyim-liberime.el b/pyim-liberime.el index 79c354ef64..87b256168f 100644 --- a/pyim-liberime.el +++ b/pyim-liberime.el @@ -211,9 +211,7 @@ (pyim-process-create-word (pyim-outcome-get)))) (setq pyim-liberime-code-log nil) (setq pyim-liberime-word-log nil) - (pyim-process-terminate) - ;; pyim 使用这个 hook 来处理联想词。 - (run-hooks 'pyim-select-finish-hook)))) + (pyim-process-terminate)))) (defun pyim-liberime--get-code (word input &optional _limit) "Get the code of WORD from the beginning of INPUT. diff --git a/pyim-process.el b/pyim-process.el index 66641d0cb0..746f9a833e 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -716,6 +716,10 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: (cl-defgeneric pyim-process-select-word (scheme) "按照 SCHEME 对应的规则,对预选词条进行选词操作。") +(cl-defmethod pyim-process-select-word :after (_scheme) + "运行 `pyim-select-finish-hook'." + (run-hooks 'pyim-select-finish-hook)) + (cl-defmethod pyim-process-select-word ((_scheme pyim-scheme-quanpin)) "按照全拼规则,对预选词条进行选词操作。" (pyim-process--create-code-criteria) @@ -723,8 +727,7 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: (if (pyim-process--multi-step-select-word-p) (pyim-process--select-word-in-next-step) (pyim-process-create-word (pyim-process-get-select-result) t) - (pyim-process-terminate) - (run-hooks 'pyim-select-finish-hook))) + (pyim-process-terminate))) (defun pyim-process--create-code-criteria () "创建 `pyim-process--code-criteria'." @@ -897,8 +900,7 @@ BUG:拼音无法有效地处理多音字。" (delete-region (point-min) (point))) (pyim-process-run)) (pyim-process-create-word (pyim-process-get-select-result) t) - (pyim-process-terminate) - (run-hooks 'pyim-select-finish-hook))) + (pyim-process-terminate))) (defun pyim-process-select-last-char () "选择上一个输入的字符。"