From: Lars Magne Ingebrigtsen Date: Tue, 10 Apr 2012 02:06:19 +0000 (+0200) Subject: (fill-region): Leave point and mark where they were before filling X-Git-Tag: emacs-24.2.90~471^2~365^2~27 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=24d78a88add65761b0d0f63777e76fca6f2d66f8;p=emacs.git (fill-region): Leave point and mark where they were before filling Fixes: debbugs:5399 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a3f992eb9dc..4e3d7b3f492 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-10 Lars Magne Ingebrigtsen + + * textmodes/fill.el (fill-region): Leave point and mark where they + were before filling (bug#5399). + 2012-04-09 Glenn Morris * version.el (emacs-bzr-get-version): 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))