emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim e856ddb: Run pyim-process-stop-daemon when deactiv


From: ELPA Syncer
Subject: [elpa] externals/pyim e856ddb: Run pyim-process-stop-daemon when deactive pyim in all buffer.
Date: Mon, 5 Jul 2021 22:57:14 -0400 (EDT)

branch: externals/pyim
commit e856ddb728d6b759c81a36f6259e9eaa316f8691
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Run pyim-process-stop-daemon when deactive pyim in all buffer.
    
        * pyim.el (pyim-inactivate): Call pyim-process-stop-daemon.
    
        * pyim-process.el (pyim-process-stop-daemon): stop daemon when pyim 
deactive
        in all buffer.
    
        * pyim-indicator.el (pyim-indicator-stop-daemon): set 
pyim-indicator-timer nil.
---
 pyim-indicator.el | 3 ++-
 pyim-process.el   | 9 ++++++++-
 pyim.el           | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pyim-indicator.el b/pyim-indicator.el
index 07ce03a..4428480 100644
--- a/pyim-indicator.el
+++ b/pyim-indicator.el
@@ -78,7 +78,8 @@ Indicator 用于显示输入法当前输入状态(英文还是中文)。"
   "Stop indicator daemon."
   (interactive)
   (when (timerp pyim-indicator-timer)
-    (cancel-timer pyim-indicator-timer))
+    (cancel-timer pyim-indicator-timer)
+    (setq pyim-indicator-timer nil))
   (pyim-indicator-revert-cursor-color))
 
 (defun pyim-indicator-daemon-function (func)
diff --git a/pyim-process.el b/pyim-process.el
index 9f1f756..c623101 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -109,7 +109,14 @@
 
 (defun pyim-process-stop-daemon ()
   "关闭 pyim 流程已经启动的 daemon."
-  (pyim-indicator-stop-daemon))
+  (interactive)
+  ;; 只有其它的 buffer 中没有启动 pyim 时,才停止 daemon.
+  ;; 因为 daemon 是服务所有 buffer 的。
+  (unless (cl-find-if
+           (lambda (buf)
+             (buffer-local-value 'current-input-method buf))
+           (remove (current-buffer) (buffer-list)))
+    (pyim-indicator-stop-daemon)))
 
 (defmacro pyim-process-with-entered-buffer (&rest forms)
   "PYIM 流程的输入保存在一个 buffer 中,使用 FORMS 处理这个 buffer
diff --git a/pyim.el b/pyim.el
index b2c7122..2a14873 100644
--- a/pyim.el
+++ b/pyim.el
@@ -610,6 +610,7 @@ FILE 的格式与 `pyim-dcache-export' 生成的文件格式相同,
   "取消 pyim 的激活状态."
   (interactive)
   (pyim-kill-local-variables)
+  (pyim-process-stop-daemon)
   (run-hooks 'pyim-inactive-hook))
 
 ;; ** 中英文输入模式切换



reply via email to

[Prev in Thread] Current Thread [Next in Thread]