diff options
Diffstat (limited to 'devdocs/elisp/scroll-bars.html')
| -rw-r--r-- | devdocs/elisp/scroll-bars.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/devdocs/elisp/scroll-bars.html b/devdocs/elisp/scroll-bars.html new file mode 100644 index 00000000..edae6ed4 --- /dev/null +++ b/devdocs/elisp/scroll-bars.html @@ -0,0 +1,49 @@ + <h3 class="section">Scroll Bars</h3> <p>Normally the frame parameter <code>vertical-scroll-bars</code> controls whether the windows in the frame have vertical scroll bars, and whether they are on the left or right. The frame parameter <code>scroll-bar-width</code> specifies how wide they are (<code>nil</code> meaning the default). </p> <p>The frame parameter <code>horizontal-scroll-bars</code> controls whether the windows in the frame have horizontal scroll bars. The frame parameter <code>scroll-bar-height</code> specifies how high they are (<code>nil</code> meaning the default). See <a href="layout-parameters">Layout Parameters</a>. </p> <p>Horizontal scroll bars are not available on all platforms. The function <code>horizontal-scroll-bars-available-p</code> which takes no argument returns non-<code>nil</code> if they are available on your system. </p> <p>The following three functions take as argument a live frame which defaults to the selected one. </p> <dl> <dt id="frame-current-scroll-bars">Function: <strong>frame-current-scroll-bars</strong> <em>&optional frame</em> +</dt> <dd><p>This function reports the scroll bar types for frame <var>frame</var>. The value is a cons cell <code>(<var>vertical-type</var> . +<var>horizontal-type</var>)</code>, where <var>vertical-type</var> is either <code>left</code>, <code>right</code>, or <code>nil</code> (which means no vertical scroll bar.) <var>horizontal-type</var> is either <code>bottom</code> or <code>nil</code> (which means no horizontal scroll bar). </p></dd> +</dl> <dl> <dt id="frame-scroll-bar-width">Function: <strong>frame-scroll-bar-width</strong> <em>&optional frame</em> +</dt> <dd><p>This function returns the width of vertical scroll bars of <var>frame</var> in pixels. </p></dd> +</dl> <dl> <dt id="frame-scroll-bar-height">Function: <strong>frame-scroll-bar-height</strong> <em>&optional frame</em> +</dt> <dd><p>This function returns the height of horizontal scroll bars of <var>frame</var> in pixels. </p></dd> +</dl> <p>You can override the frame specific settings for individual windows by using the following function: </p> <dl> <dt id="set-window-scroll-bars">Function: <strong>set-window-scroll-bars</strong> <em>window &optional width vertical-type height horizontal-type persistent</em> +</dt> <dd> +<p>This function sets the width and/or height and the types of scroll bars for window <var>window</var>. If <var>window</var> is <code>nil</code>, the selected window is used. </p> <p><var>width</var> specifies the width of the vertical scroll bar in pixels (<code>nil</code> means use the width specified for the frame). <var>vertical-type</var> specifies whether to have a vertical scroll bar and, if so, where. The possible values are <code>left</code>, <code>right</code>, <code>t</code>, which means to use the frame’s default, and <code>nil</code> for no vertical scroll bar. </p> <p><var>height</var> specifies the height of the horizontal scroll bar in pixels (<code>nil</code> means use the height specified for the frame). <var>horizontal-type</var> specifies whether to have a horizontal scroll bar. The possible values are <code>bottom</code>, <code>t</code>, which means to use the frame’s default, and <code>nil</code> for no horizontal scroll bar. Note that for a mini window the value <code>t</code> has the same meaning as <code>nil</code>, namely to not show a horizontal scroll bar. You have to explicitly specify <code>bottom</code> in order to show a horizontal scroll bar in a mini window. </p> <p>If <var>window</var> is not large enough to accommodate a scroll bar of the desired dimension, this leaves the corresponding scroll bar unchanged. </p> <p>The values specified here may be later overridden by invoking <code>set-window-buffer</code> (see <a href="buffers-and-windows">Buffers and Windows</a>) on <var>window</var> with its <var>keep-margins</var> argument <code>nil</code> or omitted. However, if the optional fifth argument <var>persistent</var> is non-<code>nil</code> and the other arguments are processed successfully, the values specified here unconditionally survive subsequent invocations of <code>set-window-buffer</code>. </p> +</dd> +</dl> <p>Using the <var>persistent</var> argument of <code>set-window-scroll-bars</code> and <code>set-window-fringes</code> (see <a href="fringe-size_002fpos">Fringe Size/Pos</a>) you can reliably and permanently turn off scroll bars and/or fringes in any minibuffer window by adding the following snippet to your early init file (see <a href="init-file">Init File</a>). </p> <div class="example"> <pre class="example">(add-hook 'after-make-frame-functions + (lambda (frame) + (set-window-scroll-bars + (minibuffer-window frame) 0 nil 0 nil t) + (set-window-fringes + (minibuffer-window frame) 0 0 nil t))) +</pre> +</div> <p>The following four functions take as argument a live window which defaults to the selected one. </p> <dl> <dt id="window-scroll-bars">Function: <strong>window-scroll-bars</strong> <em>&optional window</em> +</dt> <dd> +<p>This function returns a list of the form <code>(<var>width</var> +<var>columns</var> <var>vertical-type</var> <var>height</var> <var>lines</var> +<var>horizontal-type</var> <var>persistent</var>)</code>. </p> <p>The value <var>width</var> is the value that was specified for the width of the vertical scroll bar (which may be <code>nil</code>); <var>columns</var> is the (possibly rounded) number of columns that the vertical scroll bar actually occupies. </p> <p>The value <var>height</var> is the value that was specified for the height of the horizontal scroll bar (which may be <code>nil</code>); <var>lines</var> is the (possibly rounded) number of lines that the horizontally scroll bar actually occupies. </p> <p>The value of <var>persistent</var> is the value specified for <var>window</var> with the last successful invocation of <code>set-window-scroll-bars</code>, <code>nil</code> if there never was one. </p> +</dd> +</dl> <dl> <dt id="window-current-scroll-bars">Function: <strong>window-current-scroll-bars</strong> <em>&optional window</em> +</dt> <dd><p>This function reports the scroll bar type for window <var>window</var>. The value is a cons cell <code>(<var>vertical-type</var> . +<var>horizontal-type</var>)</code>. Unlike <code>window-scroll-bars</code>, this reports the scroll bar type actually used, once frame defaults and <code>scroll-bar-mode</code> are taken into account. </p></dd> +</dl> <dl> <dt id="window-scroll-bar-width">Function: <strong>window-scroll-bar-width</strong> <em>&optional window</em> +</dt> <dd><p>This function returns the width in pixels of <var>window</var>’s vertical scrollbar. </p></dd> +</dl> <dl> <dt id="window-scroll-bar-height">Function: <strong>window-scroll-bar-height</strong> <em>&optional window</em> +</dt> <dd><p>This function returns the height in pixels of <var>window</var>’s horizontal scrollbar. </p></dd> +</dl> <p>If you do not specify a window’s scroll bar settings via <code>set-window-scroll-bars</code>, the buffer-local variables <code>vertical-scroll-bar</code>, <code>horizontal-scroll-bar</code>, <code>scroll-bar-width</code> and <code>scroll-bar-height</code> in the buffer being displayed control the window’s scroll bars. The function <code>set-window-buffer</code> 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 <code>set-window-buffer</code> specifying the same buffer that is already displayed. </p> <p>You can control the appearance of scroll bars for a particular buffer by setting the following variables which automatically become buffer-local when set. </p> <dl> <dt id="vertical-scroll-bar">Variable: <strong>vertical-scroll-bar</strong> +</dt> <dd><p>This variable specifies the location of the vertical scroll bar. The possible values are <code>left</code>, <code>right</code>, <code>t</code>, which means to use the frame’s default, and <code>nil</code> for no scroll bar. </p></dd> +</dl> <dl> <dt id="horizontal-scroll-bar">Variable: <strong>horizontal-scroll-bar</strong> +</dt> <dd><p>This variable specifies the location of the horizontal scroll bar. The possible values are <code>bottom</code>, <code>t</code>, which means to use the frame’s default, and <code>nil</code> for no scroll bar. </p></dd> +</dl> <dl> <dt id="scroll-bar-width">Variable: <strong>scroll-bar-width</strong> +</dt> <dd><p>This variable specifies the width of the buffer’s vertical scroll bars, measured in pixels. A value of <code>nil</code> means to use the value specified by the frame. </p></dd> +</dl> <dl> <dt id="scroll-bar-height">Variable: <strong>scroll-bar-height</strong> +</dt> <dd><p>This variable specifies the height of the buffer’s horizontal scroll bar, measured in pixels. A value of <code>nil</code> means to use the value specified by the frame. </p></dd> +</dl> <p>Finally you can toggle the display of scroll bars on all frames by customizing the variables <code>scroll-bar-mode</code> and <code>horizontal-scroll-bar-mode</code>. </p> <dl> <dt id="scroll-bar-mode">User Option: <strong>scroll-bar-mode</strong> +</dt> <dd><p>This variable controls whether and where to put vertical scroll bars in all frames. The possible values are <code>nil</code> for no scroll bars, <code>left</code> to put scroll bars on the left and <code>right</code> to put scroll bars on the right. </p></dd> +</dl> <dl> <dt id="horizontal-scroll-bar-mode">User Option: <strong>horizontal-scroll-bar-mode</strong> +</dt> <dd><p>This variable controls whether to display horizontal scroll bars on all frames. </p></dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Scroll-Bars.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Scroll-Bars.html</a> + </p> +</div> |
