summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-01-20 23:06:06 +0000
committerRichard M. Stallman <rms@gnu.org>1995-01-20 23:06:06 +0000
commite3f7fc2e7802edfdc07a1b93b56f7919291c20bf (patch)
tree007abc67ed73e85f156f921156aac6c1a199f025 /lisp/textmodes/fill.el
parent921c76684f4c0e2fa06ec7d7ed9fe624cc61eddf (diff)
downloademacs-e3f7fc2e7802edfdc07a1b93b56f7919291c20bf.tar.gz
(fill-region-as-paragraph): At end, advance over any newlines
that were in the region but excluded from filling.
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 535323e9f18..3e703fcf31b 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -134,7 +134,8 @@ space does not end a sentence, so don't break a line there."
(or justify (setq justify (current-justification)))
;; Don't let Adaptive Fill mode alter the fill prefix permanently.
- (let ((fill-prefix fill-prefix))
+ (let ((fill-prefix fill-prefix)
+ (skip-after 0))
;; Figure out how this paragraph is indented, if desired.
(if (and adaptive-fill-mode
(or (null fill-prefix) (string= fill-prefix "")))
@@ -172,6 +173,9 @@ space does not end a sentence, so don't break a line there."
(setq beg (point))
(goto-char (max from to))
(skip-chars-backward "\n")
+ (setq skip-after (- to (point)))
+ ;; If we omit some final newlines from the end of the narrowing,
+ ;; arrange to advance past them at the end.
(setq to (point)
from beg)
(goto-char from)
@@ -307,7 +311,8 @@ space does not end a sentence, so don't break a line there."
(justify-current-line justify t t)
(forward-line -1)
(justify-current-line justify nil t)
- (forward-line 1)))))))))
+ (forward-line 1))))))
+ (forward-char skip-after))))
(defun fill-paragraph (arg)
"Fill paragraph at or after point. Prefix arg means justify as well.