branch: externals/pyim commit 6878df374eaaa4546994bfe81651274585ebf08e Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add pyim-process-get-mode-map --- pyim-process.el | 10 ++++++---- pyim.el | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pyim-process.el b/pyim-process.el index 14609ca6c1..1e20c95fb4 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -205,8 +205,6 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: pyim-process--word-position)) ;; ** pyim-input-method 核心函数 -(defvar pyim-mode-map) - (defun pyim-process-input-method (key) "`pyim-process-input-method' 是 `pyim-input-method' 内部使用的函数。 @@ -231,7 +229,8 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: ;; OK, we can start translation. (let* ((echo-keystrokes 0) (help-char nil) - (overriding-terminal-local-map pyim-mode-map) + (mode-map (pyim-process-get-mode-map)) + (overriding-terminal-local-map mode-map) (input-method-function nil) (input-method-use-echo-area nil) (modified-p (buffer-modified-p)) @@ -245,7 +244,7 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: (while (pyim-process--translating-p) (set-buffer-modified-p modified-p) (let* ((keyseq (read-key-sequence nil nil nil t)) - (cmd (lookup-key pyim-mode-map keyseq))) + (cmd (lookup-key mode-map keyseq))) ;; (message "key: %s, cmd:%s\nlcmd: %s, lcmdv: %s, tcmd: %s" ;; key cmd last-command last-command-event this-command) (if (if key @@ -272,6 +271,9 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如: ;; But translate KEY if necessary. (char-to-string key))) +(cl-defgeneric pyim-process-get-mode-map () + "获取 pyim mode map.") + (defun pyim-process--init-cleanup () (pyim-entered-erase-buffer) (pyim-process--set-translating-flag t) diff --git a/pyim.el b/pyim.el index 8e53a80e22..e2d541119f 100644 --- a/pyim.el +++ b/pyim.el @@ -132,6 +132,9 @@ Tip: 用户也可以利用 `pyim-outcome-trigger-function-default' 函数 map) "Pyim 的 Keymap.") +(cl-defmethod pyim-process-get-mode-map () + pyim-mode-map) + ;; ** pyim 输入法定义 (defun pyim-input-method (key) "得到需要插入到 buffer 的字符串, 并将其插入到待输入 buffer.