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

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

Re: Point of wrong window used in read-from-minibuffer?


From: Richard Stallman
Subject: Re: Point of wrong window used in read-from-minibuffer?
Date: Thu, 14 Apr 2005 12:21:35 -0400

    If you try my example again:

          % emacs -Q
          [ type in some random text]
          C-x 2
          [ move point elsewhere ]
          M-: (save-window-excursion (select-window (next-window))) RET

    you'll see that at the end the second window's point is being set to the
    value of the first window's point.

I see what behavior you mean, but that is not the way to understand
it.  It doesn't concern the second window's point, or the first
window's point, because neither of them is in use at the time in
question.

Before exit from the save-window-excursion, the first window's point
is not in use, because it's the selected window.  The current buffer's
own value of point is the one that takes effect.

After exit from the save-window-excursion, the second window is selected,
so its point value is not in use.  The current buffer's own value of
point continues to be the one that takes effect.

It happens that the current buffer's own value of point is unchanged
through this process, because save-window-excursion is not supposed to
restore that.  It is supposed to leave that value alone, and it does.
(Or rather, it did so before you made a change.)

I agree that the current behavior is counterintuitive in this case.
Perhaps a different behavior would be better.  However, in order to
consider a different behavior, we have to have a clear picture of it.
What behavior does your patch result in?  We need to be able to
document it clearly and in general.

Also, there's the possibility that this change will break some code.
Some uses of save-window-excursion expect to do (goto-char ...) inside
the save-window-excursion and have point still be at that place
outside the save-window-excursion.  That's the kind of case that this
patch could break.

Maybe there are no cases that in fact would break.  Maybe the places
that do that don't switch windows in a way that could cause trouble.
But it leads me to ask: does putting (save-excursion ...) around
the call to save-window-excursion fix the problem?




reply via email to

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