aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorStefan Monnier2005-11-01 08:01:40 +0000
committerStefan Monnier2005-11-01 08:01:40 +0000
commit3cbb13c82d7c8e6d0446f55c60e8e1e43b909a02 (patch)
treee28ca374c5d59f808ca66884c9e0cb941e0cc235 /src/window.c
parent20e3cbfd339d87e42fbe0325e25aa757ffbef6c6 (diff)
downloademacs-3cbb13c82d7c8e6d0446f55c60e8e1e43b909a02.tar.gz
emacs-3cbb13c82d7c8e6d0446f55c60e8e1e43b909a02.zip
(window_loop): For LRU and LARGEST, let the `mini' argument
determine whether to consider dedicated windows as well. (Fget_lru_window, Fget_largest_window): Add `dedicated' argument. (Fdisplay_buffer): Do consider dedicated windows in those cases where we will split the window rather than reuse it. Don't try to use windows on other displays.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/window.c b/src/window.c
index 96cafc5820e..fe3572fba25 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2000,7 +2000,7 @@ window_loop (type, obj, mini, frames)
2000 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) 2000 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w))
2001 break; 2001 break;
2002 /* Ignore dedicated windows and minibuffers. */ 2002 /* Ignore dedicated windows and minibuffers. */
2003 if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt)) 2003 if (MINI_WINDOW_P (w) || (!mini && EQ (w->dedicated, Qt)))
2004 break; 2004 break;
2005 if (NILP (best_window) 2005 if (NILP (best_window)
2006 || (XFASTINT (XWINDOW (best_window)->use_time) 2006 || (XFASTINT (XWINDOW (best_window)->use_time)
@@ -2053,7 +2053,7 @@ window_loop (type, obj, mini, frames)
2053 case GET_LARGEST_WINDOW: 2053 case GET_LARGEST_WINDOW:
2054 { 2054 {
2055 /* Ignore dedicated windows and minibuffers. */ 2055 /* Ignore dedicated windows and minibuffers. */
2056 if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt)) 2056 if (MINI_WINDOW_P (w) || (!mini && EQ (w->dedicated, Qt)))
2057 break; 2057 break;
2058 2058
2059 if (NILP (best_window)) 2059 if (NILP (best_window))
@@ -2147,43 +2147,43 @@ check_all_windows ()
2147 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); 2147 window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt);
2148} 2148}
2149 2149
2150DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, 2150DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0,
2151 doc: /* Return the window least recently selected or used for display. 2151 doc: /* Return the window least recently selected or used for display.
2152Return a full-width window if possible. 2152Return a full-width window if possible.
2153A minibuffer window is never a candidate. 2153A minibuffer window is never a candidate.
2154A dedicated window is never a candidate, so if all windows are dedicated, 2154A dedicated window is never a candidate, unless DEDICATED is non-nil,
2155the value is nil. 2155 so if all windows are dedicated, the value is nil.
2156If optional argument FRAME is `visible', search all visible frames. 2156If optional argument FRAME is `visible', search all visible frames.
2157If FRAME is 0, search all visible and iconified frames. 2157If FRAME is 0, search all visible and iconified frames.
2158If FRAME is t, search all frames. 2158If FRAME is t, search all frames.
2159If FRAME is nil, search only the selected frame. 2159If FRAME is nil, search only the selected frame.
2160If FRAME is a frame, search only that frame. */) 2160If FRAME is a frame, search only that frame. */)
2161 (frame) 2161 (frame, dedicated)
2162 Lisp_Object frame; 2162 Lisp_Object frame, dedicated;
2163{ 2163{
2164 register Lisp_Object w; 2164 register Lisp_Object w;
2165 /* First try for a window that is full-width */ 2165 /* First try for a window that is full-width */
2166 w = window_loop (GET_LRU_WINDOW, Qt, 0, frame); 2166 w = window_loop (GET_LRU_WINDOW, Qt, !NILP (dedicated), frame);
2167 if (!NILP (w) && !EQ (w, selected_window)) 2167 if (!NILP (w) && !EQ (w, selected_window))
2168 return w; 2168 return w;
2169 /* If none of them, try the rest */ 2169 /* If none of them, try the rest */
2170 return window_loop (GET_LRU_WINDOW, Qnil, 0, frame); 2170 return window_loop (GET_LRU_WINDOW, Qnil, !NILP (dedicated), frame);
2171} 2171}
2172 2172
2173DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, 2173DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 2, 0,
2174 doc: /* Return the largest window in area. 2174 doc: /* Return the largest window in area.
2175A minibuffer window is never a candidate. 2175A minibuffer window is never a candidate.
2176A dedicated window is never a candidate, so if all windows are dedicated, 2176A dedicated window is never a candidate unless DEDICATED is non-nil,
2177the value is nil. 2177 so if all windows are dedicated, the value is nil.
2178If optional argument FRAME is `visible', search all visible frames. 2178If optional argument FRAME is `visible', search all visible frames.
2179If FRAME is 0, search all visible and iconified frames. 2179If FRAME is 0, search all visible and iconified frames.
2180If FRAME is t, search all frames. 2180If FRAME is t, search all frames.
2181If FRAME is nil, search only the selected frame. 2181If FRAME is nil, search only the selected frame.
2182If FRAME is a frame, search only that frame. */) 2182If FRAME is a frame, search only that frame. */)
2183 (frame) 2183 (frame, dedicated)
2184 Lisp_Object frame; 2184 Lisp_Object frame, dedicated;
2185{ 2185{
2186 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, 2186 return window_loop (GET_LARGEST_WINDOW, Qnil, !NILP (dedicated),
2187 frame); 2187 frame);
2188} 2188}
2189 2189
@@ -3503,15 +3503,17 @@ displayed. */)
3503 if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame)) 3503 if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame))
3504 { 3504 {
3505 /* Try visible frames first. */ 3505 /* Try visible frames first. */
3506 window = Fget_largest_window (Qvisible); 3506 window = Fget_largest_window (Qvisible, Qt);
3507 /* If that didn't work, try iconified frames. */ 3507 /* If that didn't work, try iconified frames. */
3508 if (NILP (window)) 3508 if (NILP (window))
3509 window = Fget_largest_window (make_number (0)); 3509 window = Fget_largest_window (make_number (0), Qt);
3510#if 0 /* Don't try windows on other displays. */
3510 if (NILP (window)) 3511 if (NILP (window))
3511 window = Fget_largest_window (Qt); 3512 window = Fget_largest_window (Qt, Qt);
3513#endif
3512 } 3514 }
3513 else 3515 else
3514 window = Fget_largest_window (frames); 3516 window = Fget_largest_window (frames, Qt);
3515 3517
3516 /* If we got a tall enough full-width window that can be split, 3518 /* If we got a tall enough full-width window that can be split,
3517 split it. */ 3519 split it. */
@@ -3524,7 +3526,7 @@ displayed. */)
3524 { 3526 {
3525 Lisp_Object upper, lower, other; 3527 Lisp_Object upper, lower, other;
3526 3528
3527 window = Fget_lru_window (frames); 3529 window = Fget_lru_window (frames, Qt);
3528 /* If the LRU window is selected, and big enough, 3530 /* If the LRU window is selected, and big enough,
3529 and can be split, split it. */ 3531 and can be split, split it. */
3530 if (!NILP (window) 3532 if (!NILP (window)
@@ -3539,17 +3541,19 @@ displayed. */)
3539 if (NILP (window)) 3541 if (NILP (window))
3540 window = Fget_buffer_window (buffer, Qvisible); 3542 window = Fget_buffer_window (buffer, Qvisible);
3541 if (NILP (window)) 3543 if (NILP (window))
3542 window = Fget_largest_window (Qvisible); 3544 window = Fget_largest_window (Qvisible, Qnil);
3543 /* If that didn't work, try iconified frames. */ 3545 /* If that didn't work, try iconified frames. */
3544 if (NILP (window)) 3546 if (NILP (window))
3545 window = Fget_buffer_window (buffer, make_number (0)); 3547 window = Fget_buffer_window (buffer, make_number (0));
3546 if (NILP (window)) 3548 if (NILP (window))
3547 window = Fget_largest_window (make_number (0)); 3549 window = Fget_largest_window (make_number (0), Qnil);
3548 /* Try invisible frames. */ 3550
3551#if 0 /* Don't try frames on other displays. */
3549 if (NILP (window)) 3552 if (NILP (window))
3550 window = Fget_buffer_window (buffer, Qt); 3553 window = Fget_buffer_window (buffer, Qt);
3551 if (NILP (window)) 3554 if (NILP (window))
3552 window = Fget_largest_window (Qt); 3555 window = Fget_largest_window (Qt, Qnil);
3556#endif
3553 /* As a last resort, make a new frame. */ 3557 /* As a last resort, make a new frame. */
3554 if (NILP (window)) 3558 if (NILP (window))
3555 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); 3559 window = Fframe_selected_window (call0 (Vpop_up_frame_function));
@@ -3576,7 +3580,7 @@ displayed. */)
3576 } 3580 }
3577 } 3581 }
3578 else 3582 else
3579 window = Fget_lru_window (Qnil); 3583 window = Fget_lru_window (Qnil, Qnil);
3580 3584
3581 Fset_window_buffer (window, buffer, Qnil); 3585 Fset_window_buffer (window, buffer, Qnil);
3582 return display_buffer_1 (window); 3586 return display_buffer_1 (window);