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

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

[elpa] externals/pyim c13c2a6 06/36: Move code to pyim-common.el


From: ELPA Syncer
Subject: [elpa] externals/pyim c13c2a6 06/36: Move code to pyim-common.el
Date: Thu, 22 Apr 2021 22:57:15 -0400 (EDT)

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

    Move code to pyim-common.el
    
    * pyim-common.el (pyim-char-before-to-string)
    (pyim-char-after-to-string, pyim-posframe-valid-p)
    (pyim-list-merge): move from pyim.el
---
 pyim-common.el | 33 +++++++++++++++++++++++++++++++++
 pyim.el        | 33 ---------------------------------
 2 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/pyim-common.el b/pyim-common.el
index eba88ba..16c0860 100644
--- a/pyim-common.el
+++ b/pyim-common.el
@@ -188,6 +188,39 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
    (t (append (pyim-flatten-list (car my-list))
               (pyim-flatten-list (cdr my-list))))))
 
+(defun pyim-char-before-to-string (num)
+  "得到光标前第 `num' 个字符,并将其转换为字符串。"
+  (let* ((point (point))
+         (point-before (- point num)))
+    (when (and (> point-before 0)
+               (char-before point-before))
+      (char-to-string (char-before point-before)))))
+
+(defun pyim-char-after-to-string (num)
+  "得到光标后第 `num' 个字符,并将其转换为字符串。"
+  (let* ((point (point))
+         (point-after (+ point num)))
+    (when (char-after point-after)
+      (char-to-string (char-after point-after)))))
+
+(defun pyim-posframe-valid-p ()
+  "Test posframe's status."
+  (and (>= emacs-major-version 26)
+       (featurep 'posframe)
+       (not (or noninteractive
+                emacs-basic-display
+                (not (display-graphic-p))))))
+
+(defun pyim-list-merge (a b)
+  "Join list A and B to a new list, then delete dups."
+  (let ((a (if (listp a)
+               a
+             (list a)))
+        (b (if (listp b)
+               b
+             (list b))))
+    (delete-dups `(,@a ,@b))))
+
 ;; * Footer
 (provide 'pyim-common)
 
diff --git a/pyim.el b/pyim.el
index 8622146..8c2c167 100644
--- a/pyim.el
+++ b/pyim.el
@@ -1439,16 +1439,6 @@ code-prefix)。当RETURN-LIST 设置为 t 时,返回一个 code list。"
                            (substring (pyim-hanzi2xingma:wubi (nth (1- len) 
string)) 0 1))))))
       code)))
 
-(defun pyim-list-merge (a b)
-  "Join list A and B to a new list, then delete dups."
-  (let ((a (if (listp a)
-               a
-             (list a)))
-        (b (if (listp b)
-               b
-             (list b))))
-    (delete-dups `(,@a ,@b))))
-
 (defun pyim-cstring-at-point (&optional number)
   "获取光标一个中文字符串,字符数量为:NUMBER."
   (save-excursion
@@ -2976,14 +2966,6 @@ minibuffer 原来显示的信息和 pyim 选词框整合在一起显示
           (t (let ((max-mini-window-height (+ pyim-page-length 2)))
                (message string))))))
 
-(defun pyim-posframe-valid-p ()
-  "Test posframe's status."
-  (and (>= emacs-major-version 26)
-       (featurep 'posframe)
-       (not (or noninteractive
-                emacs-basic-display
-                (not (display-graphic-p))))))
-
 (defun pyim-outcome-get (&optional n)
   "获取 outcome"
   (nth (or n 0) pyim-outcome-history))
@@ -3297,21 +3279,6 @@ alist 列表。"
      ;; 当输入的字符不是标点符号时,原样插入。
      (t str))))
 
-(defun pyim-char-before-to-string (num)
-  "得到光标前第 `num' 个字符,并将其转换为字符串。"
-  (let* ((point (point))
-         (point-before (- point num)))
-    (when (and (> point-before 0)
-               (char-before point-before))
-      (char-to-string (char-before point-before)))))
-
-(defun pyim-char-after-to-string (num)
-  "得到光标后第 `num' 个字符,并将其转换为字符串。"
-  (let* ((point (point))
-         (point-after (+ point num)))
-    (when (char-after point-after)
-      (char-to-string (char-after point-after)))))
-
 (defun pyim-wash-current-line-function ()
   "清理当前行的内容,比如:删除不必要的空格,等。"
   (interactive)



reply via email to

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