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

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

[elpa] externals/pyim 8266a1e 2/2: * pyim-outcome.el (pyim-outcome-trigg


From: ELPA Syncer
Subject: [elpa] externals/pyim 8266a1e 2/2: * pyim-outcome.el (pyim-outcome-trigger-function-default): Add no-space argument.
Date: Sun, 25 Apr 2021 03:57:10 -0400 (EDT)

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

    * pyim-outcome.el (pyim-outcome-trigger-function-default): Add no-space 
argument.
---
 pyim-outcome.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pyim-outcome.el b/pyim-outcome.el
index b4e6884..78aa5ec 100644
--- a/pyim-outcome.el
+++ b/pyim-outcome.el
@@ -300,7 +300,7 @@ alist 列表。"
      (t str))))
 
 (define-obsolete-function-alias 'pyim-wash-current-line-function 
'pyim-outcome-trigger-function-default "4.0")
-(defun pyim-outcome-trigger-function-default ()
+(defun pyim-outcome-trigger-function-default (&optional no-space)
   "默认的 `pyim-outcome-trigger-function'.
 
 这个函数可以清理当前行的内容,比如:删除不必要的空格,等。"
@@ -308,6 +308,7 @@ alist 列表。"
   (let* ((begin (line-beginning-position))
          (end (point))
          (string (buffer-substring-no-properties begin end))
+         (sep (if no-space "" " "))
          new-string)
     (when (> (length string) 0)
       (delete-region begin end)
@@ -315,17 +316,17 @@ alist 列表。"
             (with-temp-buffer
               (insert string)
               (goto-char (point-min))
-              (while (re-search-forward "\\([,。;?!;、)】]\\)  
+\\([[:ascii:]]\\)" nil t)
+              (while (re-search-forward "\\([,。;?!;、)】]\\) +\\([[:ascii:]]\\)" 
nil t)
                 (replace-match (concat (match-string 1) (match-string 2))  nil 
t))
               (goto-char (point-min))
-              (while (re-search-forward "\\([[:ascii:]]\\)  +\\([(【]\\)" nil t)
+              (while (re-search-forward "\\([[:ascii:]]\\) +\\([(【]\\)" nil t)
                 (replace-match (concat (match-string 1) (match-string 2))  nil 
t))
               (goto-char (point-min))
-              (while (re-search-forward "\\([[:ascii:]]\\)  +\\(\\cc\\)" nil t)
-                (replace-match (concat (match-string 1) " " (match-string 2))  
nil t))
+              (while (re-search-forward "\\([[:ascii:]]\\) +\\(\\cc\\)" nil t)
+                (replace-match (concat (match-string 1) sep (match-string 2))  
nil t))
               (goto-char (point-min))
-              (while (re-search-forward "\\(\\cc\\)  +\\([[:ascii:]]\\)" nil t)
-                (replace-match (concat (match-string 1) " " (match-string 2))  
nil t))
+              (while (re-search-forward "\\(\\cc\\) +\\([[:ascii:]]\\)" nil t)
+                (replace-match (concat (match-string 1) sep (match-string 2))  
nil t))
               (buffer-string)))
       (insert new-string))))
 



reply via email to

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