Commit 4b206065 authored by Jim Blandy's avatar Jim Blandy
Browse files

* window.c (window_loop): This used to keep track of the first

	window processed and wait until we came back around to it.  Sadly,
	this doesn't work if that window gets deleted.  So instead, use
	Fprevious_window to find the last window to process, and loop
	until we've done that one.

	* window.c [not MULTI_FRAME] (init_window_once): Don't forget to
	set the `mini_p' flag on the new minibuffer window to t.

	* window.c (Fwindow_at): Don't check the type of the frame

	* window.c [not MULTI_FRAME] (window_loop): Set frame to zero,
	instead of trying to decode it.

	* window.c (init_window_once): Initialize minibuf_window before
	FRAME_ROOT_WINDOW, so the latter actually points to something.
parent 8548041d
......@@ -429,10 +429,12 @@ column 0.")
int part;
if (NILP (frame))
XSET (frame, Lisp_Frame, selected_frame);
CHECK_LIVE_FRAME (frame, 2);
CHECK_NUMBER (row, 0);
CHECK_NUMBER (column, 1);
......@@ -1001,9 +1003,10 @@ window_loop (type, obj, mini, frames)
register Lisp_Object w;
register Lisp_Object best_window;
register Lisp_Object next_window;
register Lisp_Object first_window;
register Lisp_Object last_window;
FRAME_PTR frame;
/* If we're only looping through windows on a particular frame,
frame points to that frame. If we're looping through windows
on all frames, frame is 0. */
......@@ -1013,18 +1016,36 @@ window_loop (type, obj, mini, frames)
frame = selected_frame;
frame = 0;
frame = 0;
/* Pick a window to start with. */
if (XTYPE (obj) == Lisp_Window)
first_window = obj;
w = obj;
else if (frame)
first_window = FRAME_SELECTED_WINDOW (frame);
first_window = FRAME_SELECTED_WINDOW (selected_frame);
w = FRAME_SELECTED_WINDOW (selected_frame);
/* Figure out the last window we're going to mess with. Since
Fnext_window, given the same options, is guaranteed to go in a
ring, we can just use Fprevious_window to find the last one.
We can't just wait until we hit the first window again, because
it might be deleted. */
if (frame)
last_window = Fprevious_window (w, (mini ? Qt : Qnil), Qlambda);
#endif /* MULTI_FRAME */
/* We know frame is 0, so we're looping through all frames.
Or we know this isn't a MULTI_FRAME Emacs, so who cares? */
last_window = Fprevious_window (w, mini ? Qt : Qnil, Qt);
w = first_window;
best_window = Qnil;
for (;;)
/* Pick the next window now, since some operations will delete
the current window. */
......@@ -1032,7 +1053,7 @@ window_loop (type, obj, mini, frames)
if (frame)
next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda);
#endif /* MULTI_FRAME */
#endif /* MULTI_FRAME */
/* We know frame is 0, so we're looping through all frames.
Or we know this isn't a MULTI_FRAME Emacs, so who cares? */
next_window = Fnext_window (w, mini ? Qt : Qnil, Qt);
......@@ -1133,9 +1154,12 @@ window_loop (type, obj, mini, frames)
if (EQ (w, last_window))
w = next_window;
while (! EQ (w, first_window));
return best_window;
......@@ -2642,11 +2666,12 @@ init_window_once ()
#else /* not MULTI_FRAME */
extern Lisp_Object get_minibuffer ();
FRAME_ROOT_WINDOW (selected_frame) = make_window ();
minibuf_window = make_window ();
FRAME_ROOT_WINDOW (selected_frame) = make_window ();
XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->next = minibuf_window;
XWINDOW (minibuf_window)->prev = FRAME_ROOT_WINDOW (selected_frame);
XWINDOW (minibuf_window)->mini_p = Qt;
/* These values 9 and 10 are arbitrary,
just so that there is "something there."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment