[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section `Font Lock Support Modes' in The GNU Emacs Manual.
Displaying a different buffer in the window also runs these functions.
These functions must be careful in using window-end
(see section 28.10 The Window Start Position); if you need an up-to-date value, you must use
the update argument to ensure you get it.
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
(see section 28.17 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
(see section 28.4 Selecting Windows) is what you need here.
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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |