Next: , Previous: Frame Parameters, Up: Frames

21.12 Scroll Bars

On graphical displays, there is a vertical scroll bar on the side of each Emacs window. Clicking mouse-1 on the scroll bar's up and down buttons scrolls the window by one line at a time. Clicking mouse-1 above or below the scroll bar's inner box scrolls the window by nearly the entire height of the window, like M-v and C-v respectively (see Moving Point). Dragging the inner box scrolls continuously.

If Emacs is compiled on the X Window System without X toolkit support, the scroll bar behaves differently. Clicking mouse-1 anywhere on the scroll bar scrolls forward like C-v, while mouse-3 scrolls backward like M-v. Clicking mouse-2 in the scroll bar lets you drag the inner box up and down.

To toggle the use of vertical scroll bars, type M-x scroll-bar-mode. This command applies to all frames, including frames yet to be created. To toggle vertical scroll bars for just the selected frame, use the command M-x toggle-scroll-bar.

To control the use of vertical scroll bars at startup, customize the variable scroll-bar-mode. Its value should be either right (put scroll bars on the right side of windows), left (put them on the left), or nil (disable vertical scroll bars). By default, Emacs puts scroll bars on the right if it was compiled with GTK+ support on the X Window System, and on MS-Windows or Mac OS; Emacs puts scroll bars on the left if compiled on the X Window System without GTK+ support (following the old convention for X applications).

You can also use the X resource ‘verticalScrollBars’ to enable or disable the scroll bars (see Resources). To control the scroll bar width, change the scroll-bar-width frame parameter (see Frame Parameters).

If you're using Emacs on X (with GTK+ or Motif), you can customize the variable scroll-bar-adjust-thumb-portion to control overscrolling of the scroll bar, i.e., dragging the thumb down even when the end of the buffer is visible. If its value is non-nil, the scroll bar can be dragged downwards even if the end of the buffer is shown; if nil, the thumb will be at the bottom when the end of the buffer is shown. You can not over-scroll when the entire buffer is visible.

The visual appearance of the scroll bars is controlled by the scroll-bar face.

On graphical displays with toolkit support, Emacs may also supply a horizontal scroll bar on the bottom of each window. Clicking mouse-1 on the that scroll bar's left and right buttons scrolls the window horizontally by one column at a time. Clicking mouse-1 on the left or right of the scroll bar's inner box scrolls the window by four columns. Dragging the inner box scrolls the window continuously.

Note that such horizontal scrolling can make the window's position of point disappear on the left or the right. Typing a character to insert text or moving point with a keyboard command will usually bring it back into view.

To toggle the use of horizontal scroll bars, type M-x horizontal-scroll-bar-mode. This command applies to all frames, including frames yet to be created. To toggle horizontal scroll bars for just the selected frame, use the command M-x toggle-horizontal-scroll-bar.

To control the use of horizontal scroll bars at startup, customize the variable horizontal-scroll-bar-mode.

You can also use the X resource ‘horizontalScrollBars’ to enable or disable horizontal scroll bars (see Resources). To control the scroll bar height, change the scroll-bar-height frame parameter (see Frame Parameters).