summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1997-11-08 03:08:40 +0000
committerKenichi Handa <handa@m17n.org>1997-11-08 03:08:40 +0000
commit5282d0b99399b81c4d1febdfaa20964f6c6b05bb (patch)
tree0b4bbd16cf9154cd42083eb7a3b2dd51ee4b8a7a /lisp/textmodes
parent33425bad0f733c2acd4939cacf629e61d0dad36f (diff)
downloademacs-5282d0b99399b81c4d1febdfaa20964f6c6b05bb.tar.gz
(fill-region-as-paragraph): Fix bug of
handling the case that English letters are followed by such characters as Japanese and Chinese.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/fill.el26
1 files changed, 20 insertions, 6 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 4741c0ffdc7..78e89649ade 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -449,10 +449,17 @@ space does not end a sentence, so don't break a line there."
(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 @@ space does not end a sentence, so don't break a line there."
(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))