Commit dcfe5c05 authored by Karl Heuer's avatar Karl Heuer
Browse files

(fill-region-as-paragraph): Check again for reaching

the end of the paragraph, after we adjust for places we can't break
and make sure to keep at least one word.
parent f82966e4
......@@ -197,6 +197,7 @@ space does not end a sentence, so don't break a line there."
(setq from (point))
;; Delete all but one soft newline at end of region.
;; And leave TO before that one.
(goto-char to)
(while (and (> (point) from) (eq ?\n (char-after (1- (point)))))
(if (and oneleft
......@@ -362,6 +363,9 @@ space does not end a sentence, so don't break a line there."
(skip-chars-forward " \t")
(skip-chars-forward "^ \t\n")
(setq first nil))))
;; Check again to see if we got to the end of the paragraph.
(if (eobp)
(or nosqueeze (delete-horizontal-space))
;; Replace whitespace here with one newline, then indent to left
;; margin.
(skip-chars-backward " \t")
......@@ -375,7 +379,7 @@ space does not end a sentence, so don't break a line there."
(and fill-prefix (not (equal fill-prefix ""))
(progn
(insert-and-inherit fill-prefix)
(setq prefixcol (current-column)))))
(setq prefixcol (current-column))))))
;; Justify the line just ended, if desired.
(if justify
(if (eobp)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment