changeset 20234:a21b3ed1915e

(fill-region-as-paragraph): Fix bug of handling the case that English letters are followed by such characters as Japanese and Chinese.
author Kenichi Handa <handa@m17n.org>
date Sat, 08 Nov 1997 03:08:40 +0000
parents f1655c49bf01
children 518f3a9e5812
files lisp/textmodes/fill.el
diffstat 1 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/fill.el	Sat Nov 08 03:08:10 1997 +0000
+++ b/lisp/textmodes/fill.el	Sat Nov 08 03:08:40 1997 +0000
@@ -449,10 +449,17 @@
 					   (save-excursion (forward-char -1)
 							   (and (looking-at "\\. ")
 								(not (looking-at "\\.  ")))))))
+			;; Find a breakable point while ignoring the
+			;; following spaces.
 			(skip-chars-forward " \t")
-			;; Skip one \c| character or one word.
-			(if (looking-at "$\\|\\c|\\|[^ \t\n]+")
-			    (goto-char (match-end 0)))
+			(if (looking-at "\\c|")
+			    (forward-char 1)
+			  (let ((pos (save-excursion
+				       (skip-chars-forward "^ \n\t")
+				       (point))))
+			    (if (re-search-forward "\\c|" pos t)
+				(forward-char -1)
+			      (goto-char pos))))
 			(setq first nil)))
 		  ;; Normally, move back over the single space between the words.
 		  (if (= (preceding-char) ?\ ) (forward-char -1))
@@ -487,10 +494,17 @@
 					   (save-excursion (forward-char -1)
 							   (and (looking-at "\\. ")
 								(not (looking-at "\\.  ")))))))
+			;; Find a breakable point while ignoring the
+			;; following spaces.
 			(skip-chars-forward " \t")
-			;; Skip one \c| character or one word.
-			(if (looking-at "$\\|\\c|\\|[^ \t\n]+")
-			    (goto-char (match-end 0)))
+			(if (looking-at "\\c|")
+			    (forward-char 1)
+			  (let ((pos (save-excursion
+				       (skip-chars-forward "^ \n\t")
+				       (point))))
+			    (if (re-search-forward "\\c|" pos t)
+				(forward-char -1)
+			      (goto-char pos))))
 			(setq first nil))))
 		;; Check again to see if we got to the end of the paragraph.
 		(if (save-excursion (skip-chars-forward " \t") (eobp))