unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* select-window and select-frame
@ 2002-10-24 23:48 Stefan Monnier
  2002-10-26 20:14 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2002-10-24 23:48 UTC (permalink / raw)



As some people have noticed, the behavior of select-window was recently
changed so that it doesn't automatically select the window's frame
as well, so that we can now have the situation where the selected-window
is not on the same frame as the selected-frame.

I think this change of behavior in select-window is bad and should
be reverted.  It is incompatible and does break existing code.
Worse yet, when it introduces a bug, it might not be straightforward
to figure out where the bug is, you just end up with strange window
layouts.

Having the ability to distinguish between (selected-frame)
and (window-frame (selected-window)) is OK, but changing the behavior
of select-window is not.
I suggest we either introduce a new function that changes the
selected window without changing the selected frame, or add an argument
to select-window to control the behavior (with the default being
to behave like Emacs-21.1 and before did).


	Stefan


PS: IIRC the reason why the behavior was changed is because it is otherwise
    impossible to cycle through all the visible windows (and selecting
    them one after the other) without changing the active windows
    of other frames (the active window of the current frame can be
    preserved by using save-window-configuration but this only applies
    to the current frame).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: select-window and select-frame
  2002-10-24 23:48 select-window and select-frame Stefan Monnier
@ 2002-10-26 20:14 ` Richard Stallman
  2002-10-29 15:43   ` md5i
  2002-10-29 19:36   ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Stallman @ 2002-10-26 20:14 UTC (permalink / raw)
  Cc: emacs-devel

    I think this change of behavior in select-window is bad and should
    be reverted.  It is incompatible and does break existing code.

The solution I implemented seems to be bad, but it is not clear what a
good solution is.

The original problem is that

  (save-selected-window
    (select-window ...)
    ..)

can permanently alter the frame-selected-window of a frame.  I tried
solving it by making select-window not alter the frame-selected-window
of a frame that isn't selected.  If we don't solve it that way, we need
to solve it some other way, but what?

One idea is that save-selected-window could also save and restore the
frame-selected-window of every frame.  Another idea is to have two
different kinds of window-selection, one temporary and one "for real".
Both of these changes would have major ramifications, and so does the
solution I implemented.  It is not clear what to do.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: select-window and select-frame
  2002-10-26 20:14 ` Richard Stallman
@ 2002-10-29 15:43   ` md5i
  2002-10-29 19:36   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: md5i @ 2002-10-29 15:43 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     I think this change of behavior in select-window is bad and should
>     be reverted.  It is incompatible and does break existing code.
>
> The solution I implemented seems to be bad, but it is not clear what a
> good solution is.
>
> The original problem is that
>
>   (save-selected-window
>     (select-window ...)
>     ..)
>
> can permanently alter the frame-selected-window of a frame.  I tried
> solving it by making select-window not alter the frame-selected-window
> of a frame that isn't selected.  If we don't solve it that way, we need
> to solve it some other way, but what?
>
> One idea is that save-selected-window could also save and restore the
> frame-selected-window of every frame.  Another idea is to have two
> different kinds of window-selection, one temporary and one "for real".
> Both of these changes would have major ramifications, and so does the
> solution I implemented.  It is not clear what to do.

How much code depends on select-window changing the selected window
in a non-selected frame?  How much code walks through all windows
wrapped in `save-selected-window'?  We can choose which change to use
based on this.  

The original problem I found was in which-func.el, which used the
`save-selected-window' idiom.  Maybe for code like this we can add a
function called `save-frame-selected-winows' which saves and restores
all the frames' selected windows, but only when we think it is
necessary.

-- 
Michael Welsh Duggan
(md5i@cs.cmu.edu)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: select-window and select-frame
  2002-10-26 20:14 ` Richard Stallman
  2002-10-29 15:43   ` md5i
@ 2002-10-29 19:36   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2002-10-29 19:36 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

>     I think this change of behavior in select-window is bad and should
>     be reverted.  It is incompatible and does break existing code.
> 
> The solution I implemented seems to be bad, but it is not clear what a
> good solution is.
> 
> The original problem is that
> 
>   (save-selected-window
>     (select-window ...)
>     ..)
> 
> can permanently alter the frame-selected-window of a frame.  I tried
> solving it by making select-window not alter the frame-selected-window
> of a frame that isn't selected.  If we don't solve it that way, we need
> to solve it some other way, but what?

The problem is not so much with the "don't alter the frame-selected-window
of a frame that isn't selected" but with the fact that select-window does
not select the window's frame any more.

I think the best solution I can think of is to add an argument
to select-window which controls whether to change the selected-frame
or not (i.e. choose between the old and the new behavior).  That
means that code will need to be changed to fix the original problem,
but it seems that the original problem is not as important
as the problems introduced by the current fix.

Maybe the default could even be controlled by a variable that
could be temporarily bound by save-selected-window, although
I'm not sure if that's a good idea or not.


	Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-29 19:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-24 23:48 select-window and select-frame Stefan Monnier
2002-10-26 20:14 ` Richard Stallman
2002-10-29 15:43   ` md5i
2002-10-29 19:36   ` Stefan Monnier

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).