diff options
| author | Richard M. Stallman <rms@gnu.org> | 1992-10-04 04:10:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1992-10-04 04:10:02 +0000 |
| commit | 89cd98f3efe0168822c727c185126efb4d96b332 (patch) | |
| tree | 13730052c0bbc2d40d1e9c3b1bc163516842a42d | |
| parent | 58ff020d725b2ded734ea4e12edf3edbb90b5299 (diff) | |
| download | emacs-89cd98f3efe0168822c727c185126efb4d96b332.tar.gz | |
(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.el | 17 |
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.") Prefix arg means justify too. From program, pass args FROM, TO and JUSTIFY-FLAG." (interactive "r\nP") + ;; Arrange for undoing the fill to restore point. + (if (and buffer-undo-list (not (eq buffer-undo-list t))) + (setq buffer-undo-list (cons (point) buffer-undo-list))) ;; Don't let Adaptive Fill mode alter the fill prefix permanently. (let ((fill-prefix fill-prefix)) ;; Figure out how this paragraph is indented, if desired. @@ -195,12 +198,14 @@ From program, pass args FROM, TO and JUSTIFY-FLAG." (defun fill-paragraph (arg) "Fill paragraph at or after point. Prefix arg means justify as well." (interactive "P") - (save-excursion - (forward-paragraph) - (or (bolp) (newline 1)) - (let ((end (point))) - (backward-paragraph) - (fill-region-as-paragraph (point) end arg)))) + (let ((before (point))) + (save-excursion + (forward-paragraph) + (or (bolp) (newline 1)) + (let ((end (point)) + (beg (progn (backward-paragraph) (point)))) + (goto-char before) + (fill-region-as-paragraph beg end arg))))) (defun fill-region (from to &optional justify-flag) "Fill each of the paragraphs in the region. |
