unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: rms@gnu.org
Cc: 5399@debbugs.gnu.org
Subject: bug#5399: 23.1.50; fill-region
Date: Sun, 18 Sep 2011 13:44:17 +0200	[thread overview]
Message-ID: <m3aaa2dqi6.fsf@stories.gnus.org> (raw)
In-Reply-To: <E1NWFtj-0003YU-LZ@fencepost.gnu.org> (Richard Stallman's message of "Sat, 16 Jan 2010 16:09:31 -0500")

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))
 
 \f



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





  reply	other threads:[~2011-09-18 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-16 21:09 bug#5399: 23.1.50; fill-region Richard Stallman
2011-09-18 11:44 ` Lars Magne Ingebrigtsen [this message]
2011-09-19 18:11   ` Stefan Monnier
2011-09-19 18:10     ` Lars Magne Ingebrigtsen
2012-04-10  2:06     ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3aaa2dqi6.fsf@stories.gnus.org \
    --to=larsi@gnus.org \
    --cc=5399@debbugs.gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).