aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2017-02-15 01:26:59 +0000
committerKatsumi Yamaoka2017-02-15 01:26:59 +0000
commit61ea36bb37740315dc78ba213db51c508c489f25 (patch)
treeb541cbec5286b909a306519eb8fa6d3a46cf74f7
parent4e23578127fcb08d8289567dbb7ec3ad12e09382 (diff)
downloademacs-61ea36bb37740315dc78ba213db51c508c489f25.tar.gz
emacs-61ea36bb37740315dc78ba213db51c508c489f25.zip
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).
-rw-r--r--lisp/textmodes/fill.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 2957bc62d97..ee523ed5f5c 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."
49 :group 'fill) 49 :group 'fill)
50(put 'colon-double-space 'safe-local-variable 'booleanp) 50(put 'colon-double-space 'safe-local-variable 'booleanp)
51 51
52(defcustom fill-separate-heterogeneous-words-with-space nil
53 "Non-nil means that use a space to separate words of different kind.
54This will be done with a word in the end of a line and a word in the
55beginning of the next line when concatenating them for filling those
56lines. Whether to use a space is up to how the words are categorized."
57 :type 'boolean
58 :group 'fill
59 :version "26.1")
60
52(defvar fill-paragraph-function nil 61(defvar fill-paragraph-function nil
53 "Mode-specific function to fill a paragraph, or nil if there is none. 62 "Mode-specific function to fill a paragraph, or nil if there is none.
54If the function returns nil, then `fill-paragraph' does its normal work. 63If 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."
494 (replace-match (get-text-property (match-beginning 0) 'fill-space)) 503 (replace-match (get-text-property (match-beginning 0) 'fill-space))
495 (let ((prev (char-before (match-beginning 0))) 504 (let ((prev (char-before (match-beginning 0)))
496 (next (following-char))) 505 (next (following-char)))
497 (if (and (or (aref (char-category-set next) ?|) 506 (if (and (if fill-separate-heterogeneous-words-with-space
498 (aref (char-category-set prev) ?|)) 507 (and (aref (char-category-set next) ?|)
508 (aref (char-category-set prev) ?|))
509 (or (aref (char-category-set next) ?|)
510 (aref (char-category-set prev) ?|)))
499 (or (aref fill-nospace-between-words-table next) 511 (or (aref fill-nospace-between-words-table next)
500 (aref fill-nospace-between-words-table prev))) 512 (aref fill-nospace-between-words-table prev)))
501 (delete-char -1)))))) 513 (delete-char -1))))))