]> git.eshelyaron.com Git - emacs.git/commitdiff
(fill-region-as-paragraph): Fix bug of
authorKenichi Handa <handa@m17n.org>
Sat, 8 Nov 1997 03:08:40 +0000 (03:08 +0000)
committerKenichi Handa <handa@m17n.org>
Sat, 8 Nov 1997 03:08:40 +0000 (03:08 +0000)
handling the case that English letters are followed by such
characters as Japanese and Chinese.

lisp/textmodes/fill.el

index 4741c0ffdc7af61b7f48808babe187b7aae03563..78e89649ade8d354699f9e3aa52048ed54af3939 100644 (file)
@@ -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))