@c -*-texinfo-*-@c This is part of the GNU Emacs Lisp Reference Manual.@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,@c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.@c See the file elisp.texi for copying conditions.@setfilename ../../info/windows@node Windows, Frames, Buffers, Top@chapter Windows This chapter describes most of the functions and variables related toEmacs windows. See @ref{Display}, for information on how text isdisplayed in windows.@menu* Basic Windows:: Basic information on using windows.* Splitting Windows:: Splitting one window into two windows.* Deleting Windows:: Deleting a window gives its space to other windows.* Selecting Windows:: The selected window is the one that you edit in.* Cyclic Window Ordering:: Moving around the existing windows.* Buffers and Windows:: Each window displays the contents of a buffer.* Displaying Buffers:: Higher-level functions for displaying a buffer and choosing a window for it.* Choosing Window:: How to choose a window for displaying a buffer.* Window Point:: Each window has its own location of point.* Window Start:: The display-start position controls which text is on-screen in the window.* Textual Scrolling:: Moving text up and down through the window.* Vertical Scrolling:: Moving the contents up and down on the window.* Horizontal Scrolling:: Moving the contents sideways on the window.* Size of Window:: Accessing the size of a window.* Resizing Windows:: Changing the size of a window.* Coordinates and Windows:: Converting coordinates to windows.* Window Tree:: The layout and sizes of all windows in a frame.* Window Configurations:: Saving and restoring the state of the screen.* Window Hooks:: Hooks for scrolling, window size changes, redisplay going past a certain point, or window configuration changes.@end menu@node Basic Windows@section Basic Concepts of Emacs Windows@cindex window@cindex selected window A @dfn{window} in Emacs is the physical area of the screen in which abuffer is displayed. The term is also used to refer to a Lisp object thatrepresents that screen area in Emacs Lisp. It should beclear from the context which is meant. Emacs groups windows into frames. A frame represents an area ofscreen available for Emacs to use. Each frame always contains at leastone window, but you can subdivide it vertically or horizontally intomultiple nonoverlapping Emacs windows. In each frame, at any time, one and only one window is designated as@dfn{selected within the frame}. The frame's cursor appears in thatwindow, but the other windows have ``non-selected'' cursors, normallyless visible. (@pxref{Cursor Parameters}, for customization of this.)At any time, one frame is the selected frame; and the window selectedwithin that frame is @dfn{the selected window}. The selected window'sbuffer is usually the current buffer (except when @code{set-buffer}has been used). @xref{Current Buffer}. For practical purposes, a window exists only while it is displayed ina frame. Once removed from the frame, the window is effectively deletedand should not be used, @emph{even though there may still be referencesto it} from other Lisp objects. Restoring a saved window configurationis the only way for a window no longer on the screen to come back tolife. (@xref{Deleting Windows}.) Each window has the following attributes:@itemize @bullet@itemcontaining frame@itemwindow height@itemwindow width@itemwindow edges with respect to the screen or frame@itemthe buffer it displays@itemposition within the buffer at the upper left of the window@itemamount of horizontal scrolling, in columns@itempoint@itemthe mark@itemhow recently the window was selected@itemfringe settings@itemdisplay margins@itemscroll-bar settings@end itemize@cindex multiple windows Users create multiple windows so they can look at several buffers atonce. Lisp libraries use multiple windows for a variety of reasons, butmost often to display related information. In Rmail, for example, youcan move through a summary buffer in one window while the other windowshows messages one at a time as they are reached. The meaning of ``window'' in Emacs is similar to what it means in thecontext of general-purpose window systems such as X, but not identical.The X Window System places X windows on the screen; Emacs uses one ormore X windows as frames, and subdivides them intoEmacs windows. When you use Emacs on a character-only terminal, Emacstreats the whole terminal screen as one frame.@cindex terminal screen@cindex screen of terminal@cindex tiled windows Most window systems support arbitrarily located overlapping windows.In contrast, Emacs windows are @dfn{tiled}; they never overlap, andtogether they fill the whole screen or frame. Because of the way inwhich Emacs creates new windows and resizes them, not all conceivabletilings of windows on an Emacs frame are actually possible.@xref{Splitting Windows}, and @ref{Size of Window}. @xref{Display}, for information on how the contents of thewindow's buffer are displayed in the window.@defun windowp objectThis function returns @code{t} if @var{object} is a window.@end defun@node Splitting Windows@section Splitting Windows@cindex splitting windows@cindex window splitting The functions described here are the primitives used to split a windowinto two windows. Two higher level functions sometimes split a window,but not always: @code{pop-to-buffer} and @code{display-buffer}(@pxref{Displaying Buffers}). The functions described here do not accept a buffer as an argument.The two ``halves'' of the split window initially display the same bufferpreviously visible in the window that was split.@deffn Command split-window &optional window size horizontalThis function splits a new window out of @var{window}'s screen area.It returns the new window.If @var{horizontal} is non-@code{nil}, then @var{window} splits intotwo side by side windows. The original window @var{window} keeps theleftmost @var{size} columns, and gives the rest of the columns to thenew window. Otherwise, it splits into windows one above the other, and@var{window} keeps the upper @var{size} lines and gives the rest of thelines to the new window. The original window is therefore theleft-hand or upper of the two, and the new window is the right-hand orlower.If @var{window} is omitted or @code{nil}, that stands for the selectedwindow. When you split the selected window, it remains selected.If @var{size} is omitted or @code{nil}, then @var{window} is dividedevenly into two parts. (If there is an odd line, it is allocated tothe new window.) When @code{split-window} is called interactively,all its arguments are @code{nil}.If splitting would result in making a window that is smaller than@code{window-min-height} or @code{window-min-width}, the functionsignals an error and does not split the window at all.The following example starts with one window on a screen that is 50lines high by 80 columns wide; then it splits the window.@smallexample@group(setq w (selected-window)) @result{} #<window 8 on windows.texi>(window-edges) ; @r{Edges in order:} @result{} (0 0 80 50) ; @r{left--top--right--bottom}@end group@group;; @r{Returns window created}(setq w2 (split-window w 15)) @result{} #<window 28 on windows.texi>@end group@group(window-edges w2) @result{} (0 15 80 50) ; @r{Bottom window;} ; @r{top is line 15}@end group@group(window-edges w) @result{} (0 0 80 15) ; @r{Top window}@end group@end smallexampleThe screen looks like this:@smallexample@group __________ | | line 0 | w | |__________| | | line 15 | w2 | |__________| line 50 column 0 column 80@end group@end smallexampleNext, split the top window horizontally:@smallexample@group(setq w3 (split-window w 35 t)) @result{} #<window 32 on windows.texi>@end group@group(window-edges w3) @result{} (35 0 80 15) ; @r{Left edge at column 35}@end group@group(window-edges w) @result{} (0 0 35 15) ; @r{Right edge at column 35}@end group@group(window-edges w2) @result{} (0 15 80 50) ; @r{Bottom window unchanged}@end group@end smallexample@need 3000Now the screen looks like this:@smallexample@group column 35 __________ | | | line 0 | w | w3 | |___|______| | | line 15 | w2 | |__________| line 50 column 0 column 80@end group@end smallexampleNormally, Emacs indicates the border between two side-by-side windowswith a scroll bar (@pxref{Layout Parameters,Scroll Bars}) or @samp{|}characters. The display table can specify alternative bordercharacters; see @ref{Display Tables}.@end deffn@deffn Command split-window-vertically &optional sizeThis function splits the selected window into two windows, one above theother, leaving the upper of the two windows selected, with @var{size}lines. (If @var{size} is negative, then the lower of the two windowsgets @minus{} @var{size} lines and the upper window gets the rest, butthe upper window is still the one selected.) However, if@code{split-window-keep-point} (see below) is @code{nil}, then eitherwindow can be selected.In other respects, this function is similar to @code{split-window}.In particular, the upper window is the original one and the returnvalue is the new, lower window.@end deffn@defopt split-window-keep-pointIf this variable is non-@code{nil} (the default), then@code{split-window-vertically} behaves as described above.If it is @code{nil}, then @code{split-window-vertically} adjusts pointin each of the two windows to avoid scrolling. (This is useful onslow terminals.) It selects whichever window contains the screen linethat point was previously on.This variable only affects the behavior of @code{split-window-vertically}.It has no effect on the other functions described here.@end defopt@deffn Command split-window-horizontally &optional sizeThis function splits the selected window into two windowsside-by-side, leaving the selected window on the left with @var{size}columns. If @var{size} is negative, the rightmost window gets@minus{} @var{size} columns, but the leftmost window still remainsselected.This function is basically an interface to @code{split-window}.You could define a simplified version of the function like this:@smallexample@group(defun split-window-horizontally (&optional arg) "Split selected window into two windows, side by side..." (interactive "P")@end group@group (let ((size (and arg (prefix-numeric-value arg)))) (and size (< size 0) (setq size (+ (window-width) size))) (split-window nil size t)))@end group@end smallexample@end deffn@defun one-window-p &optional no-mini all-framesThis function returns non-@code{nil} if there is only one window. Theargument @var{no-mini}, if non-@code{nil}, means don't count theminibuffer even if it is active; otherwise, the minibuffer window iscounted when it is active.The argument @var{all-frames} specifies which frames to consider. Hereare the possible values and their meanings:@table @asis@item @code{nil}Count the windows in the selected frame, plus the minibuffer usedby that frame even if it lies in some other frame.@item @code{t}Count all windows in all existing frames.@item @code{visible}Count all windows in all visible frames.@item 0Count all windows in all visible or iconified frames.@item anything elseCount precisely the windows in the selected frame, and no others.@end table@end defun@node Deleting Windows@section Deleting Windows@cindex deleting windowsA window remains visible on its frame unless you @dfn{delete} it bycalling certain functions that delete windows. A deleted window cannotappear on the screen, but continues to exist as a Lisp object untilthere are no references to it. There is no way to cancel the deletionof a window aside from restoring a saved window configuration(@pxref{Window Configurations}). Restoring a window configuration alsodeletes any windows that aren't part of that configuration. When you delete a window, the space it took up is given to oneadjacent sibling.@c Emacs 19 feature@defun window-live-p windowThis function returns @code{nil} if @var{window} is deleted, and@code{t} otherwise.@strong{Warning:} Erroneous information or fatal errors may result fromusing a deleted window as if it were live.@end defun@deffn Command delete-window &optional windowThis function removes @var{window} from display, and returns @code{nil}.If @var{window} is omitted, then the selected window is deleted. Anerror is signaled if there is only one window when @code{delete-window}is called.@end deffn@deffn Command delete-other-windows &optional windowThis function makes @var{window} the only window on its frame, bydeleting the other windows in that frame. If @var{window} is omitted or@code{nil}, then the selected window is used by default.The return value is @code{nil}.@end deffn@deffn Command delete-windows-on buffer-or-name &optional frameThis function deletes all windows showing @var{buffer-or-name}. Ifthere are no windows showing @var{buffer-or-name}, it does nothing.@var{buffer-or-name} must be a buffer or the name of an existingbuffer.@code{delete-windows-on} operates frame by frame. If a frame hasseveral windows showing different buffers, then those showing@var{buffer-or-name} are removed, and the others expand to fill thespace. If all windows in some frame are showing @var{buffer-or-name}(including the case where there is only one window), then the framewinds up with a single window showing another buffer chosen with@code{other-buffer}. @xref{The Buffer List}.The argument @var{frame} controls which frames to operate on. Thisfunction does not use it in quite the same way as the other functionswhich scan all windows; specifically, the values @code{t} and @code{nil}have the opposite of their meanings in other functions. Here are thefull details:@itemize @bullet@itemIf it is @code{nil}, operate on all frames.@itemIf it is @code{t}, operate on the selected frame.@itemIf it is @code{visible}, operate on all visible frames.@itemIf it is 0, operate on all visible or iconified frames.@itemIf it is a frame, operate on that frame.@end itemizeThis function always returns @code{nil}.@end deffn@node Selecting Windows@section Selecting Windows@cindex selecting a window When a window is selected, the buffer in the window becomes the currentbuffer, and the cursor will appear in it.@defun selected-windowThis function returns the selected window. This is the window inwhich the cursor appears and to which many commands apply.@end defun@defun select-window window &optional norecordThis function makes @var{window} the selected window. The cursor thenappears in @var{window} (on redisplay). Unless @var{window} wasalready selected, @code{select-window} makes @var{window}'s buffer thecurrent buffer.Normally @var{window}'s selected buffer is moved to the front of thebuffer list, but if @var{norecord} is non-@code{nil}, the buffer listorder is unchanged.The return value is @var{window}.@example@group(setq w (next-window))(select-window w) @result{} #<window 65 on windows.texi>@end group@end example@end defun@defmac save-selected-window forms@dots{}This macro records the selected frame, as well as the selected windowof each frame, executes @var{forms} in sequence, then restores theearlier selected frame and windows. It also saves and restores thecurrent buffer. It returns the value of the last form in @var{forms}.This macro does not save or restore anything about the sizes,arrangement or contents of windows; therefore, if the @var{forms}change them, the change persists. If the previously selected windowof some frame is no longer live at the time of exit from @var{forms},that frame's selected window is left alone. If the previouslyselected window is no longer live, then whatever window is selected atthe end of @var{forms} remains selected.@end defmac@defmac with-selected-window window forms@dots{}This macro selects @var{window} (without changing the buffer list),executes @var{forms} in sequence, then restores the previouslyselected window and current buffer. It is just like@code{save-selected-window}, except that it explicitly selects@var{window}, also without altering the buffer list sequence.@end defmac@cindex finding windows The following functions choose one of the windows on the screen,offering various criteria for the choice.@defun get-lru-window &optional frame dedicatedThis function returns the window least recently ``used'' (that is,selected). If any full-width windows are present, it only considersthese. The selected window is always the most recently used window.The selected window can be the least recently used window if it is theonly window. A newly created window becomes the least recently usedwindow until it is selected. A minibuffer window is never acandidate. Dedicated windows are never candidates unless the@var{dedicated} argument is non-@code{nil}, so if allexisting windows are dedicated, the value is @code{nil}.The argument @var{frame} controls which windows are considered.@itemize @bullet@itemIf it is @code{nil}, consider windows on the selected frame.@itemIf it is @code{t}, consider windows on all frames.@itemIf it is @code{visible}, consider windows on all visible frames.@itemIf it is 0, consider windows on all visible or iconified frames.@itemIf it is a frame, consider windows on that frame.@end itemize@end defun@defun get-largest-window &optional frame dedicatedThis function returns the window with the largest area (height timeswidth). If there are no side-by-side windows, then this is the windowwith the most lines. A minibuffer window is never a candidate.Dedicated windows are never candidates unless the@var{dedicated} argument is non-@code{nil}, so if all existing windowsare dedicated, the value is @code{nil}.If there are two candidate windows of the same size, this functionprefers the one that comes first in the cyclic ordering of windows(see following section), starting from the selected window.The argument @var{frame} controls which set of windows toconsider. See @code{get-lru-window}, above.@end defun@cindex window that satisfies a predicate@cindex conditional selection of windows@defun get-window-with-predicate predicate &optional minibuf all-frames defaultThis function returns a window satisfying @var{predicate}. It cyclesthrough all visible windows using @code{walk-windows} (@pxref{CyclicWindow Ordering}), calling @var{predicate} on each one of themwith that window as its argument. The function returns the firstwindow for which @var{predicate} returns a non-@code{nil} value; ifthat never happens, it returns @var{default}.The optional arguments @var{minibuf} and @var{all-frames} specify theset of windows to include in the scan. See the description of@code{next-window} in @ref{Cyclic Window Ordering}, for details.@end defun@node Cyclic Window Ordering@comment node-name, next, previous, up@section Cyclic Ordering of Windows@cindex cyclic ordering of windows@cindex ordering of windows, cyclic@cindex window ordering, cyclic When you use the command @kbd{C-x o} (@code{other-window}) to selectthe next window, it moves through all the windows on the screen in aspecific cyclic order. For any given configuration of windows, thisorder never varies. It is called the @dfn{cyclic ordering of windows}. This ordering generally goes from top to bottom, and from left toright. But it may go down first or go right first, depending on theorder in which the windows were split. If the first split was vertical (into windows one above each other),and then the subwindows were split horizontally, then the ordering isleft to right in the top of the frame, and then left to right in thenext lower part of the frame, and so on. If the first split washorizontal, the ordering is top to bottom in the left part, and so on.In general, within each set of siblings at any level in the window tree,the order is left to right, or top to bottom.@defun next-window &optional window minibuf all-frames@cindex minibuffer window, and @code{next-window}This function returns the window following @var{window} in the cyclicordering of windows. This is the window that @kbd{C-x o} would selectif typed when @var{window} is selected. If @var{window} is the onlywindow visible, then this function returns @var{window}. If omitted,@var{window} defaults to the selected window.The value of the argument @var{minibuf} determines whether theminibuffer is included in the window order. Normally, when@var{minibuf} is @code{nil}, the minibuffer is included if it iscurrently active; this is the behavior of @kbd{C-x o}. (The minibufferwindow is active while the minibuffer is in use. @xref{Minibuffers}.)If @var{minibuf} is @code{t}, then the cyclic ordering includes theminibuffer window even if it is not active.If @var{minibuf} is neither @code{t} nor @code{nil}, then the minibufferwindow is not included even if it is active.The argument @var{all-frames} specifies which frames to consider. Hereare the possible values and their meanings:@table @asis@item @code{nil}Consider all the windows in @var{window}'s frame, plus the minibufferused by that frame even if it lies in some other frame. If theminibuffer counts (as determined by @var{minibuf}), then all windows onall frames that share that minibuffer count too.@item @code{t}Consider all windows in all existing frames.@item @code{visible}Consider all windows in all visible frames. (To get useful results, youmust ensure @var{window} is in a visible frame.)@item 0Consider all windows in all visible or iconified frames.@item a frameConsider all windows on that frame.@item anything elseConsider precisely the windows in @var{window}'s frame, and no others.@end tableThis example assumes there are two windows, both displaying thebuffer @samp{windows.texi}:@example@group(selected-window) @result{} #<window 56 on windows.texi>@end group@group(next-window (selected-window)) @result{} #<window 52 on windows.texi>@end group@group(next-window (next-window (selected-window))) @result{} #<window 56 on windows.texi>@end group@end example@end defun@defun previous-window &optional window minibuf all-framesThis function returns the window preceding @var{window} in the cyclicordering of windows. The other arguments specify which windows toinclude in the cycle, as in @code{next-window}.@end defun@deffn Command other-window count &optional all-framesThis function selects the @var{count}th following window in the cyclicorder. If count is negative, then it moves back @minus{}@var{count}windows in the cycle, rather than forward. It returns @code{nil}.The argument @var{all-frames} has the same meaning as in@code{next-window}, but the @var{minibuf} argument of @code{next-window}is always effectively @code{nil}.In an interactive call, @var{count} is the numeric prefix argument.@end deffn@c Emacs 19 feature@defun walk-windows proc &optional minibuf all-framesThis function cycles through all windows. It calls the function@code{proc} once for each window, with the window as its soleargument.The optional arguments @var{minibuf} and @var{all-frames} specify theset of windows to include in the scan. See @code{next-window}, above,for details.@end defun@defun window-list &optional frame minibuf windowThis function returns a list of the windows on @var{frame}, startingwith @var{window}. If @var{frame} is @code{nil} or omitted,@code{window-list} uses the selected frame instead; if @var{window} is@code{nil} or omitted, it uses the selected window.The value of @var{minibuf} determines if the minibuffer window isincluded in the result list. If @var{minibuf} is @code{t}, the resultalways includes the minibuffer window. If @var{minibuf} is @code{nil}or omitted, that includes the minibuffer window if it is active. If@var{minibuf} is neither @code{nil} nor @code{t}, the result neverincludes the minibuffer window.@end defun@node Buffers and Windows@section Buffers and Windows@cindex examining windows@cindex windows, controlling precisely@cindex buffers, controlled in windows This section describes low-level functions to examine windows or todisplay buffers in windows in a precisely controlled fashion.@iftexSee the following section for@end iftex@ifnottex@xref{Displaying Buffers}, for@end ifnottexrelated functions that find a window to use and specify a buffer for it.The functions described there are easier to use than these, but theyemploy heuristics in choosing or creating a window; use these functionswhen you need complete control.@defun set-window-buffer window buffer-or-name &optional keep-marginsThis function makes @var{window} display @var{buffer-or-name} as itscontents. It returns @code{nil}. @var{buffer-or-name} must be abuffer, or the name of an existing buffer. This is the fundamentalprimitive for changing which buffer is displayed in a window, and allways of doing that call this function.@example@group(set-window-buffer (selected-window) "foo") @result{} nil@end group@end exampleNormally, displaying @var{buffer} in @var{window} resets the window'sdisplay margins, fringe widths, scroll bar settings, and positionbased on the local variables of @var{buffer}. However, if@var{keep-margins} is non-@code{nil}, the display margins and fringewidths of @var{window} remain unchanged. @xref{Fringes}.@end defun@defvar buffer-display-countThis buffer-local variable records the number of times a buffer isdisplayed in a window. It is incremented each time@code{set-window-buffer} is called for the buffer.@end defvar@defun window-buffer &optional windowThis function returns the buffer that @var{window} is displaying. If@var{window} is omitted, this function returns the buffer for theselected window.@example@group(window-buffer) @result{} #<buffer windows.texi>@end group@end example@end defun@defun get-buffer-window buffer-or-name &optional all-framesThis function returns a window currently displaying@var{buffer-or-name}, or @code{nil} if there is none. If there areseveral such windows, then the function returns the first one in thecyclic ordering of windows, starting from the selected window.@xref{Cyclic Window Ordering}.The argument @var{all-frames} controls which windows to consider.@itemize @bullet@itemIf it is @code{nil}, consider windows on the selected frame.@itemIf it is @code{t}, consider windows on all frames.@itemIf it is @code{visible}, consider windows on all visible frames.@itemIf it is 0, consider windows on all visible or iconified frames.@itemIf it is a frame, consider windows on that frame.@end itemize@end defun@defun get-buffer-window-list buffer-or-name &optional minibuf all-framesThis function returns a list of all the windows currently displaying@var{buffer-or-name}.The two optional arguments work like the optional arguments of@code{next-window} (@pxref{Cyclic Window Ordering}); they are @emph{not}like the single optional argument of @code{get-buffer-window}. Perhapswe should change @code{get-buffer-window} in the future to make itcompatible with the other functions.@end defun@defvar buffer-display-timeThis variable records the time at which a buffer was last made visiblein a window. It is always local in each buffer; each time@code{set-window-buffer} is called, it sets this variable to@code{(current-time)} in the specified buffer (@pxref{Time of Day}).When a buffer is first created, @code{buffer-display-time} starts outwith the value @code{nil}.@end defvar@node Displaying Buffers@section Displaying Buffers in Windows@cindex switching to a buffer@cindex displaying a buffer In this section we describe convenient functions that choose a windowautomatically and use it to display a specified buffer. These functionscan also split an existing window in certain circumstances. We alsodescribe variables that parameterize the heuristics used for choosing awindow.@iftexSee the preceding section for@end iftex@ifnottex@xref{Buffers and Windows}, for@end ifnottexlow-level functions that give you more precise control. All of thesefunctions work by calling @code{set-window-buffer}. Do not use the functions in this section in order to make a buffercurrent so that a Lisp program can access or modify it; they are toodrastic for that purpose, since they change the display of buffers inwindows, which would be gratuitous and surprise the user. Instead, use@code{set-buffer} and @code{save-current-buffer} (@pxref{CurrentBuffer}), which designate buffers as current for programmed accesswithout affecting the display of buffers in windows.@deffn Command switch-to-buffer buffer-or-name &optional norecordThis function makes @var{buffer-or-name} the current buffer, and alsodisplays the buffer in the selected window. This means that a human cansee the buffer and subsequent keyboard commands will apply to it.Contrast this with @code{set-buffer}, which makes @var{buffer-or-name}the current buffer but does not display it in the selected window.@xref{Current Buffer}.If @var{buffer-or-name} does not identify an existing buffer, then a newbuffer by that name is created. The major mode for the new buffer isset according to the variable @code{default-major-mode}. @xref{AutoMajor Mode}. If @var{buffer-or-name} is @code{nil},@code{switch-to-buffer} chooses a buffer using @code{other-buffer}.Normally the specified buffer is put at the front of the buffer list(both the selected frame's buffer list and the frame-independent bufferlist). This affects the operation of @code{other-buffer}. However, if@var{norecord} is non-@code{nil}, this is not done. @xref{The BufferList}.The @code{switch-to-buffer} function is often used interactively, asthe binding of @kbd{C-x b}. It is also used frequently in programs. Itreturns the buffer that it switched to.@end deffnThe next two functions are similar to @code{switch-to-buffer}, exceptfor the described features.@deffn Command switch-to-buffer-other-window buffer-or-name &optional norecordThis function makes @var{buffer-or-name} the current buffer anddisplays it in a window not currently selected. It then selects thatwindow. The handling of the buffer is the same as in@code{switch-to-buffer}.The currently selected window is absolutely never used to do the job.If it is the only window, then it is split to make a distinct window forthis purpose. If the selected window is already displaying the buffer,then it continues to do so, but another window is nonetheless found todisplay it in as well.This function updates the buffer list just like @code{switch-to-buffer}unless @var{norecord} is non-@code{nil}.@end deffn@defun pop-to-buffer buffer-or-name &optional other-window norecordThis function makes @var{buffer-or-name} the current buffer andswitches to it in some window, preferably not the window previouslyselected. The ``popped-to'' window becomes the selected window withinits frame. The return value is the buffer that was switched to.If @var{buffer-or-name} is @code{nil}, that means to choose someother buffer, but you don't specify which.If the variable @code{pop-up-frames} is non-@code{nil},@code{pop-to-buffer} looks for a window in any visible frame alreadydisplaying the buffer; if there is one, it returns that window and makesit be selected within its frame. If there is none, it creates a newframe and displays the buffer in it.If @code{pop-up-frames} is @code{nil}, then @code{pop-to-buffer}operates entirely within the selected frame. (If the selected frame hasjust a minibuffer, @code{pop-to-buffer} operates within the mostrecently selected frame that was not just a minibuffer.)If the variable @code{pop-up-windows} is non-@code{nil}, windows maybe split to create a new window that is different from the originalwindow. For details, see @ref{Choosing Window}.If @var{other-window} is non-@code{nil}, @code{pop-to-buffer} finds orcreates another window even if @var{buffer-or-name} is already visiblein the selected window. Thus @var{buffer-or-name} could end updisplayed in two windows. On the other hand, if @var{buffer-or-name} isalready displayed in the selected window and @var{other-window} is@code{nil}, then the selected window is considered sufficient displayfor @var{buffer-or-name}, so that nothing needs to be done.All the variables that affect @code{display-buffer} affect@code{pop-to-buffer} as well. @xref{Choosing Window}.If @var{buffer-or-name} is a string that does not name an existingbuffer, a buffer by that name is created. The major mode for the newbuffer is set according to the variable @code{default-major-mode}.@xref{Auto Major Mode}.This function updates the buffer list just like @code{switch-to-buffer}unless @var{norecord} is non-@code{nil}.@end defun@deffn Command replace-buffer-in-windows buffer-or-nameThis function replaces @var{buffer-or-name} with some other buffer in allwindows displaying it. It chooses the other buffer with@code{other-buffer}. In the usual applications of this function, youdon't care which other buffer is used; you just want to make sure that@var{buffer-or-name} is no longer displayed.This function returns @code{nil}.@end deffn@node Choosing Window@section Choosing a Window for Display This section describes the basic facility that chooses a window todisplay a buffer in---@code{display-buffer}. All the higher-levelfunctions and commands use this subroutine. Here we describe how to use@code{display-buffer} and how to customize it.@deffn Command display-buffer buffer-or-name &optional not-this-window frameThis command makes @var{buffer-or-name} appear in some window, like@code{pop-to-buffer}, but it does not select that window and does notmake the buffer current. The identity of the selected window isunaltered by this function. @var{buffer-or-name} must be a buffer, orthe name of an existing buffer.If @var{not-this-window} is non-@code{nil}, it means to display thespecified buffer in a window other than the selected one, even if it isalready on display in the selected window. This can cause the buffer toappear in two windows at once. Otherwise, if @var{buffer-or-name} isalready being displayed in any window, that is good enough, so thisfunction does nothing.@code{display-buffer} returns the window chosen to display@var{buffer-or-name}.If the argument @var{frame} is non-@code{nil}, it specifies which framesto check when deciding whether the buffer is already displayed. If thebuffer is already displayed in some window on one of these frames,@code{display-buffer} simply returns that window. Here are the possiblevalues of @var{frame}:@itemize @bullet@itemIf it is @code{nil}, consider windows on the selected frame.(Actually, the last non-minibuffer frame.)@itemIf it is @code{t}, consider windows on all frames.@itemIf it is @code{visible}, consider windows on all visible frames.@itemIf it is 0, consider windows on all visible or iconified frames.@itemIf it is a frame, consider windows on that frame.@end itemizePrecisely how @code{display-buffer} finds or creates a window depends onthe variables described below.@end deffn@defopt display-buffer-reuse-framesIf this variable is non-@code{nil}, @code{display-buffer} searchesexisting frames for a window displaying the buffer. If the buffer isalready displayed in a window in some frame, @code{display-buffer} makesthe frame visible and raises it, to use that window. If the buffer isnot already displayed, or if @code{display-buffer-reuse-frames} is@code{nil}, @code{display-buffer}'s behavior is determined by othervariables, described below.@end defopt@defopt pop-up-windowsThis variable controls whether @code{display-buffer} makes new windows.If it is non-@code{nil} and there is only one window, then that windowis split. If it is @code{nil}, then @code{display-buffer} does notsplit the single window, but uses it whole.@end defopt@defopt split-height-thresholdThis variable determines when @code{display-buffer} may split a window,if there are multiple windows. @code{display-buffer} always splits thelargest window if it has at least this many lines. If the largestwindow is not this tall, it is split only if it is the sole window and@code{pop-up-windows} is non-@code{nil}.@end defopt@defopt even-window-heightsThis variable determines if @code{display-buffer} should even out windowheights if the buffer gets displayed in an existing window, above orbeneath another existing window. If @code{even-window-heights} is@code{t}, the default, window heights will be evened out. If@code{even-window-heights} is @code{nil}, the original window heightswill be left alone.@end defopt@c Emacs 19 feature@defopt pop-up-framesThis variable controls whether @code{display-buffer} makes new frames.If it is non-@code{nil}, @code{display-buffer} looks for an existingwindow already displaying the desired buffer, on any visible frame. Ifit finds one, it returns that window. Otherwise it makes a new frame.The variables @code{pop-up-windows} and @code{split-height-threshold} donot matter if @code{pop-up-frames} is non-@code{nil}.If @code{pop-up-frames} is @code{nil}, then @code{display-buffer} eithersplits a window or reuses one.@xref{Frames}, for more information.@end defopt@c Emacs 19 feature@defopt pop-up-frame-functionThis variable specifies how to make a new frame if @code{pop-up-frames}is non-@code{nil}.Its value should be a function of no arguments. When@code{display-buffer} makes a new frame, it does so by calling thatfunction, which should return a frame. The default value of thevariable is a function that creates a frame using parameters from@code{pop-up-frame-alist}.@end defopt@defopt pop-up-frame-alistThis variable holds an alist specifying frame parameters used when@code{display-buffer} makes a new frame. @xref{Frame Parameters}, formore information about frame parameters.@end defopt@defopt special-display-buffer-namesA list of buffer names for buffers that should be displayed specially.If the buffer's name is in this list, @code{display-buffer} handles thebuffer specially.By default, special display means to give the buffer a dedicated frame.If an element is a list, instead of a string, then the @sc{car} of thelist is the buffer name, and the rest of the list says how to createthe frame. There are two possibilities for the rest of the list (its@sc{cdr}). It can be an alist, specifying frame parameters, or it cancontain a function and arguments to give to it. (The function's firstargument is always the buffer to be displayed; the arguments from thelist come after that.)For example:@example(("myfile" (minibuffer) (menu-bar-lines . 0)))@end example@noindentspecifies to display a buffer named @samp{myfile} in a dedicated framewith specified @code{minibuffer} and @code{menu-bar-lines} parameters.The list of frame parameters can also use the phony frame parameters@code{same-frame} and @code{same-window}. If the specified frameparameters include @code{(same-window . @var{value})} and @var{value}is non-@code{nil}, that means to display the buffer in the currentselected window. Otherwise, if they include @code{(same-frame .@var{value})} and @var{value} is non-@code{nil}, that means to displaythe buffer in a new window in the currently selected frame.@end defopt@defopt special-display-regexpsA list of regular expressions that specify buffers that should bedisplayed specially. If the buffer's name matches any of the regularexpressions in this list, @code{display-buffer} handles the bufferspecially.By default, special display means to give the buffer a dedicated frame.If an element is a list, instead of a string, then the @sc{car} of thelist is the regular expression, and the rest of the list says how tocreate the frame. See above, under @code{special-display-buffer-names}.@end defopt@defun special-display-p buffer-nameThis function returns non-@code{nil} if displaying a buffernamed @var{buffer-name} with @code{display-buffer} wouldcreate a special frame. The value is @code{t} if it woulduse the default frame parameters, or else the specified listof frame parameters.@end defun@defvar special-display-functionThis variable holds the function to call to display a buffer specially.It receives the buffer as an argument, and should return the window inwhich it is displayed.The default value of this variable is@code{special-display-popup-frame}.@end defvar@defun special-display-popup-frame buffer &optional argsThis function makes @var{buffer} visible in a frame of its own. If@var{buffer} is already displayed in a window in some frame, it makesthe frame visible and raises it, to use that window. Otherwise, itcreates a frame that will be dedicated to @var{buffer}. Thisfunction returns the window it used.If @var{args} is an alist, it specifies frame parameters for the newframe.If @var{args} is a list whose @sc{car} is a symbol, then @code{(car@var{args})} is called as a function to actually create and set up theframe; it is called with @var{buffer} as first argument, and @code{(cdr@var{args})} as additional arguments.This function always uses an existing window displaying @var{buffer},whether or not it is in a frame of its own; but if you set up the abovevariables in your init file, before @var{buffer} was created, thenpresumably the window was previously made by this function.@end defun@defopt special-display-frame-alist@anchor{Definition of special-display-frame-alist}This variable holds frame parameters for@code{special-display-popup-frame} to use when it creates a frame.@end defopt@defopt same-window-buffer-namesA list of buffer names for buffers that should be displayed in theselected window. If the buffer's name is in this list,@code{display-buffer} handles the buffer by switching to it in theselected window.@end defopt@defopt same-window-regexpsA list of regular expressions that specify buffers that should bedisplayed in the selected window. If the buffer's name matches any ofthe regular expressions in this list, @code{display-buffer} handles thebuffer by switching to it in the selected window.@end defopt@defun same-window-p buffer-nameThis function returns @code{t} if displaying a buffernamed @var{buffer-name} with @code{display-buffer} wouldput it in the selected window.@end defun@c Emacs 19 feature@defvar display-buffer-functionThis variable is the most flexible way to customize the behavior of@code{display-buffer}. If it is non-@code{nil}, it should be a functionthat @code{display-buffer} calls to do the work. The function shouldaccept two arguments, the first two arguments that @code{display-buffer}received. It should choose or create a window, display the specifiedbuffer in it, and then return the window.This hook takes precedence over all the other options and hooksdescribed above.@end defvar@c Emacs 19 feature@cindex dedicated windowA window can be marked as ``dedicated'' to its buffer. Then@code{display-buffer} will not try to use that window to display anyother buffer.@defun window-dedicated-p windowThis function returns non-@code{nil} if @var{window} is marked asdedicated; otherwise @code{nil}.@end defun@defun set-window-dedicated-p window flagThis function marks @var{window} as dedicated if @var{flag} isnon-@code{nil}, and nondedicated otherwise.@end defun@node Window Point@section Windows and Point@cindex window position@cindex window point@cindex position in window@cindex point in window Each window has its own value of point, independent of the value ofpoint in other windows displaying the same buffer. This makes it usefulto have multiple windows showing one buffer.@itemize @bullet@itemThe window point is established when a window is first created; it isinitialized from the buffer's point, or from the window point of anotherwindow opened on the buffer if such a window exists.@itemSelecting a window sets the value of point in its buffer from thewindow's value of point. Conversely, deselecting a window sets thewindow's value of point from that of the buffer. Thus, when you switchbetween windows that display a given buffer, the point value for theselected window is in effect in the buffer, while the point values forthe other windows are stored in those windows.@itemAs long as the selected window displays the current buffer, the window'spoint and the buffer's point always move together; they remain equal.@end itemize@noindent@xref{Positions}, for more details on buffer positions.@cindex cursor As far as the user is concerned, point is where the cursor is, andwhen the user switches to another buffer, the cursor jumps to theposition of point in that buffer.@defun window-point &optional windowThis function returns the current position of point in @var{window}.For a nonselected window, this is the value point would have (in thatwindow's buffer) if that window were selected. If @var{window} is@code{nil}, the selected window is used.When @var{window} is the selected window and its buffer is also thecurrent buffer, the value returned is the same as point in that buffer.Strictly speaking, it would be more correct to return the``top-level'' value of point, outside of any @code{save-excursion}forms. But that value is hard to find.@end defun@defun set-window-point window positionThis function positions point in @var{window} at position@var{position} in @var{window}'s buffer. It returns @var{position}.If @var{window} is selected, and its buffer is current,this simply does @code{goto-char}.@end defun@node Window Start@section The Window Start Position@cindex window start position Each window contains a marker used to keep track of a buffer positionthat specifies where in the buffer display should start. This positionis called the @dfn{display-start} position of the window (or just the@dfn{start}). The character after this position is the one that appearsat the upper left corner of the window. It is usually, but notinevitably, at the beginning of a text line.@defun window-start &optional window@cindex window top lineThis function returns the display-start position of window@var{window}. If @var{window} is @code{nil}, the selected window isused. For example,@example@group(window-start) @result{} 7058@end group@end exampleWhen you create a window, or display a different buffer in it, thedisplay-start position is set to a display-start position recently usedfor the same buffer, or 1 if the buffer doesn't have any.Redisplay updates the window-start position (if you have not specifiedit explicitly since the previous redisplay)---for example, to make surepoint appears on the screen. Nothing except redisplay automaticallychanges the window-start position; if you move point, do not expect thewindow-start position to change in response until after the nextredisplay.For a realistic example of using @code{window-start}, see thedescription of @code{count-lines}. @xref{Definition of count-lines}.@end defun@defun window-end &optional window updateThis function returns the position of the end of the display in window@var{window}. If @var{window} is @code{nil}, the selected window isused.Simply changing the buffer text or moving point does not update thevalue that @code{window-end} returns. The value is updated only whenEmacs redisplays and redisplay completes without being preempted.If the last redisplay of @var{window} was preempted, and did not finish,Emacs does not know the position of the end of display in that window.In that case, this function returns @code{nil}.If @var{update} is non-@code{nil}, @code{window-end} always returns anup-to-date value for where the window ends, based on the current@code{window-start} value. If the saved value is valid,@code{window-end} returns that; otherwise it computes the correctvalue by scanning the buffer text.Even if @var{update} is non-@code{nil}, @code{window-end} does notattempt to scroll the display if point has moved off the screen, theway real redisplay would do. It does not alter the@code{window-start} value. In effect, it reports where the displayedtext will end if scrolling is not required.@end defun@defun set-window-start window position &optional noforceThis function sets the display-start position of @var{window} to@var{position} in @var{window}'s buffer. It returns @var{position}.The display routines insist that the position of point be visible when abuffer is displayed. Normally, they change the display-start position(that is, scroll the window) whenever necessary to make point visible.However, if you specify the start position with this function using@code{nil} for @var{noforce}, it means you want display to start at@var{position} even if that would put the location of point off thescreen. If this does place point off screen, the display routines movepoint to the left margin on the middle line in the window.For example, if point @w{is 1} and you set the start of the window @w{to2}, then point would be ``above'' the top of the window. The displayroutines will automatically move point if it is still 1 when redisplayoccurs. Here is an example:@example@group;; @r{Here is what @samp{foo} looks like before executing};; @r{the @code{set-window-start} expression.}@end group@group---------- Buffer: foo ----------@point{}This is the contents of buffer foo.23456---------- Buffer: foo ----------@end group@group(set-window-start (selected-window) (1+ (window-start)))@result{} 2@end group@group;; @r{Here is what @samp{foo} looks like after executing};; @r{the @code{set-window-start} expression.}---------- Buffer: foo ----------his is the contents of buffer foo.23@point{}456---------- Buffer: foo ----------@end group@end exampleIf @var{noforce} is non-@code{nil}, and @var{position} would place pointoff screen at the next redisplay, then redisplay computes a new window-startposition that works well with point, and thus @var{position} is not used.@end defun@defun pos-visible-in-window-p &optional position window partiallyThis function returns non-@code{nil} if @var{position} is within therange of text currently visible on the screen in @var{window}. Itreturns @code{nil} if @var{position} is scrolled vertically out ofview. Locations that are partially obscured are not consideredvisible unless @var{partially} is non-@code{nil}. The argument@var{position} defaults to the current position of point in@var{window}; @var{window}, to the selected window.If @var{position} is @code{t}, that means to check the last visibleposition in @var{window}.The @code{pos-visible-in-window-p} function considers only verticalscrolling. If @var{position} is out of view only because @var{window}has been scrolled horizontally, @code{pos-visible-in-window-p} returnsnon-@code{nil} anyway. @xref{Horizontal Scrolling}.If @var{position} is visible, @code{pos-visible-in-window-p} returns@code{t} if @var{partially} is @code{nil}; if @var{partially} isnon-@code{nil}, and the character after @var{position} is fullyvisible, it returns a list of the form @code{(@var{x} @var{y})}, where@var{x} and @var{y} are the pixel coordinates relative to the top leftcorner of the window; otherwise it returns an extended list of theform @code{(@var{x} @var{y} @var{rtop} @var{rbot} @var{rowh}@var{vpos})}, where the @var{rtop} and @var{rbot} specify the numberof off-window pixels at the top and bottom of the row at@var{position}, @var{rowh} specifies the visible height of that row,and @var{vpos} specifies the vertical position (zero-based row number)of that row.Here is an example:@example@group;; @r{If point is off the screen now, recenter it now.}(or (pos-visible-in-window-p (point) (selected-window)) (recenter 0))@end group@end example@end defun@defun window-line-height &optional line windowThis function returns information about text line @var{line} in @var{window}.If @var{line} is one of @code{header-line} or @code{mode-line},@code{window-line-height} returns information about the correspondingline of the window. Otherwise, @var{line} is a text line numberstarting from 0. A negative number counts from the end of the window.The argument @var{line} defaults to the current line in @var{window};@var{window}, to the selected window.If the display is not up to date, @code{window-line-height} returns@code{nil}. In that case, @code{pos-visible-in-window-p} may be usedto obtain related information.If there is no line corresponding to the specified @var{line},@code{window-line-height} returns @code{nil}. Otherwise, it returnsa list @code{(@var{height} @var{vpos} @var{ypos} @var{offbot})},where @var{height} is the height in pixels of the visible part of theline, @var{vpos} and @var{ypos} are the vertical position in lines andpixels of the line relative to the top of the first text line, and@var{offbot} is the number of off-window pixels at the bottom of thetext line. If there are off-window pixels at the top of the (first)text line, @var{ypos} is negative.@end defun@node Textual Scrolling@section Textual Scrolling@cindex textual scrolling@cindex scrolling textually @dfn{Textual scrolling} means moving the text up or down through awindow. It works by changing the value of the window's display-startlocation. It may also change the value of @code{window-point} to keeppoint on the screen. Textual scrolling was formerly called ``vertical scrolling,'' but wechanged its name to distinguish it from the new vertical fractionalscrolling feature (@pxref{Vertical Scrolling}). In the commands @code{scroll-up} and @code{scroll-down}, the directions``up'' and ``down'' refer to the motion of the text in the buffer at whichyou are looking through the window. Imagine that the text iswritten on a long roll of paper and that the scrolling commands move thepaper up and down. Thus, if you are looking at text in the middle of abuffer and repeatedly call @code{scroll-down}, you will eventually seethe beginning of the buffer. Some people have urged that the opposite convention be used: theyimagine that the window moves over text that remains in place. Then``down'' commands would take you to the end of the buffer. This view ismore consistent with the actual relationship between windows and thetext in the buffer, but it is less like what the user sees. Theposition of a window on the terminal does not move, and short scrollingcommands clearly move the text up or down on the screen. We have chosennames that fit the user's point of view. The textual scrolling functions (aside from@code{scroll-other-window}) have unpredictable results if the currentbuffer is different from the buffer that is displayed in the selectedwindow. @xref{Current Buffer}. If the window contains a row which is taller than the height of thewindow (for example in the presence of a large image), the scrollfunctions will adjust the window vscroll to scroll the partiallyvisible row. To disable this feature, Lisp code may bind the variable`auto-window-vscroll' to @code{nil} (@pxref{Vertical Scrolling}).@deffn Command scroll-up &optional countThis function scrolls the text in the selected window upward@var{count} lines. If @var{count} is negative, scrolling is actuallydownward.If @var{count} is @code{nil} (or omitted), then the length of scrollis @code{next-screen-context-lines} lines less than the usable height ofthe window (not counting its mode line).@code{scroll-up} returns @code{nil}, unless it gets an errorbecause it can't scroll any further.@end deffn@deffn Command scroll-down &optional countThis function scrolls the text in the selected window downward@var{count} lines. If @var{count} is negative, scrolling is actuallyupward.If @var{count} is omitted or @code{nil}, then the length of the scrollis @code{next-screen-context-lines} lines less than the usable height ofthe window (not counting its mode line).@code{scroll-down} returns @code{nil}, unless it gets an error becauseit can't scroll any further.@end deffn@deffn Command scroll-other-window &optional countThis function scrolls the text in another window upward @var{count}lines. Negative values of @var{count}, or @code{nil}, are handledas in @code{scroll-up}.You can specify which buffer to scroll by setting the variable@code{other-window-scroll-buffer} to a buffer. If that buffer isn'talready displayed, @code{scroll-other-window} displays it in somewindow.When the selected window is the minibuffer, the next window is normallythe one at the top left corner. You can specify a different window toscroll, when the minibuffer is selected, by setting the variable@code{minibuffer-scroll-window}. This variable has no effect when anyother window is selected. When it is non-@code{nil} and theminibuffer is selected, it takes precedence over@code{other-window-scroll-buffer}. @xref{Definition ofminibuffer-scroll-window}.When the minibuffer is active, it is the next window if the selectedwindow is the one at the bottom right corner. In this case,@code{scroll-other-window} attempts to scroll the minibuffer. If theminibuffer contains just one line, it has nowhere to scroll to, so theline reappears after the echo area momentarily displays the message@samp{Beginning of buffer}.@end deffn@c Emacs 19 feature@defvar other-window-scroll-bufferIf this variable is non-@code{nil}, it tells @code{scroll-other-window}which buffer to scroll.@end defvar@defopt scroll-marginThis option specifies the size of the scroll margin---a minimum numberof lines between point and the top or bottom of a window. Wheneverpoint gets within this many lines of the top or bottom of the window,redisplay scrolls the text automatically (if possible) to move pointout of the margin, closer to the center of the window.@end defopt@defopt scroll-conservativelyThis variable controls how scrolling is done automatically when pointmoves off the screen (or into the scroll margin). If the value is apositive integer @var{n}, then redisplay scrolls the text up to@var{n} lines in either direction, if that will bring point back intoproper view. This action is called @dfn{conservative scrolling}.Otherwise, scrolling happens in the usual way, under the control ofother variables such as @code{scroll-up-aggressively} and@code{scroll-down-aggressively}.The default value is zero, which means that conservative scrollingnever happens.@end defopt@defopt scroll-down-aggressivelyThe value of this variable should be either @code{nil} or a fraction@var{f} between 0 and 1. If it is a fraction, that specifies where onthe screen to put point when scrolling down. More precisely, when awindow scrolls down because point is above the window start, the newstart position is chosen to put point @var{f} part of the windowheight from the top. The larger @var{f}, the more aggressive thescrolling.A value of @code{nil} is equivalent to .5, since its effect is to centerpoint. This variable automatically becomes buffer-local when set in anyfashion.@end defopt@defopt scroll-up-aggressivelyLikewise, for scrolling up. The value, @var{f}, specifies how farpoint should be placed from the bottom of the window; thus, as with@code{scroll-up-aggressively}, a larger value scrolls more aggressively.@end defopt@defopt scroll-stepThis variable is an older variant of @code{scroll-conservatively}. Thedifference is that it if its value is @var{n}, that permits scrollingonly by precisely @var{n} lines, not a smaller number. This featuredoes not work with @code{scroll-margin}. The default value is zero.@end defopt@defopt scroll-preserve-screen-positionIf this option is @code{t}, scrolling which would move the currentpoint position out of the window chooses the new position of pointso that the vertical position of the cursor is unchanged, if possible.If it is non-@code{nil} and not @code{t}, then the scrolling functionsalways preserve the vertical position of point, if possible.@end defopt@defopt next-screen-context-linesThe value of this variable is the number of lines of continuity toretain when scrolling by full screens. For example, @code{scroll-up}with an argument of @code{nil} scrolls so that this many lines at thebottom of the window appear instead at the top. The default value is@code{2}.@end defopt@deffn Command recenter &optional count@cindex centering pointThis function scrolls the text in the selected window so that point isdisplayed at a specified vertical position within the window. It doesnot ``move point'' with respect to the text.If @var{count} is a nonnegative number, that puts the line containingpoint @var{count} lines down from the top of the window. If@var{count} is a negative number, then it counts upward from thebottom of the window, so that @minus{}1 stands for the last usableline in the window. If @var{count} is a non-@code{nil} list, then itstands for the line in the middle of the window.If @var{count} is @code{nil}, @code{recenter} puts the line containingpoint in the middle of the window, then clears and redisplays the entireselected frame.When @code{recenter} is called interactively, @var{count} is the rawprefix argument. Thus, typing @kbd{C-u} as the prefix sets the@var{count} to a non-@code{nil} list, while typing @kbd{C-u 4} sets@var{count} to 4, which positions the current line four lines from thetop.With an argument of zero, @code{recenter} positions the current line atthe top of the window. This action is so handy that some people make aseparate key binding to do this. For example,@example@group(defun line-to-top-of-window () "Scroll current line to top of window.Replaces three keystroke sequence C-u 0 C-l." (interactive) (recenter 0))(global-set-key [kp-multiply] 'line-to-top-of-window)@end group@end example@end deffn@node Vertical Scrolling@section Vertical Fractional Scrolling@cindex vertical fractional scrolling @dfn{Vertical fractional scrolling} means shifting the image in thewindow up or down by a specified multiple or fraction of a line.Each window has a @dfn{vertical scroll position},which is a number, never less than zero. It specifies how far to raisethe contents of the window. Raising the window contents generally makesall or part of some lines disappear off the top, and all or part of someother lines appear at the bottom. The usual value is zero. The vertical scroll position is measured in units of the normal lineheight, which is the height of the default font. Thus, if the value is.5, that means the window contents are scrolled up half the normal lineheight. If it is 3.3, that means the window contents are scrolled upsomewhat over three times the normal line height. What fraction of a line the vertical scrolling covers, or how manylines, depends on what the lines contain. A value of .5 could scroll aline whose height is very short off the screen, while a value of 3.3could scroll just part of the way through a tall line or an image.@defun window-vscroll &optional window pixels-pThis function returns the current vertical scroll position of@var{window}. If @var{window} is @code{nil}, the selected window isused. If @var{pixels-p} is non-@code{nil}, the return value ismeasured in pixels, rather than in units of the normal line height.@example@group(window-vscroll) @result{} 0@end group@end example@end defun@defun set-window-vscroll window lines &optional pixels-pThis function sets @var{window}'s vertical scroll position to@var{lines}. The argument @var{lines} should be zero or positive; ifnot, it is taken as zero.If @var{window} is @code{nil}, the selected window is used.The actual vertical scroll position must always correspondto an integral number of pixels, so the value you specifyis rounded accordingly.The return value is the result of this rounding.@example@group(set-window-vscroll (selected-window) 1.2) @result{} 1.13@end group@end exampleIf @var{pixels-p} is non-@code{nil}, @var{lines} specifies a number ofpixels. In this case, the return value is @var{lines}.@end defun@defvar auto-window-vscrollIf this variable is non-@code{nil}, the line-move, scroll-up, andscroll-down functions will automatically modify the window vscroll toscroll through display rows that are taller that the height of thewindow, for example in the presence of large images.@end defvar@node Horizontal Scrolling@section Horizontal Scrolling@cindex horizontal scrolling @dfn{Horizontal scrolling} means shifting the image in the window leftor right by a specified multiple of the normal character width. Eachwindow has a @dfn{horizontal scroll position}, which is a number, neverless than zero. It specifies how far to shift the contents left.Shifting the window contents left generally makes all or part of somecharacters disappear off the left, and all or part of some othercharacters appear at the right. The usual value is zero. The horizontal scroll position is measured in units of the normalcharacter width, which is the width of space in the default font. Thus,if the value is 5, that means the window contents are scrolled left by 5times the normal character width. How many characters actuallydisappear off to the left depends on their width, and could vary fromline to line. Because we read from side to side in the ``inner loop,'' and from topto bottom in the ``outer loop,'' the effect of horizontal scrolling isnot like that of textual or vertical scrolling. Textual scrollinginvolves selection of a portion of text to display, and verticalscrolling moves the window contents contiguously; but horizontalscrolling causes part of @emph{each line} to go off screen. Usually, no horizontal scrolling is in effect; then the leftmostcolumn is at the left edge of the window. In this state, scrolling tothe right is meaningless, since there is no data to the left of the edgeto be revealed by it; so this is not allowed. Scrolling to the left isallowed; it scrolls the first columns of text off the edge of the windowand can reveal additional columns on the right that were truncatedbefore. Once a window has a nonzero amount of leftward horizontalscrolling, you can scroll it back to the right, but only so far as toreduce the net horizontal scroll to zero. There is no limit to how farleft you can scroll, but eventually all the text will disappear off theleft edge.@vindex auto-hscroll-mode If @code{auto-hscroll-mode} is set, redisplay automatically altersthe horizontal scrolling of a window as necessary to ensure that pointis always visible. However, you can still set the horizontalscrolling value explicitly. The value you specify serves as a lowerbound for automatic scrolling, i.e. automatic scrolling will notscroll a window to a column less than the specified one.@deffn Command scroll-left &optional count set-minimumThis function scrolls the selected window @var{count} columns to theleft (or to the right if @var{count} is negative). The defaultfor @var{count} is the window width, minus 2.The return value is the total amount of leftward horizontal scrolling ineffect after the change---just like the value returned by@code{window-hscroll} (below).Once you scroll a window as far right as it can go, back to its normalposition where the total leftward scrolling is zero, attempts to scrollany farther right have no effect.If @var{set-minimum} is non-@code{nil}, the new scroll amount becomesthe lower bound for automatic scrolling; that is, automatic scrollingwill not scroll a window to a column less than the value returned bythis function. Interactive calls pass non-@code{nil} for@var{set-minimum}.@end deffn@deffn Command scroll-right &optional count set-minimumThis function scrolls the selected window @var{count} columns to theright (or to the left if @var{count} is negative). The defaultfor @var{count} is the window width, minus 2. Aside from the directionof scrolling, this works just like @code{scroll-left}.@end deffn@defun window-hscroll &optional windowThis function returns the total leftward horizontal scrolling of@var{window}---the number of columns by which the text in @var{window}is scrolled left past the left margin.The value is never negative. It is zero when no horizontal scrollinghas been done in @var{window} (which is usually the case).If @var{window} is @code{nil}, the selected window is used.@example@group(window-hscroll) @result{} 0@end group@group(scroll-left 5) @result{} 5@end group@group(window-hscroll) @result{} 5@end group@end example@end defun@defun set-window-hscroll window columnsThis function sets horizontal scrolling of @var{window}. The value of@var{columns} specifies the amount of scrolling, in terms of columnsfrom the left margin. The argument @var{columns} should be zero orpositive; if not, it is taken as zero. Fractional values of@var{columns} are not supported at present.Note that @code{set-window-hscroll} may appear not to work if you testit by evaluating a call with @kbd{M-:} in a simple way. What happensis that the function sets the horizontal scroll value and returns, butthen redisplay adjusts the horizontal scrolling to make point visible,and this overrides what the function did. You can observe thefunction's effect if you call it while point is sufficiently far fromthe left margin that it will remain visible.The value returned is @var{columns}.@example@group(set-window-hscroll (selected-window) 10) @result{} 10@end group@end example@end defun Here is how you can determine whether a given position @var{position}is off the screen due to horizontal scrolling:@example@group(defun hscroll-on-screen (window position) (save-excursion (goto-char position) (and (>= (- (current-column) (window-hscroll window)) 0) (< (- (current-column) (window-hscroll window)) (window-width window)))))@end group@end example@node Size of Window@section The Size of a Window@cindex window size@cindex size of window An Emacs window is rectangular, and its size information consists ofthe height (the number of lines) and the width (the number of characterpositions in each line). The mode line is included in the height. Butthe width does not count the scroll bar or the column of @samp{|}characters that separates side-by-side windows. The following three functions return size information about a window:@defun window-height &optional windowThis function returns the number of lines in @var{window}, includingits mode line and header line, if any. If @var{window} fills itsentire frame except for the echo area, this is typically one less thanthe value of @code{frame-height} on that frame.If @var{window} is @code{nil}, the function uses the selected window.@example@group(window-height) @result{} 23@end group@group(split-window-vertically) @result{} #<window 4 on windows.texi>@end group@group(window-height) @result{} 11@end group@end example@end defun@defun window-body-height &optional windowLike @code{window-height} but the value does not include themode line (if any) or the header line (if any).@end defun@defun window-width &optional windowThis function returns the number of columns in @var{window}. If@var{window} fills its entire frame, this is the same as the value of@code{frame-width} on that frame. The width does not include thewindow's scroll bar or the column of @samp{|} characters that separatesside-by-side windows.If @var{window} is @code{nil}, the function uses the selected window.@example@group(window-width) @result{} 80@end group@end example@end defun@defun window-full-width-p &optional windowThis function returns non-@code{nil} if @var{window} is as wide asthe frame that contains it; otherwise @code{nil}.If @var{window} is @code{nil}, the function uses the selected window.@end defun@defun window-edges &optional windowThis function returns a list of the edge coordinates of @var{window}.If @var{window} is @code{nil}, the selected window is used.The order of the list is @code{(@var{left} @var{top} @var{right}@var{bottom})}, all elements relative to 0, 0 at the top left corner ofthe frame. The element @var{right} of the value is one more than therightmost column used by @var{window}, and @var{bottom} is one more thanthe bottommost row used by @var{window} and its mode-line.The edges include the space used by the window's scroll bar, displaymargins, fringes, header line, and mode line, if it has them. Also,if the window has a neighbor on the right, its right edge valueincludes the width of the separator line between the window and thatneighbor. Since the width of the window does not include thisseparator, the width does not usually equal the difference between theright and left edges.@end defun@defun window-inside-edges &optional windowThis is similar to @code{window-edges}, but the edge valuesit returns include only the text area of the window. Theydo not include the header line, mode line, scroll bar orvertical separator, fringes, or display margins.@end defunHere are the results obtained on a typical 24-line terminal with justone window, with menu bar enabled:@example@group(window-edges (selected-window)) @result{} (0 1 80 23)@end group@group(window-inside-edges (selected-window)) @result{} (0 1 80 22)@end group@end example@noindentThe bottom edge is at line 23 because the last line is the echo area.The bottom inside edge is at line 22, which is the window's mode line.If @var{window} is at the upper left corner of its frame, and there isno menu bar, then @var{bottom} returned by @code{window-edges} is thesame as the value of @code{(window-height)}, @var{right} is almost thesame as the value of @code{(window-width)}, and @var{top} and@var{left} are zero. For example, the edges of the following windoware @w{@samp{0 0 8 5}}. Assuming that the frame has more than 8columns, the last column of the window (column 7) holds a borderrather than text. The last row (row 4) holds the mode line, shownhere with @samp{xxxxxxxxx}.@example@group 0 _______ 0 | | | | | | | | xxxxxxxxx 4 7@end group@end exampleIn the following example, let's suppose that the frame is 7columns wide. Then the edges of the left window are @w{@samp{0 0 4 3}}and the edges of the right window are @w{@samp{4 0 7 3}}.The inside edges of the left window are @w{@samp{0 0 3 2}},and the inside edges of the right window are @w{@samp{4 0 7 2}},@example@group ___ ___ | | | | | | xxxxxxxxx 0 34 7@end group@end example@defun window-pixel-edges &optional windowThis function is like @code{window-edges} except that, on a graphicaldisplay, the edge values are measured in pixels instead of incharacter lines and columns.@end defun@defun window-inside-pixel-edges &optional windowThis function is like @code{window-inside-edges} except that, on agraphical display, the edge values are measured in pixels instead ofin character lines and columns.@end defun@node Resizing Windows@section Changing the Size of a Window@cindex window resizing@cindex resize window@cindex changing window size@cindex window size, changing The window size functions fall into two classes: high-level commandsthat change the size of windows and low-level functions that accesswindow size. Emacs does not permit overlapping windows or gaps betweenwindows, so resizing one window affects other windows.@deffn Command enlarge-window size &optional horizontalThis function makes the selected window @var{size} lines taller,stealing lines from neighboring windows. It takes the lines from onewindow at a time until that window is used up, then takes from another.If a window from which lines are stolen shrinks below@code{window-min-height} lines, that window disappears.If @var{horizontal} is non-@code{nil}, this function makes@var{window} wider by @var{size} columns, stealing columns instead oflines. If a window from which columns are stolen shrinks below@code{window-min-width} columns, that window disappears.If the requested size would exceed that of the window's frame, then thefunction makes the window occupy the entire height (or width) of theframe.If there are various other windows from which lines or columns can bestolen, and some of them specify fixed size (using@code{window-size-fixed}, see below), they are left untouched whileother windows are ``robbed.'' If it would be necessary to alter thesize of a fixed-size window, @code{enlarge-window} gets an errorinstead.If @var{size} is negative, this function shrinks the window by@minus{}@var{size} lines or columns. If that makes the window smallerthan the minimum size (@code{window-min-height} and@code{window-min-width}), @code{enlarge-window} deletes the window.@code{enlarge-window} returns @code{nil}.@end deffn@deffn Command enlarge-window-horizontally columnsThis function makes the selected window @var{columns} wider.It could be defined as follows:@example@group(defun enlarge-window-horizontally (columns) (interactive "p") (enlarge-window columns t))@end group@end example@end deffn@deffn Command shrink-window size &optional horizontalThis function is like @code{enlarge-window} but negates the argument@var{size}, making the selected window smaller by giving lines (orcolumns) to the other windows. If the window shrinks below@code{window-min-height} or @code{window-min-width}, then it disappears.If @var{size} is negative, the window is enlarged by @minus{}@var{size}lines or columns.@end deffn@deffn Command shrink-window-horizontally columnsThis function makes the selected window @var{columns} narrower.It could be defined as follows:@example@group(defun shrink-window-horizontally (columns) (interactive "p") (shrink-window columns t))@end group@end example@end deffn@defun adjust-window-trailing-edge window delta horizontalThis function makes the selected window @var{delta} lines taller or@var{delta} columns wider, by moving the bottom or right edge. Thisfunction does not delete other windows; if it cannot make therequested size adjustment, it signals an error. On success, thisfunction returns @code{nil}.@end defun@defun fit-window-to-buffer &optional window max-height min-heightThis function makes @var{window} the right height to display itscontents exactly. If @var{window} is omitted or @code{nil}, it usesthe selected window.The argument @var{max-height} specifies the maximum height the windowis allowed to be; @code{nil} means use the frame height. The argument@var{min-height} specifies the minimum height for the window;@code{nil} means use @code{window-min-height}. All these heightvalues include the mode-line and/or header-line.@end defun@deffn Command shrink-window-if-larger-than-buffer &optional windowThis command shrinks @var{window} vertically to be as small aspossible while still showing the full contents of its buffer---but notless than @code{window-min-height} lines. If @var{window} is notgiven, it defaults to the selected window.However, the command does nothing if the window is already too small todisplay the whole text of the buffer, or if part of the contents arecurrently scrolled off screen, or if the window is not the full width ofits frame, or if the window is the only window in its frame.This command returns non-@code{nil} if it actually shrank the windowand @code{nil} otherwise.@end deffn@defvar window-size-fixedIf this variable is non-@code{nil}, in any given buffer,then the size of any window displaying the buffer remains fixedunless you explicitly change it or Emacs has no other choice.If the value is @code{height}, then only the window's height is fixed;if the value is @code{width}, then only the window's width is fixed.Any other non-@code{nil} value fixes both the width and the height.This variable automatically becomes buffer-local when set.Explicit size-change functions such as @code{enlarge-window}get an error if they would have to change a window size which is fixed.Therefore, when you want to change the size of such a window,you should bind @code{window-size-fixed} to @code{nil}, like this:@example(let ((window-size-fixed nil)) (enlarge-window 10))@end exampleNote that changing the frame size will change the size of afixed-size window, if there is no other alternative.@end defvar@cindex minimum window size The following two variables constrain the window-structure-changingfunctions to a minimum height and width.@defopt window-min-heightThe value of this variable determines how short a window may becomebefore it is automatically deleted. Making a window smaller than@code{window-min-height} automatically deletes it, and no window maybe created shorter than this. The default value is 4.The absolute minimum window height is one; actions that change windowsizes reset this variable to one if it is less than one.@end defopt@defopt window-min-widthThe value of this variable determines how narrow a window may becomebefore it is automatically deleted. Making a window smaller than@code{window-min-width} automatically deletes it, and no window may becreated narrower than this. The default value is 10.The absolute minimum window width is two; actions that change windowsizes reset this variable to two if it is less than two.@end defopt@node Coordinates and Windows@section Coordinates and WindowsThis section describes how to relate screen coordinates to windows.@defun window-at x y &optional frameThis function returns the window containing the specified cursorposition in the frame @var{frame}. The coordinates @var{x} and @var{y}are measured in characters and count from the top left corner of theframe. If they are out of range, @code{window-at} returns @code{nil}.If you omit @var{frame}, the selected frame is used.@end defun@defun coordinates-in-window-p coordinates windowThis function checks whether a particular frame position falls withinthe window @var{window}.The argument @var{coordinates} is a cons cell of the form @code{(@var{x}. @var{y})}. The coordinates @var{x} and @var{y} are measured incharacters, and count from the top left corner of the screen or frame.The value returned by @code{coordinates-in-window-p} is non-@code{nil}if the coordinates are inside @var{window}. The value also indicateswhat part of the window the position is in, as follows:@table @code@item (@var{relx} . @var{rely})The coordinates are inside @var{window}. The numbers @var{relx} and@var{rely} are the equivalent window-relative coordinates for thespecified position, counting from 0 at the top left corner of thewindow.@item mode-lineThe coordinates are in the mode line of @var{window}.@item header-lineThe coordinates are in the header line of @var{window}.@item vertical-lineThe coordinates are in the vertical line between @var{window} and itsneighbor to the right. This value occurs only if the window doesn'thave a scroll bar; positions in a scroll bar are considered outside thewindow for these purposes.@item left-fringe@itemx right-fringeThe coordinates are in the left or right fringe of the window.@item left-margin@itemx right-marginThe coordinates are in the left or right margin of the window.@item nilThe coordinates are not in any part of @var{window}.@end tableThe function @code{coordinates-in-window-p} does not require a frame asargument because it always uses the frame that @var{window} is on.@end defun@node Window Tree@section The Window Tree@cindex window tree A @dfn{window tree} specifies the layout, size, and relationshipbetween all windows in one frame.@defun window-tree &optional frameThis function returns the window tree for frame @var{frame}.If @var{frame} is omitted, the selected frame is used.The return value is a list of the form @code{(@var{root} @var{mini})},where @var{root} represents the window tree of the frame'sroot window, and @var{mini} is the frame's minibuffer window.If the root window is not split, @var{root} is the root window itself.Otherwise, @var{root} is a list @code{(@var{dir} @var{edges} @var{w1}@var{w2} ...)} where @var{dir} is @code{nil} for a horizontal split,and @code{t} for a vertical split, @var{edges} gives the combined size andposition of the subwindows in the split, and the rest of the elementsare the subwindows in the split. Each of the subwindows may again bea window or a list representing a window split, and so on. The@var{edges} element is a list @code{(@var{left}@var{ top}@var{ right}@var{ bottom})}similar to the value returned by @code{window-edges}.@end defun@node Window Configurations@section Window Configurations@cindex window configurations@cindex saving window information A @dfn{window configuration} records the entire layout of oneframe---all windows, their sizes, which buffers they contain, howthose buffers are scrolled, and their values of point and the mark;also their fringes, margins, and scroll bar settings. It alsoincludes the values of @code{window-min-height},@code{window-min-width} and @code{minibuffer-scroll-window}. As aspecial exception, the window configuration does not record the valueof point in the selected window for the current buffer. You can bring back an entire previous layout by restoring a windowconfiguration previously saved. If you want to record all framesinstead of just one, use a frame configuration instead of a windowconfiguration. @xref{Frame Configurations}.@defun current-window-configuration &optional frameThis function returns a new object representing @var{frame}'s currentwindow configuration. If @var{frame} is omitted, the selected frameis used.@end defun@defun set-window-configuration configurationThis function restores the configuration of windows and buffers asspecified by @var{configuration}, for the frame that @var{configuration}was created for.The argument @var{configuration} must be a value that was previouslyreturned by @code{current-window-configuration}. This configuration isrestored in the frame from which @var{configuration} was made, whetherthat frame is selected or not. This always counts as a window sizechange and triggers execution of the @code{window-size-change-functions}(@pxref{Window Hooks}), because @code{set-window-configuration} doesn'tknow how to tell whether the new configuration actually differs from theold one.If the frame which @var{configuration} was saved from is dead, all thisfunction does is restore the three variables @code{window-min-height},@code{window-min-width} and @code{minibuffer-scroll-window}. In thiscase, the function returns @code{nil}. Otherwise, it returns @code{t}.Here is a way of using this function to get the same effectas @code{save-window-excursion}:@example@group(let ((config (current-window-configuration))) (unwind-protect (progn (split-window-vertically nil) @dots{}) (set-window-configuration config)))@end group@end example@end defun@defspec save-window-excursion forms@dots{}This special form records the window configuration, executes @var{forms}in sequence, then restores the earlier window configuration. The windowconfiguration includes, for each window, the value of point and theportion of the buffer that is visible. It also includes the choice ofselected window. However, it does not include the value of point inthe current buffer; use @code{save-excursion} also, if you wish topreserve that.Don't use this construct when @code{save-selected-window} is sufficient.Exit from @code{save-window-excursion} always triggers execution of the@code{window-size-change-functions}. (It doesn't know how to tellwhether the restored configuration actually differs from the one ineffect at the end of the @var{forms}.)The return value is the value of the final form in @var{forms}.For example:@example@group(split-window) @result{} #<window 25 on control.texi>@end group@group(setq w (selected-window)) @result{} #<window 19 on control.texi>@end group@group(save-window-excursion (delete-other-windows w) (switch-to-buffer "foo") 'do-something) @result{} do-something ;; @r{The screen is now split again.}@end group@end example@end defspec@defun window-configuration-p objectThis function returns @code{t} if @var{object} is a window configuration.@end defun@defun compare-window-configurations config1 config2This function compares two window configurations as regards thestructure of windows, but ignores the values of point and mark and thesaved scrolling positions---it can return @code{t} even if thoseaspects differ.The function @code{equal} can also compare two window configurations; itregards configurations as unequal if they differ in any respect, even asaved point or mark.@end defun@defun window-configuration-frame configThis function returns the frame for which the window configuration@var{config} was made.@end defun Other primitives to look inside of window configurations would makesense, but are not implemented because we did not need them. See thefile @file{winner.el} for some more operations on windowsconfigurations.@node Window Hooks@section Hooks for Window Scrolling and Changes@cindex hooks for window operationsThis section describes how a Lisp program can take action whenever awindow displays a different part of its buffer or a different buffer.There are three actions that can change this: scrolling the window,switching buffers in the window, and changing the size of the window.The first two actions run @code{window-scroll-functions}; the last runs@code{window-size-change-functions}.@defvar window-scroll-functionsThis variable holds a list of functions that Emacs should call beforeredisplaying a window with scrolling. It is not a normal hook, becauseeach function is called with two arguments: the window, and its newdisplay-start position.Displaying a different buffer in the window also runs these functions.These functions must be careful in using @code{window-end}(@pxref{Window Start}); if you need an up-to-date value, you must usethe @var{update} argument to ensure you get it.@strong{Warning:} don't use this feature to alter the way the windowis scrolled. It's not designed for that, and such use probably won'twork.@end defvar@defvar window-size-change-functionsThis variable holds a list of functions to be called if the size of anywindow changes for any reason. The functions are called just once perredisplay, and just once for each frame on which size changes haveoccurred.Each function receives the frame as its sole argument. There is nodirect way to find out which windows on that frame have changed size, orprecisely how. However, if a size-change function records, at eachcall, the existing windows and their sizes, it can also compare thepresent sizes and the previous sizes.Creating or deleting windows counts as a size change, and thereforecauses these functions to be called. Changing the frame size alsocounts, because it changes the sizes of the existing windows.It is not a good idea to use @code{save-window-excursion} (@pxref{WindowConfigurations}) in these functions, because that always counts as asize change, and it would cause these functions to be called over andover. In most cases, @code{save-selected-window} (@pxref{SelectingWindows}) is what you need here.@end defvar@defvar redisplay-end-trigger-functionsThis abnormal hook is run whenever redisplay in a window uses text thatextends past a specified end trigger position. You set the end triggerposition with the function @code{set-window-redisplay-end-trigger}. Thefunctions are called with two arguments: the window, and the end triggerposition. Storing @code{nil} for the end trigger position turns off thefeature, and the trigger value is automatically reset to @code{nil} justafter the hook is run.@end defvar@defun set-window-redisplay-end-trigger window positionThis function sets @var{window}'s end trigger position at@var{position}.@end defun@defun window-redisplay-end-trigger &optional windowThis function returns @var{window}'s current end trigger position.If @var{window} is @code{nil} or omitted, it uses the selected window.@end defun@defvar window-configuration-change-hookA normal hook that is run every time you change the window configurationof an existing frame. This includes splitting or deleting windows,changing the sizes of windows, or displaying a different buffer in awindow. The frame whose window configuration has changed is theselected frame when this hook runs.@end defvar@ignore arch-tag: 3f6c36e8-df49-4986-b757-417feed88be3@end ignore