comparison lispref/windows.texi @ 52846:2ff062ff0422

(Basic Windows): A window has fringe settings, display margins and scroll-bar settings. (Splitting Windows): Doc split-window return value. Clean up one-window-p. (Selecting Windows): Fix typo. (Cyclic Window Ordering): Explain frame as ALL-FRAMES in next-window. (Buffers and Windows): In set-window-buffer, explain effect on fringe settings and scroll bar settings. (Displaying Buffers): In pop-to-buffer, explain nil as buffer arg. (Choosing Window): Use defopt for pop-up-frame-function. For special-display-buffer-names, explain same-window and same-frame. Clarify window-dedicated-p return value. (Textual Scrolling): scroll-up and scroll-down can get an error. (Horizontal Scrolling): Clarify auto-hscroll-mode. Clarify set-window-hscroll. (Size of Window): Don't mention tool bar in window-height. (Coordinates and Windows): Explain what coordinates-in-window-p returns for fringes and display margins. (Window Configurations): Explain saving fringes, etc.
author Richard M. Stallman <rms@gnu.org>
date Mon, 13 Oct 2003 19:39:51 +0000
parents 695cf19ef79e
children 3e34838fbfac
comparison
equal deleted inserted replaced
52845:1826a112381b 52846:2ff062ff0422
95 @item 95 @item
96 the mark 96 the mark
97 97
98 @item 98 @item
99 how recently the window was selected 99 how recently the window was selected
100
101 @item
102 fringe settings
103
104 @item
105 display margins
106
107 @item
108 scroll-bar settings
100 @end itemize 109 @end itemize
101 110
102 @cindex multiple windows 111 @cindex multiple windows
103 Users create multiple windows so they can look at several buffers at 112 Users create multiple windows so they can look at several buffers at
104 once. Lisp libraries use multiple windows for a variety of reasons, but 113 once. Lisp libraries use multiple windows for a variety of reasons, but
147 @deffn Command split-window &optional window size horizontal 156 @deffn Command split-window &optional window size horizontal
148 This function splits @var{window} into two windows. The original 157 This function splits @var{window} into two windows. The original
149 window @var{window} remains the selected window, but occupies only 158 window @var{window} remains the selected window, but occupies only
150 part of its former screen area. The rest is occupied by a newly created 159 part of its former screen area. The rest is occupied by a newly created
151 window which is returned as the value of this function. 160 window which is returned as the value of this function.
161 This function returns the newly created window.
152 162
153 If @var{horizontal} is non-@code{nil}, then @var{window} splits into 163 If @var{horizontal} is non-@code{nil}, then @var{window} splits into
154 two side by side windows. The original window @var{window} keeps the 164 two side by side windows. The original window @var{window} keeps the
155 leftmost @var{size} columns, and gives the rest of the columns to the 165 leftmost @var{size} columns, and gives the rest of the columns to the
156 new window. Otherwise, it splits into windows one above the other, and 166 new window. Otherwise, it splits into windows one above the other, and
289 299
290 @defun one-window-p &optional no-mini all-frames 300 @defun one-window-p &optional no-mini all-frames
291 This function returns non-@code{nil} if there is only one window. The 301 This function returns non-@code{nil} if there is only one window. The
292 argument @var{no-mini}, if non-@code{nil}, means don't count the 302 argument @var{no-mini}, if non-@code{nil}, means don't count the
293 minibuffer even if it is active; otherwise, the minibuffer window is 303 minibuffer even if it is active; otherwise, the minibuffer window is
294 included, if active, in the total number of windows, which is compared 304 counted when it is active.
295 against one.
296 305
297 The argument @var{all-frames} specifies which frames to consider. Here 306 The argument @var{all-frames} specifies which frames to consider. Here
298 are the possible values and their meanings: 307 are the possible values and their meanings:
299 308
300 @table @asis 309 @table @asis
420 @end group 429 @end group
421 @end example 430 @end example
422 @end defun 431 @end defun
423 432
424 @defmac save-selected-window forms@dots{} 433 @defmac save-selected-window forms@dots{}
425 This macro records the selected window of eac frame, executes 434 This macro records the selected window of each frame, executes
426 @var{forms} in sequence, then restores the earlier selected windows. 435 @var{forms} in sequence, then restores the earlier selected windows.
427 436
428 This macro does not save or restore anything about the sizes, 437 This macro does not save or restore anything about the sizes,
429 arrangement or contents of windows; therefore, if the @var{forms} 438 arrangement or contents of windows; therefore, if the @var{forms}
430 change them, the change persists. If the previously selected window 439 change them, the change persists. If the previously selected window
555 Consider all windows in all visible frames. (To get useful results, you 564 Consider all windows in all visible frames. (To get useful results, you
556 must ensure @var{window} is in a visible frame.) 565 must ensure @var{window} is in a visible frame.)
557 566
558 @item 0 567 @item 0
559 Consider all windows in all visible or iconified frames. 568 Consider all windows in all visible or iconified frames.
569
570 @item a frame
571 Consider all windows on that frame.
560 572
561 @item anything else 573 @item anything else
562 Consider precisely the windows in @var{window}'s frame, and no others. 574 Consider precisely the windows in @var{window}'s frame, and no others.
563 @end table 575 @end table
564 576
655 @result{} nil 667 @result{} nil
656 @end group 668 @end group
657 @end example 669 @end example
658 670
659 Normally, displaying @var{buffer} in @var{window} resets the window's 671 Normally, displaying @var{buffer} in @var{window} resets the window's
660 fringe widths and position based on the local variables of @var{buffer}. 672 display margins, fringe widths, scroll bar settings, and position
661 However, if @var{keep-margins} is non-@code{nil}, the fringe widths and 673 based on the local variables of @var{buffer}. However, if
662 position of @var{window} remain unchanged. @xref{Fringes}. 674 @var{keep-margins} is non-@code{nil}, the display margins and fringe
675 widths of @var{window} remain unchanged. @xref{Fringes}.
663 @end defun 676 @end defun
664 677
665 @defun window-buffer &optional window 678 @defun window-buffer &optional window
666 This function returns the buffer that @var{window} is displaying. If 679 This function returns the buffer that @var{window} is displaying. If
667 @var{window} is omitted, this function returns the buffer for the 680 @var{window} is omitted, this function returns the buffer for the
803 @defun pop-to-buffer buffer-or-name &optional other-window norecord 816 @defun pop-to-buffer buffer-or-name &optional other-window norecord
804 This function makes @var{buffer-or-name} the current buffer and 817 This function makes @var{buffer-or-name} the current buffer and
805 switches to it in some window, preferably not the window previously 818 switches to it in some window, preferably not the window previously
806 selected. The ``popped-to'' window becomes the selected window within 819 selected. The ``popped-to'' window becomes the selected window within
807 its frame. The return value is the buffer that was switched to. 820 its frame. The return value is the buffer that was switched to.
821 If @var{buffer-or-name} is @code{nil}, that means to choose some
822 other buffer, but you don't specify which.
808 823
809 If the variable @code{pop-up-frames} is non-@code{nil}, 824 If the variable @code{pop-up-frames} is non-@code{nil},
810 @code{pop-to-buffer} looks for a window in any visible frame already 825 @code{pop-to-buffer} looks for a window in any visible frame already
811 displaying the buffer; if there is one, it returns that window and makes 826 displaying the buffer; if there is one, it returns that window and makes
812 it be selected within its frame. If there is none, it creates a new 827 it be selected within its frame. If there is none, it creates a new
946 961
947 @xref{Frames}, for more information. 962 @xref{Frames}, for more information.
948 @end defopt 963 @end defopt
949 964
950 @c Emacs 19 feature 965 @c Emacs 19 feature
951 @defvar pop-up-frame-function 966 @defopt pop-up-frame-function
952 This variable specifies how to make a new frame if @code{pop-up-frames} 967 This variable specifies how to make a new frame if @code{pop-up-frames}
953 is non-@code{nil}. 968 is non-@code{nil}.
954 969
955 Its value should be a function of no arguments. When 970 Its value should be a function of no arguments. When
956 @code{display-buffer} makes a new frame, it does so by calling that 971 @code{display-buffer} makes a new frame, it does so by calling that
987 @end example 1002 @end example
988 1003
989 @noindent 1004 @noindent
990 specifies to display a buffer named @samp{myfile} in a dedicated frame 1005 specifies to display a buffer named @samp{myfile} in a dedicated frame
991 with specified @code{minibuffer} and @code{menu-bar-lines} parameters. 1006 with specified @code{minibuffer} and @code{menu-bar-lines} parameters.
1007
1008 The list of frame parameters can also use the phony frame parameters
1009 @code{same-frame} and @code{same-window}. If the specified frame
1010 parameters include @code{(same-window . @var{value})} and @var{value}
1011 is non-@code{nil}, that means to display the buffer in the current
1012 selected window. Otherwise, if they include @code{(same-frame .
1013 @var{value})} and @var{value} is non-@code{nil}, that means to display
1014 the buffer in a new window in the currently selected frame.
992 @end defopt 1015 @end defopt
993 1016
994 @defopt special-display-regexps 1017 @defopt special-display-regexps
995 A list of regular expressions that specify buffers that should be 1018 A list of regular expressions that specify buffers that should be
996 displayed specially. If the buffer's name matches any of the regular 1019 displayed specially. If the buffer's name matches any of the regular
1070 A window can be marked as ``dedicated'' to its buffer. Then 1093 A window can be marked as ``dedicated'' to its buffer. Then
1071 @code{display-buffer} will not try to use that window to display any 1094 @code{display-buffer} will not try to use that window to display any
1072 other buffer. 1095 other buffer.
1073 1096
1074 @defun window-dedicated-p window 1097 @defun window-dedicated-p window
1075 This function returns @code{t} if @var{window} is marked as dedicated; 1098 This function returns non-@code{nil} if @var{window} is marked as
1076 otherwise @code{nil}. 1099 dedicated; otherwise @code{nil}.
1077 @end defun 1100 @end defun
1078 1101
1079 @defun set-window-dedicated-p window flag 1102 @defun set-window-dedicated-p window flag
1080 This function marks @var{window} as dedicated if @var{flag} is 1103 This function marks @var{window} as dedicated if @var{flag} is
1081 non-@code{nil}, and nondedicated otherwise. 1104 non-@code{nil}, and nondedicated otherwise.
1325 1348
1326 If @var{count} is @code{nil} (or omitted), then the length of scroll 1349 If @var{count} is @code{nil} (or omitted), then the length of scroll
1327 is @code{next-screen-context-lines} lines less than the usable height of 1350 is @code{next-screen-context-lines} lines less than the usable height of
1328 the window (not counting its mode line). 1351 the window (not counting its mode line).
1329 1352
1330 @code{scroll-up} returns @code{nil}. 1353 @code{scroll-up} returns @code{nil}, unless it gets an error
1354 because it can't scroll any further.
1331 @end deffn 1355 @end deffn
1332 1356
1333 @deffn Command scroll-down &optional count 1357 @deffn Command scroll-down &optional count
1334 This function scrolls the text in the selected window downward 1358 This function scrolls the text in the selected window downward
1335 @var{count} lines. If @var{count} is negative, scrolling is actually 1359 @var{count} lines. If @var{count} is negative, scrolling is actually
1337 1361
1338 If @var{count} is omitted or @code{nil}, then the length of the scroll 1362 If @var{count} is omitted or @code{nil}, then the length of the scroll
1339 is @code{next-screen-context-lines} lines less than the usable height of 1363 is @code{next-screen-context-lines} lines less than the usable height of
1340 the window (not counting its mode line). 1364 the window (not counting its mode line).
1341 1365
1342 @code{scroll-down} returns @code{nil}. 1366 @code{scroll-down} returns @code{nil}, unless it gets an error because
1367 it can't scroll any further.
1343 @end deffn 1368 @end deffn
1344 1369
1345 @deffn Command scroll-other-window &optional count 1370 @deffn Command scroll-other-window &optional count
1346 This function scrolls the text in another window upward @var{count} 1371 This function scrolls the text in another window upward @var{count}
1347 lines. Negative values of @var{count}, or @code{nil}, are handled 1372 lines. Negative values of @var{count}, or @code{nil}, are handled
1571 reduce the net horizontal scroll to zero. There is no limit to how far 1596 reduce the net horizontal scroll to zero. There is no limit to how far
1572 left you can scroll, but eventually all the text will disappear off the 1597 left you can scroll, but eventually all the text will disappear off the
1573 left edge. 1598 left edge.
1574 1599
1575 @vindex auto-hscroll-mode 1600 @vindex auto-hscroll-mode
1576 In Emacs 21, redisplay automatically alters the horizontal scrolling 1601 If @code{auto-hscroll-mode} is set, redisplay automatically alters
1577 of a window as necessary to ensure that point is always visible, if 1602 the horizontal scrolling of a window as necessary to ensure that point
1578 @code{auto-hscroll-mode} is set. However, you can still set the 1603 is always visible. However, you can still set the horizontal
1579 horizontal scrolling value explicitly. The value you specify serves as 1604 scrolling value explicitly. The value you specify serves as a lower
1580 a lower bound for automatic scrolling, i.e. automatic scrolling 1605 bound for automatic scrolling, i.e. automatic scrolling will not
1581 will not scroll a window to a column less than the specified one. 1606 scroll a window to a column less than the specified one.
1582 1607
1583 @deffn Command scroll-left &optional count 1608 @deffn Command scroll-left &optional count
1584 This function scrolls the selected window @var{count} columns to the 1609 This function scrolls the selected window @var{count} columns to the
1585 left (or to the right if @var{count} is negative). The default 1610 left (or to the right if @var{count} is negative). The default
1586 for @var{count} is the window width, minus 2. 1611 for @var{count} is the window width, minus 2.
1629 @end group 1654 @end group
1630 @end example 1655 @end example
1631 @end defun 1656 @end defun
1632 1657
1633 @defun set-window-hscroll window columns 1658 @defun set-window-hscroll window columns
1634 This function sets the number of columns from the left margin that 1659 This function sets horizontal scrolling of @var{window}. The value of
1635 @var{window} is scrolled from the value of @var{columns}. The argument 1660 @var{columns} specifies the amount of scrolling, in terms of columns
1636 @var{columns} should be zero or positive; if not, it is taken as zero. 1661 from the left margin. The argument @var{columns} should be zero or
1637 Fractional values of @var{columns} are not supported at present. 1662 positive; if not, it is taken as zero. Fractional values of
1663 @var{columns} are not supported at present.
1638 1664
1639 Note that @code{set-window-hscroll} may appear not to work if you test 1665 Note that @code{set-window-hscroll} may appear not to work if you test
1640 it by evaluating a call with @kbd{M-:} in a simple way. What happens 1666 it by evaluating a call with @kbd{M-:} in a simple way. What happens
1641 is that the function sets the horizontal scroll value and returns, but 1667 is that the function sets the horizontal scroll value and returns, but
1642 then redisplay adjusts the horizontal scrolling to make point visible, 1668 then redisplay adjusts the horizontal scrolling to make point visible,
1683 The following three functions return size information about a window: 1709 The following three functions return size information about a window:
1684 1710
1685 @defun window-height &optional window 1711 @defun window-height &optional window
1686 This function returns the number of lines in @var{window}, including 1712 This function returns the number of lines in @var{window}, including
1687 its mode line and header line, if any. If @var{window} fills its 1713 its mode line and header line, if any. If @var{window} fills its
1688 entire frame except for the echo area, and there is no tool bar, this 1714 entire frame except for the echo area, this is typically one less than
1689 is typically one less than the value of @code{frame-height} on that 1715 the value of @code{frame-height} on that frame.
1690 frame.
1691 1716
1692 If @var{window} is @code{nil}, the function uses the selected window. 1717 If @var{window} is @code{nil}, the function uses the selected window.
1693 1718
1694 @example 1719 @example
1695 @group 1720 @group
2010 The coordinates are in the vertical line between @var{window} and its 2035 The coordinates are in the vertical line between @var{window} and its
2011 neighbor to the right. This value occurs only if the window doesn't 2036 neighbor to the right. This value occurs only if the window doesn't
2012 have a scroll bar; positions in a scroll bar are considered outside the 2037 have a scroll bar; positions in a scroll bar are considered outside the
2013 window for these purposes. 2038 window for these purposes.
2014 2039
2040 @item left-fringe
2041 @itemx right-fringe
2042 The coordinates are in the left or right fringe of the window.
2043
2044 @item left-margin
2045 @itemx right-margin
2046 The coordinates are in the left or right margin of the window.
2047
2015 @item nil 2048 @item nil
2016 The coordinates are not in any part of @var{window}. 2049 The coordinates are not in any part of @var{window}.
2017 @end table 2050 @end table
2018 2051
2019 The function @code{coordinates-in-window-p} does not require a frame as 2052 The function @code{coordinates-in-window-p} does not require a frame as
2026 @cindex saving window information 2059 @cindex saving window information
2027 2060
2028 A @dfn{window configuration} records the entire layout of one 2061 A @dfn{window configuration} records the entire layout of one
2029 frame---all windows, their sizes, which buffers they contain, what 2062 frame---all windows, their sizes, which buffers they contain, what
2030 part of each buffer is displayed, and the values of point and the 2063 part of each buffer is displayed, and the values of point and the
2031 mark. It also includes the values of @code{window-min-height}, 2064 mark; also their fringes, margins, and scroll bar settings. It also
2065 includes the values of @code{window-min-height},
2032 @code{window-min-width} and @code{minibuffer-scroll-window}. An 2066 @code{window-min-width} and @code{minibuffer-scroll-window}. An
2033 exception is made for point in the selected window for the current 2067 exception is made for point in the selected window for the current
2034 buffer; its value is not saved in the window configuration. 2068 buffer; its value is not saved in the window configuration.
2035 2069
2036 You can bring back an entire previous layout by restoring a window 2070 You can bring back an entire previous layout by restoring a window