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

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

Enhancement request for fill-region


From: Luc Teirlinck
Subject: Enhancement request for fill-region
Date: Tue, 28 Jan 2003 20:22:20 -0600 (CST)

Dale Worley wrote:

    It would be convenient if when fill-region was done, it would
    leave the point where it originally was.  Currently, it moves the
    point to the bottom of the region, where the mark is, making it
    impossible to immediately use any other "<verb>-region" commands.
    By comparison, most <verb>-region commands (e.g., indent-region)
    leave the point and mark where they are, so they can be used in
    succession.

I agree that this is inconvenient.  You can not even use the usual way
(C-x C-x) to restore the original region.  Just fixing this would be
completely trivial: just enclose the fill-region body in a
save-excursion form and everything is done.

There are two problems with just applying this trivial fix, however.

The first one is that there probably is some good reason for the
behavior, even though I must admit I personally can not think of any.
Indeed, from looking at the code I get the impression that the
behavior is deliberate and not the result of inadvertently forgetting
a save-excursion form.  There is an explicit:
(goto-char end)

Secondly, even if there is no good reason for the behavior, plenty of
existing code might rely it and might become broken by changing it.

There might be the possibility of giving a sixth argument
`keep-point', or similar, to fill-region and put it interactively to
t, meaning that interactively you would get the behavior you want and
a programmer could pick the behavior (s)he wants.  This in case that
the motivation for the behavior (whatever it is) applies only to its
non-interactive use.

Sincerely,

Luc Teirlinck.




reply via email to

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