comparison src/window.c @ 95590:9a4b27c8feec

* window.el (display-buffer-function, special-display-p) (special-display-buffer-names, special-display-regexps) (special-display-function, same-window-p, same-window-buffer-names) (same-window-regexps, pop-up-frames, display-buffer-reuse-frames) (pop-up-frame-function, pop-up-windows) (split-window-preferred-function, split-height-threshold) (split-width-threshold, window--splittable-p) (window--try-to-split-window, window--frame-usable-p) (even-window-heights, window--even-window-heights) (window--display-buffer-1, window--display-buffer-2, display-buffer) (pop-to-buffer): Move from window.c and buffer.c. (split-window-preferred-horizontally): Remove. * cus-start.el: Remove corresponding declarations. * window.c (pop_up_windows, pop_up_frames) (display_buffer_reuse_frames, Vpop_up_frame_function) (Vdisplay_buffer_function, Veven_window_heights) (Vspecial_display_buffer_names, Vspecial_display_regexps) (Vspecial_display_function, Vsame_window_buffer_names) (Vsame_window_regexps, split_height_threshold) (Vsplit_window_preferred_function): Move those vars to window.el. (display_buffer_1, Fspecial_display_p, Fsame_window_p) (Fdisplay_buffer): Move those functions to window.el. (syms_of_window): Remove corresponding declarations. (display_buffer): New function. (temp_output_buffer_show, Fother_window_for_scrolling): Use it. * dispnew.c (Flast_nonminibuf_frame): New function. * buffer.c (Fpop_to_buffer): Move to window.el.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 05 Jun 2008 18:00:36 +0000
parents b3c0438c570b
children edc51d72cb17
comparison
equal deleted inserted replaced
95589:4f530a89d1ee 95590:9a4b27c8feec
50 #include "macterm.h" 50 #include "macterm.h"
51 #endif 51 #endif
52 52
53 53
54 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 54 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
55 Lisp_Object Qdisplay_buffer;
55 Lisp_Object Qscroll_up, Qscroll_down; 56 Lisp_Object Qscroll_up, Qscroll_down;
56 Lisp_Object Qwindow_size_fixed; 57 Lisp_Object Qwindow_size_fixed;
58
57 extern Lisp_Object Qleft_margin, Qright_margin; 59 extern Lisp_Object Qleft_margin, Qright_margin;
58 60
59 static int displayed_window_lines P_ ((struct window *)); 61 static int displayed_window_lines P_ ((struct window *));
60 static struct window *decode_window P_ ((Lisp_Object)); 62 static struct window *decode_window P_ ((Lisp_Object));
61 static int count_windows P_ ((struct window *)); 63 static int count_windows P_ ((struct window *));
137 /* If a window gets smaller than either of these, it is removed. */ 139 /* If a window gets smaller than either of these, it is removed. */
138 140
139 EMACS_INT window_min_height; 141 EMACS_INT window_min_height;
140 EMACS_INT window_min_width; 142 EMACS_INT window_min_width;
141 143
142 /* Nonzero implies Fdisplay_buffer should create windows. */
143
144 int pop_up_windows;
145
146 /* Nonzero implies make new frames for Fdisplay_buffer. */
147
148 int pop_up_frames;
149
150 /* Nonzero means reuse existing frames for displaying buffers. */
151
152 int display_buffer_reuse_frames;
153
154 /* Non-nil means use this function instead of default */
155
156 Lisp_Object Vpop_up_frame_function;
157
158 /* Function to call to handle Fdisplay_buffer. */
159
160 Lisp_Object Vdisplay_buffer_function;
161
162 /* Non-nil means that Fdisplay_buffer should even the heights of windows. */
163
164 Lisp_Object Veven_window_heights;
165
166 /* List of buffer *names* for buffers that should have their own frames. */
167
168 Lisp_Object Vspecial_display_buffer_names;
169
170 /* List of regexps for buffer names that should have their own frames. */
171
172 Lisp_Object Vspecial_display_regexps;
173
174 /* Function to pop up a special frame. */
175
176 Lisp_Object Vspecial_display_function;
177
178 /* List of buffer *names* for buffers to appear in selected window. */
179
180 Lisp_Object Vsame_window_buffer_names;
181
182 /* List of regexps for buffer names to appear in selected window. */
183
184 Lisp_Object Vsame_window_regexps;
185
186 /* Hook run at end of temp_output_buffer_show. */ 144 /* Hook run at end of temp_output_buffer_show. */
187 145
188 Lisp_Object Qtemp_buffer_show_hook; 146 Lisp_Object Qtemp_buffer_show_hook;
189
190 /* Fdisplay_buffer always splits the largest window
191 if that window is more than this high. */
192
193 EMACS_INT split_height_threshold;
194
195 /* How to split windows (horizontally/vertically/hybrid). */
196
197 Lisp_Object Vsplit_window_preferred_function;
198 147
199 /* Number of lines of continuity in scrolling by screenfuls. */ 148 /* Number of lines of continuity in scrolling by screenfuls. */
200 149
201 EMACS_INT next_screen_context_lines; 150 EMACS_INT next_screen_context_lines;
202 151
3637 Lisp_Object window; 3586 Lisp_Object window;
3638 { 3587 {
3639 return Fselect_window (window, Qt); 3588 return Fselect_window (window, Qt);
3640 } 3589 }
3641 3590
3642 /* Deiconify the frame containing the window WINDOW, 3591 Lisp_Object
3643 unless it is the selected frame; 3592 display_buffer (buffer, not_this_window_p, override_frame)
3644 then return WINDOW. 3593 Lisp_Object buffer, not_this_window_p, override_frame;
3645 3594 {
3646 The reason for the exception for the selected frame 3595 return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame);
3647 is that it seems better not to change the selected frames visibility 3596 }
3648 merely because of displaying a different buffer in it.
3649 The deiconification is useful when a buffer gets shown in
3650 another frame that you were not using lately. */
3651
3652 static Lisp_Object
3653 display_buffer_1 (window)
3654 Lisp_Object window;
3655 {
3656 Lisp_Object frame = XWINDOW (window)->frame;
3657 FRAME_PTR f = XFRAME (frame);
3658
3659 FRAME_SAMPLE_VISIBILITY (f);
3660
3661 if (EQ (frame, selected_frame))
3662 ; /* Assume the selected frame is already visible enough. */
3663 else if (minibuf_level > 0
3664 && MINI_WINDOW_P (XWINDOW (selected_window))
3665 && WINDOW_LIVE_P (minibuf_selected_window)
3666 && EQ (frame, WINDOW_FRAME (XWINDOW (minibuf_selected_window))))
3667 ; /* Assume the frame from which we invoked the minibuffer is visible. */
3668 else
3669 {
3670 if (FRAME_ICONIFIED_P (f))
3671 Fmake_frame_visible (frame);
3672 else if (FRAME_VISIBLE_P (f))
3673 Fraise_frame (frame);
3674 }
3675
3676 return window;
3677 }
3678
3679 DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0,
3680 doc: /* Returns non-nil if a buffer named BUFFER-NAME gets a special frame.
3681 If the value is t, `display-buffer' or `pop-to-buffer' would create a
3682 special frame for that buffer using the default frame parameters.
3683
3684 If the value is a list, it is a list of frame parameters that would be used
3685 to make a frame for that buffer.
3686 The variables `special-display-buffer-names'
3687 and `special-display-regexps' control this. */)
3688 (buffer_name)
3689 Lisp_Object buffer_name;
3690 {
3691 Lisp_Object tem;
3692
3693 CHECK_STRING (buffer_name);
3694
3695 tem = Fmember (buffer_name, Vspecial_display_buffer_names);
3696 if (!NILP (tem))
3697 return Qt;
3698
3699 tem = Fassoc (buffer_name, Vspecial_display_buffer_names);
3700 if (!NILP (tem))
3701 return XCDR (tem);
3702
3703 for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCDR (tem))
3704 {
3705 Lisp_Object car = XCAR (tem);
3706 if (STRINGP (car)
3707 && fast_string_match (car, buffer_name) >= 0)
3708 return Qt;
3709 else if (CONSP (car)
3710 && STRINGP (XCAR (car))
3711 && fast_string_match (XCAR (car), buffer_name) >= 0)
3712 return XCDR (car);
3713 }
3714 return Qnil;
3715 }
3716
3717 DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0,
3718 doc: /* Returns non-nil if a buffer named BUFFER-NAME would use the same window.
3719 More precisely, if `display-buffer' or `pop-to-buffer' would display
3720 that buffer in the selected window rather than (as usual) in some other window.
3721 See `same-window-buffer-names' and `same-window-regexps'. */)
3722 (buffer_name)
3723 Lisp_Object buffer_name;
3724 {
3725 Lisp_Object tem;
3726
3727 CHECK_STRING (buffer_name);
3728
3729 tem = Fmember (buffer_name, Vsame_window_buffer_names);
3730 if (!NILP (tem))
3731 return Qt;
3732
3733 tem = Fassoc (buffer_name, Vsame_window_buffer_names);
3734 if (!NILP (tem))
3735 return Qt;
3736
3737 for (tem = Vsame_window_regexps; CONSP (tem); tem = XCDR (tem))
3738 {
3739 Lisp_Object car = XCAR (tem);
3740 if (STRINGP (car)
3741 && fast_string_match (car, buffer_name) >= 0)
3742 return Qt;
3743 else if (CONSP (car)
3744 && STRINGP (XCAR (car))
3745 && fast_string_match (XCAR (car), buffer_name) >= 0)
3746 return Qt;
3747 }
3748 return Qnil;
3749 }
3750
3751 /* Use B so the default is (other-buffer). */
3752 DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 3,
3753 "BDisplay buffer: \nP",
3754 doc: /* Make BUFFER appear in some window but don't select it.
3755 BUFFER must be the name of an existing buffer, or, when called from Lisp,
3756 a buffer.
3757 If BUFFER is shown already in some window, just use that one,
3758 unless the window is the selected window and the optional second
3759 argument NOT-THIS-WINDOW is non-nil (interactively, with prefix arg).
3760 If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER.
3761 Returns the window displaying BUFFER.
3762 If `display-buffer-reuse-frames' is non-nil, and another frame is currently
3763 displaying BUFFER, then simply raise that frame.
3764
3765 The variables `special-display-buffer-names',
3766 `special-display-regexps', `same-window-buffer-names', and
3767 `same-window-regexps' customize how certain buffer names are handled.
3768 The latter two take effect only if NOT-THIS-WINDOW is nil.
3769
3770 If optional argument FRAME is `visible', check all visible frames
3771 for a window to use.
3772 If FRAME is 0, check all visible and iconified frames.
3773 If FRAME is t, check all frames.
3774 If FRAME is a frame, check only that frame.
3775 If FRAME is nil, check only the selected frame
3776 (actually the last nonminibuffer frame),
3777 unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil,
3778 which means search visible and iconified frames.
3779
3780 If a full-width window on a splittable frame is available to display
3781 the buffer, it may be split, subject to the value of the variable
3782 `split-height-threshold'.
3783
3784 If `even-window-heights' is non-nil, window heights will be evened out
3785 if displaying the buffer causes two vertically adjacent windows to be
3786 displayed. */)
3787 (buffer, not_this_window, frame)
3788 Lisp_Object buffer, not_this_window, frame;
3789 {
3790 register Lisp_Object window, tem, swp;
3791 struct frame *f;
3792
3793 swp = Qnil;
3794 buffer = Fget_buffer (buffer);
3795 CHECK_BUFFER (buffer);
3796
3797 if (!NILP (Vdisplay_buffer_function))
3798 return call2 (Vdisplay_buffer_function, buffer, not_this_window);
3799
3800 if (NILP (not_this_window)
3801 && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
3802 return display_buffer_1 (selected_window);
3803
3804 /* See if the user has specified this buffer should appear
3805 in the selected window. */
3806 if (NILP (not_this_window))
3807 {
3808 swp = Fsame_window_p (XBUFFER (buffer)->name);
3809 if (!NILP (swp) && !no_switch_window (selected_window))
3810 {
3811 Fswitch_to_buffer (buffer, Qnil);
3812 return display_buffer_1 (selected_window);
3813 }
3814 }
3815
3816 /* If the user wants pop-up-frames or display-buffer-reuse-frames,
3817 look for a window showing BUFFER on any visible or iconified frame.
3818 Otherwise search only the current frame. */
3819 if (! NILP (frame))
3820 tem = frame;
3821 else if (pop_up_frames
3822 || display_buffer_reuse_frames
3823 || last_nonminibuf_frame == 0)
3824 XSETFASTINT (tem, 0);
3825 else
3826 XSETFRAME (tem, last_nonminibuf_frame);
3827
3828 window = Fget_buffer_window (buffer, tem);
3829 if (!NILP (window)
3830 && (NILP (not_this_window) || !EQ (window, selected_window)))
3831 return display_buffer_1 (window);
3832
3833 /* Certain buffer names get special handling. */
3834 if (!NILP (Vspecial_display_function) && NILP (swp))
3835 {
3836 tem = Fspecial_display_p (XBUFFER (buffer)->name);
3837 if (EQ (tem, Qt))
3838 return call1 (Vspecial_display_function, buffer);
3839 if (CONSP (tem))
3840 return call2 (Vspecial_display_function, buffer, tem);
3841 }
3842
3843 /* If there are no frames open that have more than a minibuffer,
3844 we need to create a new frame. */
3845 if (pop_up_frames || last_nonminibuf_frame == 0)
3846 {
3847 window = Fframe_selected_window (call0 (Vpop_up_frame_function));
3848 Fset_window_buffer (window, buffer, Qnil);
3849 return display_buffer_1 (window);
3850 }
3851
3852 f = SELECTED_FRAME ();
3853 if (pop_up_windows
3854 || FRAME_MINIBUF_ONLY_P (f)
3855 /* If the current frame is a special display frame,
3856 don't try to reuse its windows. */
3857 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated))
3858 {
3859 Lisp_Object frames;
3860 struct gcpro gcpro1;
3861 GCPRO1 (buffer);
3862
3863 frames = Qnil;
3864 if (FRAME_MINIBUF_ONLY_P (f))
3865 XSETFRAME (frames, last_nonminibuf_frame);
3866
3867 /* Note that both Fget_largest_window and Fget_lru_window
3868 ignore minibuffers and dedicated windows.
3869 This means they can return nil. */
3870
3871 /* If the frame we would try to split cannot be split,
3872 try other frames. */
3873 if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame))
3874 {
3875 /* Try visible frames first. */
3876 window = Fget_largest_window (Qvisible, Qt);
3877 /* If that didn't work, try iconified frames. */
3878 if (NILP (window))
3879 window = Fget_largest_window (make_number (0), Qt);
3880 #if 0 /* Don't try windows on other displays. */
3881 if (NILP (window))
3882 window = Fget_largest_window (Qt, Qt);
3883 #endif
3884 }
3885 else
3886 window = Fget_largest_window (frames, Qt);
3887
3888 tem = Qnil;
3889 if (!NILP (Vsplit_window_preferred_function))
3890 tem = call1 (Vsplit_window_preferred_function, window);
3891
3892 if (!NILP (tem))
3893 window = tem;
3894 else
3895 /* If the largest window is tall enough, full-width, and either eligible
3896 for splitting or the only window, split it. */
3897 if (!NILP (window)
3898 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
3899 && WINDOW_FULL_WIDTH_P (XWINDOW (window))
3900 && (window_height (window) >= split_height_threshold
3901 || (NILP (XWINDOW (window)->parent)))
3902 && (window_height (window)
3903 >= (2 * window_min_size_2 (XWINDOW (window), 0, 0))))
3904 window = Fsplit_window (window, Qnil, Qnil);
3905 else
3906 {
3907 Lisp_Object upper, other;
3908
3909 window = Fget_lru_window (frames, Qt);
3910 /* If the LRU window is tall enough, and either eligible for
3911 splitting and selected or the only window, split it. */
3912 if (!NILP (window)
3913 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
3914 && ((EQ (window, selected_window)
3915 && window_height (window) >= split_height_threshold)
3916 || (NILP (XWINDOW (window)->parent)))
3917 && (window_height (window)
3918 >= (2 * window_min_size_2 (XWINDOW (window), 0, 0))))
3919 window = Fsplit_window (window, Qnil, Qnil);
3920 else
3921 window = Fget_lru_window (frames, Qnil);
3922 /* If Fget_lru_window returned nil, try other approaches. */
3923
3924 /* Try visible frames first. */
3925 if (NILP (window))
3926 window = Fget_buffer_window (buffer, Qvisible);
3927 if (NILP (window))
3928 window = Fget_largest_window (Qvisible, Qnil);
3929 /* If that didn't work, try iconified frames. */
3930 if (NILP (window))
3931 window = Fget_buffer_window (buffer, make_number (0));
3932 if (NILP (window))
3933 window = Fget_largest_window (make_number (0), Qnil);
3934
3935 #if 0 /* Don't try frames on other displays. */
3936 if (NILP (window))
3937 window = Fget_buffer_window (buffer, Qt);
3938 if (NILP (window))
3939 window = Fget_largest_window (Qt, Qnil);
3940 #endif
3941 /* As a last resort, make a new frame. */
3942 if (NILP (window))
3943 window = Fframe_selected_window (call0 (Vpop_up_frame_function));
3944 /* If window appears above or below another,
3945 even out their heights. */
3946 other = upper = Qnil;
3947 if (!NILP (XWINDOW (window)->prev))
3948 other = upper = XWINDOW (window)->prev;
3949 if (!NILP (XWINDOW (window)->next))
3950 other = XWINDOW (window)->next, upper = window;
3951 if (!NILP (other)
3952 && !NILP (Veven_window_heights)
3953 /* Check that OTHER and WINDOW are vertically arrayed. */
3954 && !EQ (XWINDOW (other)->top_line, XWINDOW (window)->top_line)
3955 && (XFASTINT (XWINDOW (other)->total_lines)
3956 > XFASTINT (XWINDOW (window)->total_lines)))
3957 {
3958 int total = (XFASTINT (XWINDOW (other)->total_lines)
3959 + XFASTINT (XWINDOW (window)->total_lines));
3960 enlarge_window (upper,
3961 total / 2 - XFASTINT (XWINDOW (upper)->total_lines),
3962 0);
3963 }
3964 }
3965 UNGCPRO;
3966 }
3967 else
3968 window = Fget_lru_window (Qnil, Qnil);
3969
3970 Fset_window_buffer (window, buffer, Qnil);
3971 return display_buffer_1 (window);
3972 }
3973
3974 3597
3975 DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update, 3598 DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
3976 0, 1, 0, 3599 0, 1, 0,
3977 doc: /* Force all windows to be updated on next redisplay. 3600 doc: /* Force all windows to be updated on next redisplay.
3978 If optional arg OBJECT is a window, force redisplay of that window only. 3601 If optional arg OBJECT is a window, force redisplay of that window only.
4039 3662
4040 if (!NILP (Vtemp_buffer_show_function)) 3663 if (!NILP (Vtemp_buffer_show_function))
4041 call1 (Vtemp_buffer_show_function, buf); 3664 call1 (Vtemp_buffer_show_function, buf);
4042 else 3665 else
4043 { 3666 {
4044 window = Fdisplay_buffer (buf, Qnil, Qnil); 3667 window = display_buffer (buf, Qnil, Qnil);
4045 3668
4046 if (!EQ (XWINDOW (window)->frame, selected_frame)) 3669 if (!EQ (XWINDOW (window)->frame, selected_frame))
4047 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 3670 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
4048 Vminibuf_scroll_window = window; 3671 Vminibuf_scroll_window = window;
4049 w = XWINDOW (window); 3672 w = XWINDOW (window);
5690 /* If buffer is specified, scroll that buffer. */ 5313 /* If buffer is specified, scroll that buffer. */
5691 else if (!NILP (Vother_window_scroll_buffer)) 5314 else if (!NILP (Vother_window_scroll_buffer))
5692 { 5315 {
5693 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); 5316 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil);
5694 if (NILP (window)) 5317 if (NILP (window))
5695 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt, Qnil); 5318 window = display_buffer (Vother_window_scroll_buffer, Qt, Qnil);
5696 } 5319 }
5697 else 5320 else
5698 { 5321 {
5699 /* Nothing specified; look for a neighboring window on the same 5322 /* Nothing specified; look for a neighboring window on the same
5700 frame. */ 5323 frame. */
7451 staticpro (&Qwindow_configuration_p); 7074 staticpro (&Qwindow_configuration_p);
7452 7075
7453 Qwindow_live_p = intern ("window-live-p"); 7076 Qwindow_live_p = intern ("window-live-p");
7454 staticpro (&Qwindow_live_p); 7077 staticpro (&Qwindow_live_p);
7455 7078
7079 Qdisplay_buffer = intern ("display-buffer");
7080 staticpro (&Qdisplay_buffer);
7081
7456 Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook"); 7082 Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook");
7457 staticpro (&Qtemp_buffer_show_hook); 7083 staticpro (&Qtemp_buffer_show_hook);
7458 7084
7459 staticpro (&Vwindow_list); 7085 staticpro (&Vwindow_list);
7460 7086
7472 Used by `with-output-to-temp-buffer'. 7098 Used by `with-output-to-temp-buffer'.
7473 If this function is used, then it must do the entire job of showing 7099 If this function is used, then it must do the entire job of showing
7474 the buffer; `temp-buffer-show-hook' is not run unless this function runs it. */); 7100 the buffer; `temp-buffer-show-hook' is not run unless this function runs it. */);
7475 Vtemp_buffer_show_function = Qnil; 7101 Vtemp_buffer_show_function = Qnil;
7476 7102
7477 DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function,
7478 doc: /* If non-nil, function to call to handle `display-buffer'.
7479 It will receive two args, the buffer and a flag which if non-nil means
7480 that the currently selected window is not acceptable.
7481 It should choose or create a window, display the specified buffer in it,
7482 and return the window.
7483 Commands such as `switch-to-buffer-other-window' and `find-file-other-window'
7484 work using this function. */);
7485 Vdisplay_buffer_function = Qnil;
7486
7487 DEFVAR_LISP ("even-window-heights", &Veven_window_heights,
7488 doc: /* *If non-nil, `display-buffer' should even the window heights.
7489 If nil, `display-buffer' will leave the window configuration alone. */);
7490 Veven_window_heights = Qt;
7491
7492 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, 7103 DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window,
7493 doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll. */); 7104 doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll. */);
7494 Vminibuf_scroll_window = Qnil; 7105 Vminibuf_scroll_window = Qnil;
7495 7106
7496 DEFVAR_BOOL ("mode-line-in-non-selected-windows", &mode_line_in_non_selected_windows, 7107 DEFVAR_BOOL ("mode-line-in-non-selected-windows", &mode_line_in_non_selected_windows,
7501 7112
7502 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, 7113 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer,
7503 doc: /* If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window. */); 7114 doc: /* If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window. */);
7504 Vother_window_scroll_buffer = Qnil; 7115 Vother_window_scroll_buffer = Qnil;
7505 7116
7506 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames,
7507 doc: /* *Non-nil means `display-buffer' should make a separate frame. */);
7508 pop_up_frames = 0;
7509
7510 DEFVAR_BOOL ("auto-window-vscroll", &auto_window_vscroll_p, 7117 DEFVAR_BOOL ("auto-window-vscroll", &auto_window_vscroll_p,
7511 doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines. */); 7118 doc: /* *Non-nil means to automatically adjust `window-vscroll' to view tall lines. */);
7512 auto_window_vscroll_p = 1; 7119 auto_window_vscroll_p = 1;
7513 7120
7514 DEFVAR_BOOL ("display-buffer-reuse-frames", &display_buffer_reuse_frames,
7515 doc: /* *Non-nil means `display-buffer' should reuse frames.
7516 If the buffer in question is already displayed in a frame, raise that frame. */);
7517 display_buffer_reuse_frames = 0;
7518
7519 DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function,
7520 doc: /* Function to call to handle automatic new frame creation.
7521 It is called with no arguments and should return a newly created frame.
7522
7523 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'
7524 where `pop-up-frame-alist' would hold the default frame parameters. */);
7525 Vpop_up_frame_function = Qnil;
7526
7527 DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names,
7528 doc: /* *List of buffer names that should have their own special frames.
7529 Displaying a buffer with `display-buffer' or `pop-to-buffer',
7530 if its name is in this list, makes a special frame for it
7531 using `special-display-function'. See also `special-display-regexps'.
7532
7533 An element of the list can be a list instead of just a string.
7534 There are two ways to use a list as an element:
7535 (BUFFER FRAME-PARAMETERS...) (BUFFER FUNCTION OTHER-ARGS...)
7536 In the first case, the FRAME-PARAMETERS are pairs of the form
7537 \(PARAMETER . VALUE); these parameter values are used to create the frame.
7538 In the second case, FUNCTION is called with BUFFER as the first argument,
7539 followed by the OTHER-ARGS--it can display BUFFER in any way it likes.
7540 All this is done by the function found in `special-display-function'.
7541
7542 If the specified frame parameters include (same-buffer . t), the
7543 buffer is displayed in the currently selected window. Otherwise, if
7544 they include (same-frame . t), the buffer is displayed in a new window
7545 in the currently selected frame.
7546
7547 If this variable appears \"not to work\", because you add a name to it
7548 but that buffer still appears in the selected window, look at the
7549 values of `same-window-buffer-names' and `same-window-regexps'.
7550 Those variables take precedence over this one. */);
7551 Vspecial_display_buffer_names = Qnil;
7552
7553 DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps,
7554 doc: /* *List of regexps saying which buffers should have their own special frames.
7555 When displaying a buffer with `display-buffer' or `pop-to-buffer',
7556 if any regexp in this list matches the buffer name, it makes a
7557 special frame for the buffer by calling `special-display-function'.
7558
7559 An element of the list can be a list instead of just a string.
7560 There are two ways to use a list as an element:
7561 (REGEXP FRAME-PARAMETERS...) (REGEXP FUNCTION OTHER-ARGS...)
7562 In the first case, the FRAME-PARAMETERS are pairs of the form
7563 \(PARAMETER . VALUE); these parameter values are used to create the frame.
7564 In the second case, FUNCTION is called with BUFFER as the first argument,
7565 followed by the OTHER-ARGS--it can display the buffer in any way it likes.
7566 All this is done by the function found in `special-display-function'.
7567
7568 If the specified frame parameters include (same-buffer . t), the
7569 buffer is displayed in the currently selected window. Otherwise, if
7570 they include (same-frame . t), the buffer is displayed in a new window
7571 in the currently selected frame.
7572
7573 If this variable appears \"not to work\", because you add a regexp to it
7574 but the matching buffers still appear in the selected window, look at the
7575 values of `same-window-buffer-names' and `same-window-regexps'.
7576 Those variables take precedence over this one. */);
7577 Vspecial_display_regexps = Qnil;
7578
7579 DEFVAR_LISP ("special-display-function", &Vspecial_display_function,
7580 doc: /* Function to call to make a new frame for a special buffer.
7581 It is called with two arguments, the buffer and optional buffer specific
7582 data, and should return a window displaying that buffer.
7583 The default value normally makes a separate frame for the buffer,
7584 using `special-display-frame-alist' to specify the frame parameters.
7585 But if the buffer specific data includes (same-buffer . t) then the
7586 buffer is displayed in the current selected window.
7587 Otherwise if it includes (same-frame . t) then the buffer is displayed in
7588 a new window in the currently selected frame.
7589
7590 A buffer is special if it is listed in `special-display-buffer-names'
7591 or matches a regexp in `special-display-regexps'. */);
7592 Vspecial_display_function = Qnil;
7593
7594 DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names,
7595 doc: /* *List of buffer names that should appear in the selected window.
7596 Displaying one of these buffers using `display-buffer' or `pop-to-buffer'
7597 switches to it in the selected window, rather than making it appear
7598 in some other window.
7599
7600 An element of the list can be a cons cell instead of just a string.
7601 Then the car must be a string, which specifies the buffer name.
7602 This is for compatibility with `special-display-buffer-names';
7603 the cdr of the cons cell is ignored.
7604
7605 See also `same-window-regexps'. */);
7606 Vsame_window_buffer_names = Qnil;
7607
7608 DEFVAR_LISP ("same-window-regexps", &Vsame_window_regexps,
7609 doc: /* *List of regexps saying which buffers should appear in the selected window.
7610 If a buffer name matches one of these regexps, then displaying it
7611 using `display-buffer' or `pop-to-buffer' switches to it
7612 in the selected window, rather than making it appear in some other window.
7613
7614 An element of the list can be a cons cell instead of just a string.
7615 Then the car must be a string, which specifies the buffer name.
7616 This is for compatibility with `special-display-buffer-names';
7617 the cdr of the cons cell is ignored.
7618
7619 See also `same-window-buffer-names'. */);
7620 Vsame_window_regexps = Qnil;
7621
7622 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows,
7623 doc: /* *Non-nil means display-buffer should make new windows. */);
7624 pop_up_windows = 1;
7625
7626 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines, 7121 DEFVAR_INT ("next-screen-context-lines", &next_screen_context_lines,
7627 doc: /* *Number of lines of continuity when scrolling by screenfuls. */); 7122 doc: /* *Number of lines of continuity when scrolling by screenfuls. */);
7628 next_screen_context_lines = 2; 7123 next_screen_context_lines = 2;
7629
7630 DEFVAR_INT ("split-height-threshold", &split_height_threshold,
7631 doc: /* *A window must be at least this tall to be eligible for splitting
7632 by `display-buffer'. The value is in line units.
7633 If there is only one window, it is split regardless of this value. */);
7634 split_height_threshold = 500;
7635
7636 DEFVAR_LISP ("split-window-preferred-function",
7637 &Vsplit_window_preferred_function,
7638 doc: /* Function to use to split a window.
7639 This is used by `display-buffer' to allow the user to choose whether
7640 to split windows horizontally or vertically or some mix of the two.
7641 When this variable is nil, `display-buffer' splits windows vertically.
7642 Otherwise, `display-buffer' calls this function to split a window.
7643 It is called with a window as single argument and should split it in two
7644 and return the new window, or return an appropriate existing window
7645 if splitting is not eligible. */);
7646 Vsplit_window_preferred_function = Qnil;
7647 7124
7648 DEFVAR_INT ("window-min-height", &window_min_height, 7125 DEFVAR_INT ("window-min-height", &window_min_height,
7649 doc: /* Allow deleting windows less than this tall. 7126 doc: /* Allow deleting windows less than this tall.
7650 The value is measured in line units. If a window wants a modeline it 7127 The value is measured in line units. If a window wants a modeline it
7651 is counted as one line. 7128 is counted as one line.
7722 defsubr (&Sdelete_windows_on); 7199 defsubr (&Sdelete_windows_on);
7723 defsubr (&Sreplace_buffer_in_windows); 7200 defsubr (&Sreplace_buffer_in_windows);
7724 defsubr (&Sdelete_window); 7201 defsubr (&Sdelete_window);
7725 defsubr (&Sset_window_buffer); 7202 defsubr (&Sset_window_buffer);
7726 defsubr (&Sselect_window); 7203 defsubr (&Sselect_window);
7727 defsubr (&Sspecial_display_p);
7728 defsubr (&Ssame_window_p);
7729 defsubr (&Sdisplay_buffer);
7730 defsubr (&Sforce_window_update); 7204 defsubr (&Sforce_window_update);
7731 defsubr (&Ssplit_window); 7205 defsubr (&Ssplit_window);
7732 defsubr (&Senlarge_window); 7206 defsubr (&Senlarge_window);
7733 defsubr (&Sshrink_window); 7207 defsubr (&Sshrink_window);
7734 defsubr (&Sadjust_window_trailing_edge); 7208 defsubr (&Sadjust_window_trailing_edge);