Next: Window Dividers, Previous: Fringes, Up: Display
Normally the frame parameter vertical-scroll-bars
controls
whether the windows in the frame have vertical scroll bars, and whether
they are on the left or right. The frame parameter
scroll-bar-width
specifies how wide they are (nil
meaning
the default).
The frame parameter horizontal-scroll-bars
controls whether
the windows in the frame have horizontal scroll bars. The frame
parameter scroll-bar-height
specifies how high they are
(nil
meaning the default). See Layout Parameters.
Horizontal scroll bars are not available on all platforms. The
function horizontal-scroll-bars-available-p
which takes no
argument returns non-nil
if they are available on your system.
The following three functions take as argument a live frame which defaults to the selected one.
This function reports the scroll bar types for frame frame. The value is a cons cell
(
vertical-type.
horizontal-type)
, where vertical-type is eitherleft
,right
, ornil
(which means no vertical scroll bar.) horizontal-type is eitherbottom
ornil
(which means no horizontal scroll bar).
This function returns the width of vertical scroll bars of frame in pixels.
This function returns the height of horizontal scroll bars of frame in pixels.
You can override the frame specific settings for individual windows by using the following function:
This function sets the width and/or height and the types of scroll bars for window window. If window is
nil
, the selected window is used.width specifies the width of the vertical scroll bar in pixels (
nil
means use the width specified for the frame). vertical-type specifies whether to have a vertical scroll bar and, if so, where. The possible values areleft
,right
,t
, which means to use the frame's default, andnil
for no vertical scroll bar.height specifies the height of the horizontal scroll bar in pixels (
nil
means use the height specified for the frame). horizontal-type specifies whether to have a horizontal scroll bar. The possible values arebottom
,t
, which means to use the frame's default, andnil
for no horizontal scroll bar.If window is not large enough to accommodate a scroll bar of the desired dimension, this leaves the corresponding scroll bar unchanged.
The values specified here may be later overridden by invoking
set-window-buffer
(see Buffers and Windows) on window with its keep-margins argumentnil
or omitted.
The following four functions take as argument a live window which defaults to the selected one.
This function returns a list of the form
(
width columns vertical-type height lines horizontal-type)
.The value width is the value that was specified for the width of the vertical scroll bar (which may be
nil
); columns is the (possibly rounded) number of columns that the vertical scroll bar actually occupies.The value height is the value that was specified for the height of the horizontal scroll bar (which may be
nil
); lines is the (possibly rounded) number of lines that the horizontally scroll bar actually occupies.
This function reports the scroll bar type for window window. The value is a cons cell
(
vertical-type.
horizontal-type)
. Unlikewindow-scroll-bars
, this reports the scroll bar type actually used, once frame defaults andscroll-bar-mode
are taken into account.
This function returns the width in pixels of window's vertical scrollbar.
This function returns the height in pixels of window's horizontal scrollbar.
If you don't specify these values for a window with
set-window-scroll-bars
, the buffer-local variables
vertical-scroll-bar
, horizontal-scroll-bar
,
scroll-bar-width
and scroll-bar-height
in the buffer being
displayed control the window's scroll bars. The function
set-window-buffer
examines these variables. If you change them
in a buffer that is already visible in a window, you can make the window
take note of the new values by calling set-window-buffer
specifying the same buffer that is already displayed.
You can control the appearance of scroll bars for a particular buffer by setting the following variables which automatically become buffer-local when set.
This variable specifies the location of the vertical scroll bar. The possible values are
left
,right
,t
, which means to use the frame's default, andnil
for no scroll bar.
This variable specifies the location of the horizontal scroll bar. The possible values are
bottom
,t
, which means to use the frame's default, andnil
for no scroll bar.
This variable specifies the width of the buffer's vertical scroll bars, measured in pixels. A value of
nil
means to use the value specified by the frame.
This variable specifies the height of the buffer's horizontal scroll bar, measured in pixels. A value of
nil
means to use the value specified by the frame.
Finally you can toggle the display of scroll bars on all frames by
customizing the variables scroll-bar-mode
and
horizontal-scroll-bar-mode
.