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

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

[elpa] externals/pyim 18827de43e 4/4: Move pyim-cstring-at-point to pyim


From: ELPA Syncer
Subject: [elpa] externals/pyim 18827de43e 4/4: Move pyim-cstring-at-point to pyim-cstring.el.
Date: Sun, 29 May 2022 17:57:49 -0400 (EDT)

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

    Move pyim-cstring-at-point to pyim-cstring.el.
    
            * pyim-cstring.el (pyim-cstring-at-point): to ...
    
            * pyim-cstring-utils.el (pyim-cstring-at-point): From ...
---
 pyim-cstring-utils.el | 17 +----------------
 pyim-cstring.el       | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/pyim-cstring-utils.el b/pyim-cstring-utils.el
index 034f583cb9..1e780c992f 100644
--- a/pyim-cstring-utils.el
+++ b/pyim-cstring-utils.el
@@ -140,22 +140,7 @@ CHINESE-STRING 分词,得到一个词条 alist,这个 alist 的元素都是
   (goto-char (point-min))
   (message "分词完成!"))
 
-;; ** 获取光标处中文字符串或者中文词条的功能
-(defun pyim-cstring-at-point (&optional number)
-  "获取光标一个中文字符串,字符数量为:NUMBER."
-  (save-excursion
-    (let* ((point (point))
-           (begin (- point number))
-           (begin (if (> begin 0)
-                      begin
-                    (point-min)))
-           (string (buffer-substring-no-properties
-                    point begin)))
-      (when (and (stringp string)
-                 (= (length string) number)
-                 (not (pyim-string-match-p "\\CC" string)))
-        string))))
-
+;; ** 获取光标处中文词条的功能
 (defun pyim-cstring-words-at-point (&optional end-of-point)
   "获取光标当前的词条列表,当 END-OF-POINT 设置为 t 时,获取光标后的词条列表。
 词条列表的每一个元素都是列表,这些列表的第一个元素为词条,第二个元素为光标处到词条
diff --git a/pyim-cstring.el b/pyim-cstring.el
index 444fab28de..a392c58aa7 100644
--- a/pyim-cstring.el
+++ b/pyim-cstring.el
@@ -79,6 +79,22 @@ NUMBER 用于递归,表示子字符串在 CSTRING 中的位置。"
         (substring cstring 0 -1)
         max-length number)))))
 
+;; ** 获取光标处中文字符串
+(defun pyim-cstring-at-point (&optional number)
+  "获取光标一个中文字符串,字符数量为:NUMBER."
+  (save-excursion
+    (let* ((point (point))
+           (begin (- point number))
+           (begin (if (> begin 0)
+                      begin
+                    (point-min)))
+           (string (buffer-substring-no-properties
+                    point begin)))
+      (when (and (stringp string)
+                 (= (length string) number)
+                 (not (pyim-string-match-p "\\CC" string)))
+        string))))
+
 ;; ** 中文字符串到拼音的转换工具
 ;;;###autoload
 (defun pyim-cstring-to-pinyin (string &optional shou-zi-mu separator



reply via email to

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