emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 61ea36b: Don't delete leading and trailing space fr


From: Katsumi Yamaoka
Subject: [Emacs-diffs] master 61ea36b: Don't delete leading and trailing space from CJK word (bug#25685)
Date: Tue, 14 Feb 2017 20:27:24 -0500 (EST)

branch: master
commit 61ea36bb37740315dc78ba213db51c508c489f25
Author: Katsumi Yamaoka <address@hidden>
Commit: Katsumi Yamaoka <address@hidden>

    Don't delete leading and trailing space from CJK word (bug#25685)
    
    * lisp/textmodes/fill.el (fill-delete-newlines):
    Don't delete leading and trailing space from CJK word.
    (fill-separate-heterogeneous-words-with-space):
    New user option that controls it (bug#25685).
---
 lisp/textmodes/fill.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 2957bc6..ee523ed 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -49,6 +49,15 @@ A value of nil means that any change in indentation starts a 
new paragraph."
   :group 'fill)
 (put 'colon-double-space 'safe-local-variable 'booleanp)
 
+(defcustom fill-separate-heterogeneous-words-with-space nil
+  "Non-nil means that use a space to separate words of different kind.
+This will be done with a word in the end of a line and a word in the
+beginning of the next line when concatenating them for filling those
+lines.  Whether to use a space is up to how the words are categorized."
+  :type 'boolean
+  :group 'fill
+  :version "26.1")
+
 (defvar fill-paragraph-function nil
   "Mode-specific function to fill a paragraph, or nil if there is none.
 If the function returns nil, then `fill-paragraph' does its normal work.
@@ -494,8 +503,11 @@ Point is moved to just past the fill prefix on the first 
line."
            (replace-match (get-text-property (match-beginning 0) 'fill-space))
          (let ((prev (char-before (match-beginning 0)))
                (next (following-char)))
-           (if (and (or (aref (char-category-set next) ?|)
-                        (aref (char-category-set prev) ?|))
+           (if (and (if fill-separate-heterogeneous-words-with-space
+                        (and (aref (char-category-set next) ?|)
+                             (aref (char-category-set prev) ?|))
+                      (or (aref (char-category-set next) ?|)
+                          (aref (char-category-set prev) ?|)))
                     (or (aref fill-nospace-between-words-table next)
                         (aref fill-nospace-between-words-table prev)))
                (delete-char -1))))))



reply via email to

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