comparison src/window.c @ 47973:b75515b80900

(window_loop): For GET_LRU_WINDOW and GET_LARGEST_WINDOW>, Only ignore truly dedicated windows. For UNSHOW_BUFFER, delete the window if it is dedicated. (Fshrink_window): Add preserve_before as was done for enlarge_window. (Vspecial_display_function): Update docstring.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 22 Oct 2002 19:28:17 +0000
parents 22b1643144e9
children 3b18ddd398f8
comparison
equal deleted inserted replaced
47972:287494c5e770 47973:b75515b80900
1859 case GET_LRU_WINDOW: 1859 case GET_LRU_WINDOW:
1860 /* t as arg means consider only full-width windows */ 1860 /* t as arg means consider only full-width windows */
1861 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w)) 1861 if (!NILP (obj) && !WINDOW_FULL_WIDTH_P (w))
1862 break; 1862 break;
1863 /* Ignore dedicated windows and minibuffers. */ 1863 /* Ignore dedicated windows and minibuffers. */
1864 if (MINI_WINDOW_P (w) || !NILP (w->dedicated)) 1864 if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt))
1865 break; 1865 break;
1866 if (NILP (best_window) 1866 if (NILP (best_window)
1867 || (XFASTINT (XWINDOW (best_window)->use_time) 1867 || (XFASTINT (XWINDOW (best_window)->use_time)
1868 > XFASTINT (w->use_time))) 1868 > XFASTINT (w->use_time)))
1869 best_window = window; 1869 best_window = window;
1912 break; 1912 break;
1913 1913
1914 case GET_LARGEST_WINDOW: 1914 case GET_LARGEST_WINDOW:
1915 { 1915 {
1916 /* Ignore dedicated windows and minibuffers. */ 1916 /* Ignore dedicated windows and minibuffers. */
1917 if (MINI_WINDOW_P (w) || !NILP (w->dedicated)) 1917 if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt))
1918 break; 1918 break;
1919 1919
1920 if (NILP (best_window)) 1920 if (NILP (best_window))
1921 best_window = window; 1921 best_window = window;
1922 else 1922 else
1952 windows = XCDR (windows); 1952 windows = XCDR (windows);
1953 1953
1954 /* Now we can safely delete the frame. */ 1954 /* Now we can safely delete the frame. */
1955 Fdelete_frame (w->frame, Qnil); 1955 Fdelete_frame (w->frame, Qnil);
1956 } 1956 }
1957 else if (!NILP (w->dedicated) && !NILP (w->parent))
1958 {
1959 Lisp_Object window;
1960 XSETWINDOW (window, w);
1961 /* If this window is dedicated and not the only window
1962 in its frame, then kill it. */
1963 Fdelete_window (window);
1964 }
1957 else 1965 else
1958 { 1966 {
1959 /* Otherwise show a different buffer in the window. */ 1967 /* Otherwise show a different buffer in the window. */
1960 w->dedicated = Qnil; 1968 w->dedicated = Qnil;
1961 Fset_window_buffer (window, buffer); 1969 Fset_window_buffer (window, buffer);
3030 Lisp_Object frames; 3038 Lisp_Object frames;
3031 3039
3032 frames = Qnil; 3040 frames = Qnil;
3033 if (FRAME_MINIBUF_ONLY_P (f)) 3041 if (FRAME_MINIBUF_ONLY_P (f))
3034 XSETFRAME (frames, last_nonminibuf_frame); 3042 XSETFRAME (frames, last_nonminibuf_frame);
3035 /* Don't try to create a window if would get an error */ 3043 /* Don't try to create a window if we would get an error. */
3036 if (split_height_threshold < window_min_height << 1) 3044 if (split_height_threshold < window_min_height << 1)
3037 split_height_threshold = window_min_height << 1; 3045 split_height_threshold = window_min_height << 1;
3038 3046
3039 /* Note that both Fget_largest_window and Fget_lru_window 3047 /* Note that both Fget_largest_window and Fget_lru_window
3040 ignore minibuffers and dedicated windows. 3048 ignore minibuffers and dedicated windows.
3158 XSETFASTINT (w->min_hscroll, 0); 3166 XSETFASTINT (w->min_hscroll, 0);
3159 set_marker_restricted_both (w->start, buf, 1, 1); 3167 set_marker_restricted_both (w->start, buf, 1, 1);
3160 set_marker_restricted_both (w->pointm, buf, 1, 1); 3168 set_marker_restricted_both (w->pointm, buf, 1, 1);
3161 3169
3162 /* Run temp-buffer-show-hook, with the chosen window selected 3170 /* Run temp-buffer-show-hook, with the chosen window selected
3163 and it sbuffer current. */ 3171 and its buffer current. */
3164 if (!NILP (Vrun_hooks)) 3172 if (!NILP (Vrun_hooks))
3165 { 3173 {
3166 Lisp_Object tem; 3174 Lisp_Object tem;
3167 tem = Fboundp (Qtemp_buffer_show_hook); 3175 tem = Fboundp (Qtemp_buffer_show_hook);
3168 if (!NILP (tem)) 3176 if (!NILP (tem))
3173 int count = SPECPDL_INDEX (); 3181 int count = SPECPDL_INDEX ();
3174 Lisp_Object prev_window; 3182 Lisp_Object prev_window;
3175 prev_window = selected_window; 3183 prev_window = selected_window;
3176 3184
3177 /* Select the window that was chosen, for running the hook. */ 3185 /* Select the window that was chosen, for running the hook. */
3186 /* Both this Fselect_window and the select_window_1
3187 below will (may) incorrectly set-buffer to the buffer
3188 displayed in the window. --stef */
3178 record_unwind_protect (Fselect_window, prev_window); 3189 record_unwind_protect (Fselect_window, prev_window);
3179 select_window_1 (window, 0); 3190 select_window_1 (window, 0);
3180 Fset_buffer (w->buffer); 3191 Fset_buffer (w->buffer);
3181 call1 (Vrun_hooks, Qtemp_buffer_show_hook); 3192 call1 (Vrun_hooks, Qtemp_buffer_show_hook);
3182 select_window_1 (prev_window, 0); 3193 select_window_1 (prev_window, 0);
3360 call1 (Vrun_hooks, Qwindow_configuration_change_hook); 3371 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
3361 3372
3362 return Qnil; 3373 return Qnil;
3363 } 3374 }
3364 3375
3365 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", 3376 DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 3, "p",
3366 doc: /* Make current window ARG lines smaller. 3377 doc: /* Make current window ARG lines smaller.
3367 From program, optional second arg non-nil means shrink sideways arg columns. 3378 From program, optional second arg non-nil means shrink sideways arg columns.
3368 Interactively, if an argument is not given, make the window one line smaller. */) 3379 Interactively, if an argument is not given, make the window one line smaller.
3369 (arg, side) 3380
3370 register Lisp_Object arg, side; 3381 Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size
3382 of the siblings above or to the left of the selected window. Only
3383 siblings to the right or below are changed. */)
3384 (arg, side, preserve_before)
3385 register Lisp_Object arg, side, preserve_before;
3371 { 3386 {
3372 CHECK_NUMBER (arg); 3387 CHECK_NUMBER (arg);
3373 enlarge_window (selected_window, -XINT (arg), !NILP (side), 0); 3388 enlarge_window (selected_window, -XINT (arg), !NILP (side),
3389 !NILP (preserve_before));
3374 3390
3375 if (! NILP (Vwindow_configuration_change_hook)) 3391 if (! NILP (Vwindow_configuration_change_hook))
3376 call1 (Vrun_hooks, Qwindow_configuration_change_hook); 3392 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
3377 3393
3378 return Qnil; 3394 return Qnil;
3648 3664
3649 h + e = h + delta 3665 h + e = h + delta
3650 delta1/n = delta 3666 delta1/n = delta
3651 delta1 = n * delta. 3667 delta1 = n * delta.
3652 3668
3653 The number of children n rquals the number of resizable 3669 The number of children n equals the number of resizable
3654 children of this window + 1 because we know window itself 3670 children of this window + 1 because we know window itself
3655 is resizable (otherwise we would have signalled an error. */ 3671 is resizable (otherwise we would have signalled an error. */
3656 3672
3657 struct window *w = XWINDOW (window); 3673 struct window *w = XWINDOW (window);
3658 Lisp_Object s; 3674 Lisp_Object s;
5954 5970
5955 DEFVAR_LISP ("special-display-function", &Vspecial_display_function, 5971 DEFVAR_LISP ("special-display-function", &Vspecial_display_function,
5956 doc: /* Function to call to make a new frame for a special buffer. 5972 doc: /* Function to call to make a new frame for a special buffer.
5957 It is called with two arguments, the buffer and optional buffer specific 5973 It is called with two arguments, the buffer and optional buffer specific
5958 data, and should return a window displaying that buffer. 5974 data, and should return a window displaying that buffer.
5959 The default value makes a separate frame for the buffer, 5975 The default value normally makes a separate frame for the buffer,
5960 using `special-display-frame-alist' to specify the frame parameters. 5976 using `special-display-frame-alist' to specify the frame parameters.
5961 5977 But if the buffer specific data includes (same-buffer . t) then the
5962 A buffer is special if its is listed in `special-display-buffer-names' 5978 buffer is displayed in the current selected window.
5979 Otherwise if it includes (same-frame . t) then the buffer is displayed in
5980 a new window in the currently selected frame.
5981
5982 A buffer is special if it is listed in `special-display-buffer-names'
5963 or matches a regexp in `special-display-regexps'. */); 5983 or matches a regexp in `special-display-regexps'. */);
5964 Vspecial_display_function = Qnil; 5984 Vspecial_display_function = Qnil;
5965 5985
5966 DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names, 5986 DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names,
5967 doc: /* *List of buffer names that should appear in the selected window. 5987 doc: /* *List of buffer names that should appear in the selected window.