bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5399: 23.1.50; fill-region


From: Lars Magne Ingebrigtsen
Subject: bug#5399: 23.1.50; fill-region
Date: Sun, 18 Sep 2011 13:44:17 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Richard Stallman <rms@gnu.org> writes:

> I insert the following text
>
>     This is
>     a test
>
>     of fill region
>     and how it affects the mark.
>
> (but not indented), then put the mark at the end and point at the beginning,
> and type M-x fill-region.
>
> It finishes with point and the mark both at the end.
>
> It ought to leave point at the beginning if it was there before,
> at the end if it was there before.  And likewise with the mark.

The mark doesn't really change currently, I think?

The following patch should fix the problem, but it is a change in
behaviour.  Would it be OK to install this during the feature freeze?

=== modified file 'lisp/textmodes/fill.el'
--- lisp/textmodes/fill.el      2011-07-16 20:05:54 +0000
+++ lisp/textmodes/fill.el      2011-09-18 11:42:16 +0000
@@ -1010,7 +1010,8 @@
                       (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")
@@ -1041,6 +1042,8 @@
            (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))
 
 



-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]