branch: externals/pyim commit e5cd582038b50ede0c4d33976a804b95843cb438 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
pyim-preview: Do not require pyim-outcome. * pyim-preview.el (pyim-outcome): Do not require pyim-outcome. (pyim-preview-refresh): Do not use pyim-outcome* * pyim-process.el (pyim-process-subword-and-magic-convert): New function. --- pyim-preview.el | 7 ++----- pyim-process.el | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyim-preview.el b/pyim-preview.el index 97de6ac6ef..805a74d7dc 100644 --- a/pyim-preview.el +++ b/pyim-preview.el @@ -29,7 +29,6 @@ ;; * 代码 :code: (require 'cl-lib) (require 'pyim-common) -(require 'pyim-outcome) (require 'pyim-process) (defgroup pyim-preview nil @@ -78,7 +77,7 @@ pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示 (candidates (pyim-process-get-candidates)) (pos (1- (min (pyim-process-get-candidate-position) (length candidates)))) - (preview (concat (pyim-outcome-get) + (preview (concat (pyim-process-get-outcome) (nth pos candidates)))) (when (memq class '(quanpin)) (let ((rest (mapconcat @@ -88,9 +87,7 @@ pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示 "'"))) (when (string< "" rest) (setq preview (concat preview rest))))) - (setq preview - (pyim-outcome-magic-convert - (pyim-outcome-get-subword preview))) + (setq preview (pyim-process-subword-and-magic-convert preview)) ;; Delete old preview string. (pyim-preview-delete-string) ;; Insert new preview string. diff --git a/pyim-process.el b/pyim-process.el index 0347f474a5..9392a07bc1 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -362,6 +362,11 @@ (setq str (pyim-outcome-magic-convert str))) str)) +(defun pyim-process-subword-and-magic-convert (string) + "返回 STRING 以词定字和魔术转换后的新字符串." + (pyim-outcome-magic-convert + (pyim-outcome-get-subword string))) + (defun pyim-process-outcome-handle (type) "依照 TYPE, 获取 pyim 的 outcome,并将其加入 `pyim-outcome-history'." (cond ((not enable-multibyte-characters)