aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-10-04 04:10:02 +0000
committerRichard M. Stallman1992-10-04 04:10:02 +0000
commit89cd98f3efe0168822c727c185126efb4d96b332 (patch)
tree13730052c0bbc2d40d1e9c3b1bc163516842a42d
parent58ff020d725b2ded734ea4e12edf3edbb90b5299 (diff)
downloademacs-89cd98f3efe0168822c727c185126efb4d96b332.tar.gz
emacs-89cd98f3efe0168822c727c185126efb4d96b332.zip
(fill-paragraph): Don't actually change point before
calling fill-region-as-paragraph. (fill-region-as-paragraph): Save point on undo list at start.
-rw-r--r--lisp/textmodes/fill.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 0af390ceb28..2ea712f3d01 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -57,6 +57,9 @@ for the paragraph.")
57Prefix arg means justify too. 57Prefix arg means justify too.
58From program, pass args FROM, TO and JUSTIFY-FLAG." 58From program, pass args FROM, TO and JUSTIFY-FLAG."
59 (interactive "r\nP") 59 (interactive "r\nP")
60 ;; Arrange for undoing the fill to restore point.
61 (if (and buffer-undo-list (not (eq buffer-undo-list t)))
62 (setq buffer-undo-list (cons (point) buffer-undo-list)))
60 ;; Don't let Adaptive Fill mode alter the fill prefix permanently. 63 ;; Don't let Adaptive Fill mode alter the fill prefix permanently.
61 (let ((fill-prefix fill-prefix)) 64 (let ((fill-prefix fill-prefix))
62 ;; Figure out how this paragraph is indented, if desired. 65 ;; Figure out how this paragraph is indented, if desired.
@@ -195,12 +198,14 @@ From program, pass args FROM, TO and JUSTIFY-FLAG."
195(defun fill-paragraph (arg) 198(defun fill-paragraph (arg)
196 "Fill paragraph at or after point. Prefix arg means justify as well." 199 "Fill paragraph at or after point. Prefix arg means justify as well."
197 (interactive "P") 200 (interactive "P")
198 (save-excursion 201 (let ((before (point)))
199 (forward-paragraph) 202 (save-excursion
200 (or (bolp) (newline 1)) 203 (forward-paragraph)
201 (let ((end (point))) 204 (or (bolp) (newline 1))
202 (backward-paragraph) 205 (let ((end (point))
203 (fill-region-as-paragraph (point) end arg)))) 206 (beg (progn (backward-paragraph) (point))))
207 (goto-char before)
208 (fill-region-as-paragraph beg end arg)))))
204 209
205(defun fill-region (from to &optional justify-flag) 210(defun fill-region (from to &optional justify-flag)
206 "Fill each of the paragraphs in the region. 211 "Fill each of the paragraphs in the region.