branch: externals/pyim commit 03270e2bd3acb3fbdcedb94894cefc4f3d779a96 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
pyim-process--cleanup-input-output -> pyim-process--init-cleanup --- pyim-process.el | 43 +++++++++++++++++++++++-------------------- pyim.el | 1 - 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/pyim-process.el b/pyim-process.el index c8f753dde4..a70cdadd6a 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -229,20 +229,6 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: (defun pyim-process-get-outcome-subword-info () pyim-outcome-subword-info) -(defun pyim-process-last-created-words () - pyim-process--last-created-words) - -(defun pyim-process-add-last-created-word (word) - (setq pyim-process--last-created-words - (cons word (remove word pyim-process--last-created-words)))) - -(defun pyim-process-remove-last-created-word (word) - (setq pyim-process--last-created-words - (remove word pyim-process--last-created-words))) - -(defun pyim-process-delete-word (word) - (pyim-dcache-delete-word word)) - ;; ** pyim-input-method 核心函数 (defvar pyim-mode-map) @@ -276,8 +262,7 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: (modified-p (buffer-modified-p)) last-command-event last-command this-command) - (pyim-process--set-translating-flag t) - (pyim-process--cleanup-input-output) + (pyim-process--init-cleanup) (when key (pyim-add-unread-command-events key)) @@ -312,14 +297,15 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: ;; But translate KEY if necessary. (char-to-string key))) -(defun pyim-process--set-translating-flag (value) - (setq pyim-process--translating value)) - -(defun pyim-process--cleanup-input-output () +(defun pyim-process--init-cleanup () (pyim-entered-erase-buffer) + (pyim-process--set-translating-flag t) (setq pyim-outcome-subword-info nil) (setq pyim-outcome-history nil)) +(defun pyim-process--set-translating-flag (value) + (setq pyim-process--translating value)) + (defun pyim-process--translating-p () pyim-process--translating) @@ -814,6 +800,10 @@ BUG:拼音无法有效地处理多音字。" (format "%s -> %s" (concat (or code-prefix "") code) word)) codes "; ")))) +(defun pyim-process-add-last-created-word (word) + (setq pyim-process--last-created-words + (cons word (remove word pyim-process--last-created-words)))) + (defun pyim-process-get-select-result () "返回 PYIM 选择操作的结果。" (pyim-process-subword-and-magic-convert @@ -992,6 +982,19 @@ alist 列表。" (unless do-not-terminate (pyim-process-terminate)))) +;; ** 删词相关 +(defun pyim-process-delete-word (word) + (pyim-dcache-delete-word word) + (pyim-process-remove-last-created-word word)) + +(defun pyim-process-remove-last-created-word (word) + (setq pyim-process--last-created-words + (remove word pyim-process--last-created-words))) + +(defun pyim-process-last-created-words () + pyim-process--last-created-words) + + ;; * Footer (provide 'pyim-process) diff --git a/pyim.el b/pyim.el index b820549e74..5062e98b4a 100644 --- a/pyim.el +++ b/pyim.el @@ -444,7 +444,6 @@ FILE 的格式与 `pyim-dcache-export' 生成的文件格式相同, (pyim-process-last-created-words)))) (dolist (word words) (pyim-process-delete-word word) - (pyim-process-remove-last-created-word word) (message "将词条: %S 从 personal 缓冲中删除。" word)))))) ;; ** 选词功能