comparison doc/lispref/windows.texi @ 103186:622683e27798

(Choosing Window): Describe split-window-sensibly and rewrite section on window splitting accordingly. (Textual Scrolling): Replace `...' by @code{...}.
author Martin Rudalics <rudalics@gmx.at>
date Sat, 09 May 2009 07:19:47 +0000
parents a9330f5194ee
children 7b19ba744cfe
comparison
equal deleted inserted replaced
103185:9009b73dda47 103186:622683e27798
954 @code{display-buffer} is determined by the variables described next. 954 @code{display-buffer} is determined by the variables described next.
955 @end defopt 955 @end defopt
956 956
957 @defopt pop-up-windows 957 @defopt pop-up-windows
958 This variable specifies whether @code{display-buffer} is allowed to 958 This variable specifies whether @code{display-buffer} is allowed to
959 split (@pxref{Splitting Windows}) an existing window . If it is 959 split (@pxref{Splitting Windows}) an existing window. If this variable
960 non-@code{nil}, @code{display-buffer} tries to split the largest 960 is non-@code{nil}, @code{display-buffer} tries to split the largest or
961 or least recently used window on the selected frame. (If the selected 961 least recently used window on the selected frame. (If the selected
962 frame is a minibuffer-only frame, it tries to split a window on 962 frame is a minibuffer-only frame, @code{display-buffer} tries to split a
963 another frame instead.) If @code{pop-up-windows} is @code{nil} or the 963 window on another frame instead.) If this variable is @code{nil} or the
964 variable @code{pop-up-frames} (see below) is non-@code{nil}, 964 variable @code{pop-up-frames} (see below) is non-@code{nil},
965 @code{display-buffer} does not split any window. 965 @code{display-buffer} does not split any window.
966 @end defopt 966 @end defopt
967 967
968 @defvar split-window-preferred-function 968 @defvar split-window-preferred-function
969 This variable specifies how to split a window. Its value, if 969 This variable must specify a function with one argument, which is a
970 non-@code{nil}, should be a function of one argument, which is a 970 window. The @code{display-buffer} routines will call this function with
971 window. If this variable specifies a function, @code{display-buffer} 971 one or more candidate windows when they look for a window to split. The
972 will call it with one or more candidate windows when it looks for a 972 function is expected to split that window and return the new window. If
973 window to split. If the argument window fits, the function is 973 the function returns @code{nil}, this means that the argument window
974 expected to split it and return a new window. If the function returns 974 cannot (or shall not) be split.
975 @code{nil}, the argument window will not be split. 975
976 976 The default value of @code{split-window-preferred-function} is the
977 If the value of this variable is @code{nil}, @code{display-buffer} 977 function @code{split-window-sensibly} described below. When you
978 uses the two variables described next to decide whether and which 978 customize this option, bear in mind that the @code{display-buffer}
979 window to split. 979 routines may call your function up to two times when trying to split a
980 window. The argument of the first call is the largest window on the
981 chosen frame (as returned by @code{get-largest-window}). If that call
982 fails to return a live window, your function is called a second time
983 with the least recently used window on that frame (as returned by
984 @code{get-lru-window}).
985
986 The function assigned to this option may also try to split any other
987 window instead of the argument window. Note that the window selected at
988 the time @code{display-buffer} was invoked is still selected when your
989 function is called. Hence, you can split the selected window (instead
990 of the largest or least recently used one) by simply ignoring the window
991 argument in the body of your function. You can even choose to not split
992 any window as long as the return value of your function specifies a live
993 window or nil, but you are not encouraged to do so unconditionally. If
994 you want @code{display-buffer} to never split any windows, set
995 @code{pop-up-windows} to @code{nil}.
980 @end defvar 996 @end defvar
981 997
998 @defun split-window-sensibly
999 This function takes a window as argument and tries to split that window
1000 in a suitable way. The two variables described next are useful for
1001 tuning the behavior of this function.
1002 @end defun
1003
982 @defopt split-height-threshold 1004 @defopt split-height-threshold
983 This variable specifies whether @code{display-buffer} may split a window 1005 This variable specifies whether @code{split-window-sensibly} may split
984 vertically, provided there are multiple windows. If the value is a 1006 its argument window vertically. If this variable is set to an integer,
985 number, @code{display-buffer} splits a window only if it has at least 1007 @code{split-window-sensibly} splits the window only if it has at least
986 this many lines. If no window is tall enough, or if the value of this 1008 this many lines. If the value of this variable is @code{nil},
987 variable is @code{nil}, @code{display-buffer} tries to split some window 1009 @code{split-window-sensibly} tries to split the window horizontally,
988 horizontally, subject to restrictions of @code{split-width-threshold} 1010 subject to restrictions of @code{split-width-threshold} (see below). If
989 (see below). If splitting horizontally is impossible too, 1011 splitting horizontally fails too, @code{split-window-sensibly} will try
990 @code{display-buffer} splits a window vertically only if it's the only 1012 to split the window vertically disregarding the value of this variable.
991 window on its frame and not the minibuffer window, and only if 1013
992 @code{pop-up-windows} is non-@code{nil}. 1014 @code{split-window-sensibly} does not split a window vertically whose
993 1015 height is fixed (@pxref{Resizing Windows}). Moreover, it splits a
994 A window whose height is fixed (@pxref{Resizing Windows}) cannot be 1016 window vertically only if the space taken up by that window can
995 split vertically by @code{display-buffer}. Also, @code{display-buffer} 1017 accommodate two windows one above the other that are both at least
996 splits a window vertically only if it can accommodate two windows that 1018 @code{window-min-height} lines tall. Finally, if the window that shall
997 are both at least `window-min-height' lines tall. Moreover, if the 1019 be split has a mode line, @code{split-window-sensibly} makes sure that
998 window that shall be split has a mode line, the window must be at least 1020 the new window can accomodate a mode line as well.
999 four lines tall in order to make sure that the new window can have a
1000 mode line as well. If the original window doesn't have a mode line, a
1001 height of two lines suffices.
1002 @end defopt 1021 @end defopt
1003 1022
1004 @defopt split-width-threshold 1023 @defopt split-width-threshold
1005 This variable specifies whether @code{display-buffer} may split a window 1024 This variable specifies whether @code{split-window-sensibly} may split
1006 horizontally. If the value is a number, @code{display-buffer} may split 1025 its argument window horizontally. If this variable is set to an
1007 a window if it has at least this many columns. If the value of this 1026 integer, @code{split-window-sensibly} splits the window only if it has
1008 variable is @code{nil}, @code{display-buffer} will not split any windows 1027 at least this many columns. If the value of this variable is
1009 horizontally. (It still might split some window vertically, though, see 1028 @code{nil}, @code{split-window-sensibly} will not split the window
1029 horizontally. (It still might split the window vertically, though, see
1010 above.) 1030 above.)
1011 1031
1012 A window whose width is fixed (@pxref{Resizing Windows}) cannot be split 1032 @code{split-window-sensibly} does not split a window horizontally if
1013 horizontally by @code{display-buffer}. Also, @code{display-buffer} 1033 that window's width is fixed (@pxref{Resizing Windows}). Also, it
1014 splits a window horizontally only if it can accommodate two windows that 1034 splits a window horizontally only if the space that window takes up can
1015 are both at least `window-min-width' columns wide. 1035 accommodate two windows side by side that are both at least
1036 @code{window-min-width} columns wide.
1016 @end defopt 1037 @end defopt
1017 1038
1018 @defopt even-window-heights 1039 @defopt even-window-heights
1019 This variable specifies whether @code{display-buffer} should even out 1040 This variable specifies whether @code{display-buffer} should even out
1020 window heights if the buffer gets displayed in an existing window, above 1041 window heights if the buffer gets displayed in an existing window, above
1533 buffer is different from the buffer that is displayed in the selected 1554 buffer is different from the buffer that is displayed in the selected
1534 window. @xref{Current Buffer}. 1555 window. @xref{Current Buffer}.
1535 1556
1536 If the window contains a row which is taller than the height of the 1557 If the window contains a row which is taller than the height of the
1537 window (for example in the presence of a large image), the scroll 1558 window (for example in the presence of a large image), the scroll
1538 functions will adjust the window vscroll to scroll the partially 1559 functions will adjust the window vscroll to scroll the partially visible
1539 visible row. To disable this feature, Lisp code may bind the variable 1560 row. To disable this feature, Lisp code may bind the variable
1540 `auto-window-vscroll' to @code{nil} (@pxref{Vertical Scrolling}). 1561 @code{auto-window-vscroll} to @code{nil} (@pxref{Vertical Scrolling}).
1541 1562
1542 @deffn Command scroll-up &optional count 1563 @deffn Command scroll-up &optional count
1543 This function scrolls the text in the selected window upward 1564 This function scrolls the text in the selected window upward
1544 @var{count} lines. If @var{count} is negative, scrolling is actually 1565 @var{count} lines. If @var{count} is negative, scrolling is actually
1545 downward. 1566 downward.