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

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

[elpa] externals/pyim 4763e92: Add pyim-indicator-with-posframe


From: ELPA Syncer
Subject: [elpa] externals/pyim 4763e92: Add pyim-indicator-with-posframe
Date: Tue, 6 Jul 2021 23:57:12 -0400 (EDT)

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

    Add pyim-indicator-with-posframe
    
        * pyim-indicator.el (posframe): require.
        (pyim-indicator-with-posframe): New function.
---
 pyim-indicator.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pyim-indicator.el b/pyim-indicator.el
index 12eceea..a158fe4 100644
--- a/pyim-indicator.el
+++ b/pyim-indicator.el
@@ -29,6 +29,7 @@
 ;; * 代码                                                           :code:
 (require 'cl-lib)
 (require 'pyim-common)
+(require 'posframe nil t)
 
 (defgroup pyim-indicator nil
   "Indicator for pyim."
@@ -126,6 +127,20 @@ Indicator 用于显示输入法当前输入状态(英文还是中文)。"
       (setq current-input-method-title (nth 1 
pyim-indicator-modeline-string))))
   (pyim-indicator-update-mode-line))
 
+(defun pyim-indicator-with-posframe (current-input-method chinese-input-p)
+  "Pyim 自带的 indicator, 通过 posframe 来显示输入状态。"
+  (let ((buffer " *pyim-indicator*")
+        (posframe-mouse-banish nil))
+    (if (not (equal current-input-method "pyim"))
+        (posframe-hide buffer)
+      (if chinese-input-p
+          (posframe-show buffer
+                         :string "##"
+                         :font "Monospace-2"
+                         :poshandler 
#'posframe-poshandler-point-top-left-corner
+                         :background-color "green")
+        (posframe-hide buffer)))))
+
 ;; * Footer
 (provide 'pyim-indicator)
 



reply via email to

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