aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-11-08 03:08:40 +0000
committerKenichi Handa1997-11-08 03:08:40 +0000
commitb847b1de5bea8ddbbe3ecf50f4207d18d3fa3e3d (patch)
treefff15f69de40743e3222d0b0533c029cb914327c
parentc6965ddb68510874119aa444a21f9b08946283d0 (diff)
downloademacs-b847b1de5bea8ddbbe3ecf50f4207d18d3fa3e3d.tar.gz
emacs-b847b1de5bea8ddbbe3ecf50f4207d18d3fa3e3d.zip
(fill-region-as-paragraph): Fix bug of
handling the case that English letters are followed by such characters as Japanese and Chinese.
-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."
449 (save-excursion (forward-char -1) 449 (save-excursion (forward-char -1)
450 (and (looking-at "\\. ") 450 (and (looking-at "\\. ")
451 (not (looking-at "\\. "))))))) 451 (not (looking-at "\\. ")))))))
452 ;; Find a breakable point while ignoring the
453 ;; following spaces.
452 (skip-chars-forward " \t") 454 (skip-chars-forward " \t")
453 ;; Skip one \c| character or one word. 455 (if (looking-at "\\c|")
454 (if (looking-at "$\\|\\c|\\|[^ \t\n]+") 456 (forward-char 1)
455 (goto-char (match-end 0))) 457 (let ((pos (save-excursion
458 (skip-chars-forward "^ \n\t")
459 (point))))
460 (if (re-search-forward "\\c|" pos t)
461 (forward-char -1)
462 (goto-char pos))))
456 (setq first nil))) 463 (setq first nil)))
457 ;; Normally, move back over the single space between the words. 464 ;; Normally, move back over the single space between the words.
458 (if (= (preceding-char) ?\ ) (forward-char -1)) 465 (if (= (preceding-char) ?\ ) (forward-char -1))
@@ -487,10 +494,17 @@ space does not end a sentence, so don't break a line there."
487 (save-excursion (forward-char -1) 494 (save-excursion (forward-char -1)
488 (and (looking-at "\\. ") 495 (and (looking-at "\\. ")
489 (not (looking-at "\\. "))))))) 496 (not (looking-at "\\. ")))))))
497 ;; Find a breakable point while ignoring the
498 ;; following spaces.
490 (skip-chars-forward " \t") 499 (skip-chars-forward " \t")
491 ;; Skip one \c| character or one word. 500 (if (looking-at "\\c|")
492 (if (looking-at "$\\|\\c|\\|[^ \t\n]+") 501 (forward-char 1)
493 (goto-char (match-end 0))) 502 (let ((pos (save-excursion
503 (skip-chars-forward "^ \n\t")
504 (point))))
505 (if (re-search-forward "\\c|" pos t)
506 (forward-char -1)
507 (goto-char pos))))
494 (setq first nil)))) 508 (setq first nil))))
495 ;; Check again to see if we got to the end of the paragraph. 509 ;; Check again to see if we got to the end of the paragraph.
496 (if (save-excursion (skip-chars-forward " \t") (eobp)) 510 (if (save-excursion (skip-chars-forward " \t") (eobp))