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

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

[elpa] externals/pyim 1344bc1: Let pyim-probe works well with exwm-xim.


From: ELPA Syncer
Subject: [elpa] externals/pyim 1344bc1: Let pyim-probe works well with exwm-xim.
Date: Sat, 17 Apr 2021 02:57:08 -0400 (EDT)

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

    Let pyim-probe works well with exwm-xim.
    
        * pyim.el (pyim-page-refresh): Use pyim-exwm-enable-p.
        (pyim-page-style:exwm): use pyim-page-preview-create.
    
        * pyim-probe.el (pyim-probe-dynamic-english)
        (pyim-probe-auto-english, pyim-probe-punctuation-line-beginning): Use 
pyim-exwm-enable-p
    
        * pyim-common.el (pyim-exwm-enable-p): New function.
---
 pyim-common.el |  4 ++++
 pyim-probe.el  |  6 +++---
 pyim.el        | 14 ++------------
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/pyim-common.el b/pyim-common.el
index 62a6e72..1927bdc 100644
--- a/pyim-common.el
+++ b/pyim-common.el
@@ -143,6 +143,10 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
                  seperaters)))
     items))
 
+(defun pyim-exwm-enable-p ()
+  "测试当前是否是 exwm 环境。"
+  (string-match-p " \\*temp\\*" (buffer-name)))
+
 ;; * Footer
 (provide 'pyim-common)
 
diff --git a/pyim-probe.el b/pyim-probe.el
index f4dadb5..9b331e9 100644
--- a/pyim-probe.el
+++ b/pyim-probe.el
@@ -122,7 +122,7 @@
                 (cl-search non-digit-str-before-1 "0123456789"))
       (cl-incf offset)
       (setq non-digit-str-before-1 (pyim-char-before-to-string offset)))
-    (unless (string= (buffer-name) " *temp*") ; Make sure this probe can work 
with exim of exwm.
+    (unless (pyim-exwm-enable-p)
       (if (<= (point) (save-excursion (back-to-indentation)
                                       (point)))
           (not (or (pyim-string-match-p
@@ -146,7 +146,7 @@
 这个函数用于:`pyim-english-input-switch-functions' 。"
   (let ((str-before-1 (pyim-char-before-to-string 0))
         (str-before-2 (pyim-char-before-to-string 1)))
-    (unless (string= (buffer-name) " *temp*")
+    (unless (pyim-exwm-enable-p)
       (if (> (point) (save-excursion (back-to-indentation)
                                      (point)))
           (or (if (pyim-string-match-p " " str-before-1)
@@ -168,7 +168,7 @@
 
 用于:`pyim-punctuation-half-width-functions' 。"
   (let ((line-string (buffer-substring (point-at-bol) (point))))
-    (unless (string= (buffer-name) " *temp*") ; Make sure this probe can work 
with exim of exwm.
+    (unless (pyim-exwm-enable-p)
       (and (member (char-to-string char)
                    (mapcar #'car pyim-punctuation-dict))
            (string-match "^[ \t]*$" line-string)))))
diff --git a/pyim.el b/pyim.el
index e4db327..58534b0 100644
--- a/pyim.el
+++ b/pyim.el
@@ -2910,7 +2910,7 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
         ;; 指定的方式来显示候选词。
         (let ((message-log-max nil))
           (cond
-           ((equal (buffer-name) " *temp*")
+           ((pyim-exwm-enable-p)
             ;; when exwm-xim is used, page should be showed
             ;; in minibuffer.
             (message (pyim-page-style:exwm page-info)))
@@ -3170,17 +3170,7 @@ minibuffer 原来显示的信息和 pyim 选词框整合在一起显示
 (defun pyim-page-style:exwm (page-info)
   "专门用于 exwm 环境的 page style."
   (format "[%s]: %s(%s/%s)"
-          (let ((class (pyim-scheme-get-option (pyim-scheme-name) :class))
-                (preview (pyim-outcome-get)))
-            (when (memq class '(quanpin))
-              (let ((rest (mapconcat
-                           #'(lambda (py)
-                               (concat (nth 0 py) (nth 1 py)))
-                           (nthcdr (length preview) (car pyim-imobjs))
-                           " ")))
-                (when (string< "" rest)
-                  (setq preview (concat preview rest)))))
-            preview)
+          (pyim-page-preview-create)
           (pyim-page-menu-create
            (gethash :candidates page-info)
            (gethash :position page-info)



reply via email to

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