GNU Info

Info Node: (elisp)Window Hooks

(elisp)Window Hooks


Prev: Window Configurations Up: Windows
Enter node , (file) or (file)node

Hooks for Window Scrolling and Changes
======================================

   This section describes how a Lisp program can take action whenever a
window 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 `window-scroll-functions'; the last runs
`window-size-change-functions'.  The paradigmatic use of these hooks is
in the implementation of Lazy Lock mode; see *Note Lazy Lock:
(emacs)Support Modes.

 - Variable: window-scroll-functions
     This variable holds a list of functions that Emacs should call
     before redisplaying a window with scrolling.  It is not a normal
     hook, because each function is called with two arguments: the
     window, and its new display-start position.

     Displaying a different buffer in the window also runs these
     functions.

     These functions must be careful in using `window-end' (Note:
     Window Start); if you need an up-to-date value, you must use the
     UPDATE argument to ensure you get it.

 - Variable: window-size-change-functions
     This variable holds a list of functions to be called if the size
     of any window changes for any reason.  The functions are called
     just once per redisplay, and just once for each frame on which
     size changes have occurred.

     Each function receives the frame as its sole argument.  There is no
     direct way to find out which windows on that frame have changed
     size, or precisely how.  However, if a size-change function
     records, at each call, the existing windows and their sizes, it
     can also compare the present sizes and the previous sizes.

     Creating or deleting windows counts as a size change, and therefore
     causes these functions to be called.  Changing the frame size also
     counts, because it changes the sizes of the existing windows.

     It is not a good idea to use `save-window-excursion' (Note: Window
     Configurations) in these functions, because that always counts
     as a size change, and it would cause these functions to be called
     over and over.  In most cases, `save-selected-window' (Note:
     Selecting Windows) is what you need here.

 - Variable: redisplay-end-trigger-functions
     This abnormal hook is run whenever redisplay in a window uses text
     that extends past a specified end trigger position.  You set the
     end trigger position with the function
     `set-window-redisplay-end-trigger'.  The functions are called with
     two arguments: the window, and the end trigger position.  Storing
     `nil' for the end trigger position turns off the feature, and the
     trigger value is automatically reset to `nil' just after the hook
     is run.

 - Function: set-window-redisplay-end-trigger window position
     This function sets WINDOW's end trigger position at POSITION.

 - Function: window-redisplay-end-trigger &optional window
     This function returns WINDOW's current end trigger position.

 - Variable: window-configuration-change-hook
     A normal hook that is run every time you change the window
     configuration of an existing frame.  This includes splitting or
     deleting windows, changing the sizes of windows, or displaying a
     different buffer in a window.  The frame whose window
     configuration has changed is the selected frame when this hook
     runs.


automatically generated by info2www version 1.2.2.9