elisp: Vertical Scrolling
27.22 Vertical Fractional Scrolling
===================================
“Vertical fractional scrolling” means shifting text in a window up or
down by a specified multiple or fraction of a line. Each window has a
“vertical scroll position”, which is a number, never less than zero. It
specifies how far to raise the contents of the window. Raising the
window contents generally makes all or part of some lines disappear off
the top, and all or part of some other lines appear at the bottom. The
usual value is zero.
The vertical scroll position is measured in units of the normal line
height, 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 line
height. If it is 3.3, that means the window contents are scrolled up
somewhat over three times the normal line height.
What fraction of a line the vertical scrolling covers, or how many
lines, depends on what the lines contain. A value of .5 could scroll a
line whose height is very short off the screen, while a value of 3.3
could scroll just part of the way through a tall line or an image.
-- Function: window-vscroll &optional window pixels-p
This function returns the current vertical scroll position of
WINDOW. The default for WINDOW is the selected window. If
PIXELS-P is non-‘nil’, the return value is measured in pixels,
rather than in units of the normal line height.
(window-vscroll)
⇒ 0
-- Function: set-window-vscroll window lines &optional pixels-p
This function sets WINDOW’s vertical scroll position to LINES. If
WINDOW is ‘nil’, the selected window is used. The argument LINES
should be zero or positive; if not, it is taken as zero.
The actual vertical scroll position must always correspond to an
integral number of pixels, so the value you specify is rounded
accordingly.
The return value is the result of this rounding.
(set-window-vscroll (selected-window) 1.2)
⇒ 1.13
If PIXELS-P is non-‘nil’, LINES specifies a number of pixels. In
this case, the return value is LINES.
-- Variable: auto-window-vscroll
If this variable is non-‘nil’, the ‘line-move’, ‘scroll-up’, and
‘scroll-down’ functions will automatically modify the vertical
scroll position to scroll through display rows that are taller than
the height of the window, for example in the presence of large
images.