summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2012-04-10 04:06:19 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2012-04-10 04:06:19 +0200
commit24d78a88add65761b0d0f63777e76fca6f2d66f8 (patch)
treeb915263fecdc42fe3c5a293ced324dc5d06792cf /lisp/textmodes/fill.el
parent9ea49b28ab86d5207553d0827e1209276d03cd72 (diff)
downloademacs-24d78a88add65761b0d0f63777e76fca6f2d66f8.tar.gz
(fill-region): Leave point and mark where they were before filling
Fixes: debbugs:5399
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 08254c6f5f7..d0e90c99516 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -1011,7 +1011,8 @@ space does not end a sentence, so don't break a line there."
(if current-prefix-arg 'full))))
(unless (memq justify '(t nil none full center left right))
(setq justify 'full))
- (let (max beg fill-pfx)
+ (let ((start-point (point-marker))
+ max beg fill-pfx)
(goto-char (max from to))
(when to-eop
(skip-chars-backward "\n")
@@ -1042,6 +1043,8 @@ space does not end a sentence, so don't break a line there."
(setq fill-pfx
(fill-region-as-paragraph (point) end justify nosqueeze))
(goto-char end))))
+ (goto-char start-point)
+ (set-marker start-point nil)
fill-pfx))