ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

25.12 Scroll Bars

On graphical displays, Emacs normally makes a scroll bar at the left of each Emacs window, running the height of the window.1

When Emacs is compiled with GTK+ support on the X window system, or in operating systems such as Microsoft Windows or Mac OS, you can use the scroll bar as you do in other graphical applications. If you click Mouse-1 on the scroll bar's up and down buttons, that 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 with Mouse-1 scrolls the window continuously.

If Emacs is compiled without GTK+ support on the X window system, the scroll bar behaves differently. The scroll bar's inner box is drawn to represent the portion of the buffer currently displayed, with the entire height of the scroll bar representing the entire length of the buffer. Mouse-1 anywhere on the scroll bar scrolls forward like C-v, and Mouse-3 scrolls backward like M-v. Clicking Mouse-2 in the scroll bar lets you move or drag the inner box up and down.

You can also click C-Mouse-2 in the scroll bar to split a window vertically. The split occurs on the line where you click.

You can toggle the use of the scroll bar with the command M-x scroll-bar-mode. With a prefix argument, this command turns use of scroll bars on if and only if the argument is positive. This command applies to all frames, including frames yet to be created. Customize the variable scroll-bar-mode to control the use of scroll bars at startup. You can use it to specify that they are placed at the right of windows if you prefer that. You have to set this variable through the ‘Customize’ interface (see Easy Customization), or it will not work properly. You can also use the X resource ‘verticalScrollBars’ to control the initial setting of Scroll Bar mode. See Resources.

To enable or disable scroll bars for just the selected frame, use the command M-x toggle-scroll-bar.

You can control the scroll bar width by changing the value of the scroll-bar-width frame parameter.

Footnotes

[1] Placing it at the left is usually more useful with overlapping frames with text starting at the left margin.

blog comments powered by Disqus