2000 |
if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) |
if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) |
2001 |
break; |
break; |
2002 |
/* Ignore dedicated windows and minibuffers. */ |
/* Ignore dedicated windows and minibuffers. */ |
2003 |
if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt)) |
if (MINI_WINDOW_P (w) || (!mini && EQ (w->dedicated, Qt))) |
2004 |
break; |
break; |
2005 |
if (NILP (best_window) |
if (NILP (best_window) |
2006 |
|| (XFASTINT (XWINDOW (best_window)->use_time) |
|| (XFASTINT (XWINDOW (best_window)->use_time) |
2053 |
case GET_LARGEST_WINDOW: |
case GET_LARGEST_WINDOW: |
2054 |
{ |
{ |
2055 |
/* Ignore dedicated windows and minibuffers. */ |
/* Ignore dedicated windows and minibuffers. */ |
2056 |
if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt)) |
if (MINI_WINDOW_P (w) || (!mini && EQ (w->dedicated, Qt))) |
2057 |
break; |
break; |
2058 |
|
|
2059 |
if (NILP (best_window)) |
if (NILP (best_window)) |
2147 |
window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); |
window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); |
2148 |
} |
} |
2149 |
|
|
2150 |
DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, |
2151 |
doc: /* Return the window least recently selected or used for display. |
doc: /* Return the window least recently selected or used for display. |
2152 |
Return a full-width window if possible. |
Return a full-width window if possible. |
2153 |
A minibuffer window is never a candidate. |
A minibuffer window is never a candidate. |
2154 |
A dedicated window is never a candidate, so if all windows are dedicated, |
A dedicated window is never a candidate, unless DEDICATED is non-nil, |
2155 |
the value is nil. |
so if all windows are dedicated, the value is nil. |
2156 |
If optional argument FRAME is `visible', search all visible frames. |
If optional argument FRAME is `visible', search all visible frames. |
2157 |
If FRAME is 0, search all visible and iconified frames. |
If FRAME is 0, search all visible and iconified frames. |
2158 |
If FRAME is t, search all frames. |
If FRAME is t, search all frames. |
2159 |
If FRAME is nil, search only the selected frame. |
If FRAME is nil, search only the selected frame. |
2160 |
If FRAME is a frame, search only that frame. */) |
If FRAME is a frame, search only that frame. */) |
2161 |
(frame) |
(frame, dedicated) |
2162 |
Lisp_Object frame; |
Lisp_Object frame, dedicated; |
2163 |
{ |
{ |
2164 |
register Lisp_Object w; |
register Lisp_Object w; |
2165 |
/* First try for a window that is full-width */ |
/* First try for a window that is full-width */ |
2166 |
w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); |
w = window_loop (GET_LRU_WINDOW, Qt, !NILP (dedicated), frame); |
2167 |
if (!NILP (w) && !EQ (w, selected_window)) |
if (!NILP (w) && !EQ (w, selected_window)) |
2168 |
return w; |
return w; |
2169 |
/* If none of them, try the rest */ |
/* If none of them, try the rest */ |
2170 |
return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); |
return window_loop (GET_LRU_WINDOW, Qnil, !NILP (dedicated), frame); |
2171 |
} |
} |
2172 |
|
|
2173 |
DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, |
DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 2, 0, |
2174 |
doc: /* Return the largest window in area. |
doc: /* Return the largest window in area. |
2175 |
A minibuffer window is never a candidate. |
A minibuffer window is never a candidate. |
2176 |
A dedicated window is never a candidate, so if all windows are dedicated, |
A dedicated window is never a candidate unless DEDICATED is non-nil, |
2177 |
the value is nil. |
so if all windows are dedicated, the value is nil. |
2178 |
If optional argument FRAME is `visible', search all visible frames. |
If optional argument FRAME is `visible', search all visible frames. |
2179 |
If FRAME is 0, search all visible and iconified frames. |
If FRAME is 0, search all visible and iconified frames. |
2180 |
If FRAME is t, search all frames. |
If FRAME is t, search all frames. |
2181 |
If FRAME is nil, search only the selected frame. |
If FRAME is nil, search only the selected frame. |
2182 |
If FRAME is a frame, search only that frame. */) |
If FRAME is a frame, search only that frame. */) |
2183 |
(frame) |
(frame, dedicated) |
2184 |
Lisp_Object frame; |
Lisp_Object frame, dedicated; |
2185 |
{ |
{ |
2186 |
return window_loop (GET_LARGEST_WINDOW, Qnil, 0, |
return window_loop (GET_LARGEST_WINDOW, Qnil, !NILP (dedicated), |
2187 |
frame); |
frame); |
2188 |
} |
} |
2189 |
|
|
3503 |
if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame)) |
if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame)) |
3504 |
{ |
{ |
3505 |
/* Try visible frames first. */ |
/* Try visible frames first. */ |
3506 |
window = Fget_largest_window (Qvisible); |
window = Fget_largest_window (Qvisible, Qt); |
3507 |
/* If that didn't work, try iconified frames. */ |
/* If that didn't work, try iconified frames. */ |
3508 |
if (NILP (window)) |
if (NILP (window)) |
3509 |
window = Fget_largest_window (make_number (0)); |
window = Fget_largest_window (make_number (0), Qt); |
3510 |
|
#if 0 /* Don't try windows on other displays. */ |
3511 |
if (NILP (window)) |
if (NILP (window)) |
3512 |
window = Fget_largest_window (Qt); |
window = Fget_largest_window (Qt, Qt); |
3513 |
|
#endif |
3514 |
} |
} |
3515 |
else |
else |
3516 |
window = Fget_largest_window (frames); |
window = Fget_largest_window (frames, Qt); |
3517 |
|
|
3518 |
/* If we got a tall enough full-width window that can be split, |
/* If we got a tall enough full-width window that can be split, |
3519 |
split it. */ |
split it. */ |
3526 |
{ |
{ |
3527 |
Lisp_Object upper, lower, other; |
Lisp_Object upper, lower, other; |
3528 |
|
|
3529 |
window = Fget_lru_window (frames); |
window = Fget_lru_window (frames, Qt); |
3530 |
/* If the LRU window is selected, and big enough, |
/* If the LRU window is selected, and big enough, |
3531 |
and can be split, split it. */ |
and can be split, split it. */ |
3532 |
if (!NILP (window) |
if (!NILP (window) |
3541 |
if (NILP (window)) |
if (NILP (window)) |
3542 |
window = Fget_buffer_window (buffer, Qvisible); |
window = Fget_buffer_window (buffer, Qvisible); |
3543 |
if (NILP (window)) |
if (NILP (window)) |
3544 |
window = Fget_largest_window (Qvisible); |
window = Fget_largest_window (Qvisible, Qnil); |
3545 |
/* If that didn't work, try iconified frames. */ |
/* If that didn't work, try iconified frames. */ |
3546 |
if (NILP (window)) |
if (NILP (window)) |
3547 |
window = Fget_buffer_window (buffer, make_number (0)); |
window = Fget_buffer_window (buffer, make_number (0)); |
3548 |
if (NILP (window)) |
if (NILP (window)) |
3549 |
window = Fget_largest_window (make_number (0)); |
window = Fget_largest_window (make_number (0), Qnil); |
3550 |
/* Try invisible frames. */ |
|
3551 |
|
#if 0 /* Don't try frames on other displays. */ |
3552 |
if (NILP (window)) |
if (NILP (window)) |
3553 |
window = Fget_buffer_window (buffer, Qt); |
window = Fget_buffer_window (buffer, Qt); |
3554 |
if (NILP (window)) |
if (NILP (window)) |
3555 |
window = Fget_largest_window (Qt); |
window = Fget_largest_window (Qt, Qnil); |
3556 |
|
#endif |
3557 |
/* As a last resort, make a new frame. */ |
/* As a last resort, make a new frame. */ |
3558 |
if (NILP (window)) |
if (NILP (window)) |
3559 |
window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
3580 |
} |
} |
3581 |
} |
} |
3582 |
else |
else |
3583 |
window = Fget_lru_window (Qnil); |
window = Fget_lru_window (Qnil, Qnil); |
3584 |
|
|
3585 |
Fset_window_buffer (window, buffer, Qnil); |
Fset_window_buffer (window, buffer, Qnil); |
3586 |
return display_buffer_1 (window); |
return display_buffer_1 (window); |