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

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

[elpa] externals/pyim 4ff29d474a 19/22: Add functions about assistant


From: ELPA Syncer
Subject: [elpa] externals/pyim 4ff29d474a 19/22: Add functions about assistant
Date: Fri, 24 Jun 2022 16:57:53 -0400 (EDT)

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

    Add functions about assistant
---
 pyim-page.el   |  2 +-
 pyim-scheme.el | 13 +++++++++++++
 pyim.el        |  5 ++---
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/pyim-page.el b/pyim-page.el
index e16f2ddc64..fd57221334 100644
--- a/pyim-page.el
+++ b/pyim-page.el
@@ -187,7 +187,7 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
                 :candidates candidate-showed
                 :position positon
                 :hightlight-current hightlight-current
-                :assistant-enable pyim-assistant-scheme-enable)))
+                :assistant-enable (pyim-scheme-assistant-status))))
     ;; Show page.
     (when (and (null unread-command-events)
                (null unread-post-input-method-events))
diff --git a/pyim-scheme.el b/pyim-scheme.el
index dc8df74add..817b7bbeef 100644
--- a/pyim-scheme.el
+++ b/pyim-scheme.el
@@ -159,6 +159,19 @@
        (equal (pyim-scheme-name x) scheme-name))
      pyim-schemes)))
 
+(defun pyim-scheme-assistant-status ()
+  pyim-assistant-scheme-enable)
+
+(defun pyim-scheme-enable-assistant ()
+  (setq pyim-assistant-scheme-enable t))
+
+(defun pyim-scheme-disable-assistant ()
+  (setq pyim-assistant-scheme-enable nil))
+
+(defun pyim-scheme-toggle-assistant ()
+  (setq pyim-assistant-scheme-enable
+        (not pyim-assistant-scheme-enable)))
+
 ;; 注意:这个 quanpin scheme 在 pyim 中有特殊的作用,许多功能都依赖 quanpin
 ;; scheme 的存在,所以这个 scheme 不可以删除,也不可以更改名字。
 (pyim-scheme-add
diff --git a/pyim.el b/pyim.el
index f70382d639..b3789c8555 100644
--- a/pyim.el
+++ b/pyim.el
@@ -261,7 +261,7 @@ pyim 使用函数 `pyim-activate' 启动输入法的时候,会将变量
   (pyim-process-init-dcaches)
 
   ;; 启动或者重启的时候,退出辅助输入法。
-  (setq pyim-assistant-scheme-enable nil)
+  (pyim-scheme-disable-assistant)
 
   (run-hooks 'pyim-load-hook)
   ;; Make sure personal or other dcache are saved to file before kill emacs.
@@ -678,8 +678,7 @@ FILE 的格式与 `pyim-dcache-export' 生成的文件格式相同,
       (progn
         (pyim-process-outcome-handle 'last-char)
         (pyim-process-terminate))
-    (setq pyim-assistant-scheme-enable
-          (not pyim-assistant-scheme-enable))
+    (pyim-scheme-toggle-assistant)
     (pyim-process-run)))
 
 ;; ** PYIM 输入操作命令



reply via email to

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