branch: externals/pyim commit 4c46a6b52d710fa6a6d04d553a3065b12e1f6650 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
pyim-hacks.el: clean code. --- pyim-hacks.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyim-hacks.el b/pyim-hacks.el index c668643..a83da87 100644 --- a/pyim-hacks.el +++ b/pyim-hacks.el @@ -31,12 +31,16 @@ ;;; Code: ;; * 代码 :code: -;; ** Evil hack +;; ** Hack for Evil (defun pyim-hacks-deactivate-input-method (orig_func) (let ((deactivate-current-input-method-function (or deactivate-current-input-method-function #'ignore))) (funcall orig_func))) +(with-eval-after-load "evil" + (advice-add 'deactivate-input-method :around #'pyim-hacks-deactivate-input-method)) + +;; ** Hack for xshell or MobaXTerm. (defvar pyim-hacks-for-ssh nil "Hack of [<no-record> is undefined #402](https://github.com/tumashu/pyim/issues/402) @@ -59,9 +63,7 @@ problem, so I do this ugly hack, and wait others help ... (append key nil)) unread-command-events)))) -(with-eval-after-load "pyim" - (advice-add 'deactivate-input-method :around #'pyim-hacks-deactivate-input-method) - (advice-add 'pyim-add-unread-command-events :around #'pyim-hacks-add-unread-command-events)) +(advice-add 'pyim-add-unread-command-events :around #'pyim-hacks-add-unread-command-events) ;; * Footer (provide 'pyim-hacks)