Commit fc357930 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(fill-region, fill-region-as-paragraph):

If specified region ends before a newline, include that newline.
parent a94c7fcc
...@@ -97,7 +97,12 @@ From program, pass args FROM, TO and JUSTIFY-FLAG." ...@@ -97,7 +97,12 @@ From program, pass args FROM, TO and JUSTIFY-FLAG."
))) )))
(save-restriction (save-restriction
(narrow-to-region from to) (goto-char (max from to))
;; If specified region ends before a newline,
;; include that newline.
(if (and (eolp) (not (eobp)))
(forward-char 1))
(narrow-to-region (min from to) (point))
(goto-char (point-min)) (goto-char (point-min))
(skip-chars-forward "\n") (skip-chars-forward "\n")
(narrow-to-region (point) (point-max)) (narrow-to-region (point) (point-max))
...@@ -256,7 +261,12 @@ If `sentence-end-double-space' is non-nil, then period followed by one ...@@ -256,7 +261,12 @@ If `sentence-end-double-space' is non-nil, then period followed by one
space does not end a sentence, so don't break a line there." space does not end a sentence, so don't break a line there."
(interactive "r\nP") (interactive "r\nP")
(save-restriction (save-restriction
(narrow-to-region from to) (goto-char (max from to))
;; If specified region ends before a newline,
;; include that newline.
(if (and (eolp) (not (eobp)))
(forward-char 1))
(narrow-to-region (min from to) (point))
(goto-char (point-min)) (goto-char (point-min))
(while (not (eobp)) (while (not (eobp))
(let ((initial (point)) (let ((initial (point))
......
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