Add documentation for horizontal scroll bars and fix some minor issues.

* buffer.c (scroll_bar_width, scroll_bar_height): Fix
doc-strings.
* window.c (Fset_window_scroll_bars): Fix doc-string.
(Fwindow_scroll_bars): Have it return what the doc-string says.

* window.el (window-full-height-p): Make it behave correctly for
minibuffer window.
(window-current-scroll-bars): Fix code.
(fit-frame-to-buffer): Use window-scroll-bar-height instead of
window-scroll-bars.
* frame.el (frame-current-scroll-bars): Fix doc-string.
* scroll-bar.el (toggle-horizontal-scroll-bar): New command.

* frames.texi (Scroll Bars): Describe use of horizontal scroll
bars.

* display.texi (Scroll Bars): Add description of horizontal scroll
bars and associated functions.
* frames.texi (Layout Parameters): Add horizontal scroll bar
entries.  Remove paragraph on "combined fringe widths".
* windows.texi (Window Sizes): Describe affects of horizontal
scroll bars on window layout and sizes.  Fix description of
window-full-height-p.
(Resizing Windows): Mention horizontal scroll bar.
This commit is contained in:
Martin Rudalics 2014-10-04 10:20:24 +02:00
parent cebc89eea1
commit 3c6ba8b49b
15 changed files with 340 additions and 186 deletions

View file

@ -1,3 +1,8 @@
2014-10-04 Martin Rudalics <rudalics@gmx.at>
* frames.texi (Scroll Bars): Describe use of horizontal scroll
bars.
2014-10-04 Glenn Morris <rgm@gnu.org>
* cmdargs.texi (Misc X):

View file

@ -904,10 +904,11 @@ those are drawn by the toolkit and not directly by Emacs.
@section Scroll Bars
@cindex Scroll Bar mode
@cindex mode, Scroll Bar
@cindex Vertical Scroll Bar
On graphical displays, there is a @dfn{scroll bar} on the side of
each Emacs window. Clicking @kbd{Mouse-1} on the scroll bar's up and
down buttons scrolls the window by one line at a time. Clicking
On graphical displays, there is a @dfn{vertical scroll bar} on the
side of each Emacs window. Clicking @kbd{Mouse-1} on the scroll bar's
up and down buttons scrolls the window by one line at a time. Clicking
@kbd{Mouse-1} above or below the scroll bar's inner box scrolls the
window by nearly the entire height of the window, like @kbd{M-v} and
@kbd{C-v} respectively (@pxref{Moving Point}). Dragging the inner box
@ -921,23 +922,23 @@ in the scroll bar lets you drag the inner box up and down.
@findex scroll-bar-mode
@findex toggle-scroll-bar
To toggle the use of scroll bars, type @kbd{M-x scroll-bar-mode}.
This command applies to all frames, including frames yet to be
created. To toggle scroll bars for just the selected frame, use the
command @kbd{M-x toggle-scroll-bar}.
To toggle the use of vertical scroll bars, type @kbd{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 @kbd{M-x toggle-scroll-bar}.
@vindex scroll-bar-mode
To control the use of scroll bars at startup, customize the variable
@code{scroll-bar-mode}. Its value should be either @code{right} (put
scroll bars on the right side of windows), @code{left} (put them on
the left), or @code{nil} (disable 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).
To control the use of vertical scroll bars at startup, customize the
variable @code{scroll-bar-mode}. Its value should be either
@code{right} (put scroll bars on the right side of windows), @code{left}
(put them on the left), or @code{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).
@vindex scroll-bar-width
@cindex width of the scroll bar
@cindex width of the vertical scroll bar
You can also use the X resource @samp{verticalScrollBars} to enable
or disable the scroll bars (@pxref{Resources}). To control the scroll
bar width, change the @code{scroll-bar-width} frame parameter
@ -954,6 +955,39 @@ end of the buffer is shown; if @code{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.
@cindex Horizontal Scroll Bar
@cindex Horizontal Scroll Bar mode
On graphical displays with toolkit support, Emacs may also supply a
@dfn{horizontal scroll bar} on the bottom of each window. Clicking
@kbd{Mouse-1} on the that scroll bar's left and right buttons scrolls
the window horizontally by one column at a time. Clicking @kbd{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.
@findex horizontal-scroll-bar-mode
To toggle the use of horizontal scroll bars, type @kbd{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 @kbd{M-x
toggle-horizontal-scroll-bar}.
@vindex horizontal-scroll-bar-mode
To control the use of horizontal scroll bars at startup, customize the
variable @code{horizontal-scroll-bar-mode}.
@vindex scroll-bar-height
@cindex height of the horizontal scroll bar
You can also use the X resource @samp{horizontalScrollBars} to enable
or disable horizontal scroll bars (@pxref{Resources}). To control the
scroll bar height, change the @code{scroll-bar-height} frame parameter
(@pxref{Frame Parameters,,, elisp, The Emacs Lisp Reference Manual}).
@node Drag and Drop
@section Drag and Drop
@cindex drag and drop

View file

@ -1,3 +1,14 @@
2014-10-04 Martin Rudalics <rudalics@gmx.at>
* display.texi (Scroll Bars): Add description of horizontal scroll
bars and associated functions.
* frames.texi (Layout Parameters): Add horizontal scroll bar
entries. Remove paragraph on "combined fringe widths".
* windows.texi (Window Sizes): Describe affects of horizontal
scroll bars on window layout and sizes. Fix description of
window-full-height-p.
(Resizing Windows): Mention horizontal scroll bar.
2014-10-04 Glenn Morris <rgm@gnu.org>
* commands.texi (Generic Commands): Copyedits.

View file

@ -23,7 +23,7 @@ that Emacs presents to the user.
* Faces:: A face defines a graphics style for text characters:
font, colors, etc.
* Fringes:: Controlling window fringes.
* Scroll Bars:: Controlling vertical scroll bars.
* Scroll Bars:: Controlling scroll bars.
* Window Dividers:: Separating windows visually.
* Display Property:: Enabling special display features.
* Images:: Displaying images in Emacs buffers.
@ -3866,102 +3866,164 @@ arrow position. If either property is not set, the default
@code{overlay-arrow-string} or @code{overlay-arrow} fringe indicator
is used.
@node Scroll Bars
@section Scroll Bars
@cindex scroll bars
Normally the frame parameter @code{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
@code{scroll-bar-width} specifies how wide they are (@code{nil}
meaning the default). @xref{Layout Parameters}.
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} specifies how wide they are (@code{nil} meaning
the default).
The frame parameter @code{horizontal-scroll-bars} controls whether
the windows in the frame have horizontal scroll bars. The frame
parameter @code{scroll-bar-height} specifies how high they are
(@code{nil} meaning the default). @xref{Layout Parameters}.
@vindex horizontal-scroll-bars-available-p
Horizontal scroll bars are not available on all platforms. The
function @code{horizontal-scroll-bars-available-p} which takes no
argument returns non-@code{nil} if they are available on your system.
The following three functions take as argument a live frame which
defaults to the selected one.
@defun frame-current-scroll-bars &optional frame
This function reports the scroll bar type settings for frame
@var{frame}. The value is a cons cell
@code{(@var{vertical-type} .@: @var{horizontal-type})}, where
@var{vertical-type} is either @code{left}, @code{right}, or @code{nil}
(which means no scroll bar.) @var{horizontal-type} is meant to
specify the horizontal scroll bar type, but since they are not
implemented, it is always @code{nil}.
This function reports the scroll bar types for frame @var{frame}. The
value is a cons cell @code{(@var{vertical-type} .@:
@var{horizontal-type})}, where @var{vertical-type} is either
@code{left}, @code{right}, or @code{nil} (which means no vertical scroll
bar.) @var{horizontal-type} is either @code{bottom} or @code{nil}
(which means no horizontal scroll bar).
@end defun
@vindex vertical-scroll-bar
You can enable or disable scroll bars for a particular buffer,
by setting the variable @code{vertical-scroll-bar}. This variable
automatically becomes buffer-local when set. The possible values are
@code{left}, @code{right}, @code{t}, which means to use the
frame's default, and @code{nil} for no scroll bar.
You can also control this for individual windows. Call the function
@code{set-window-scroll-bars} to specify what to do for a specific window:
@defun set-window-scroll-bars window width &optional vertical-type horizontal-type
This function sets the width and type of scroll bars for window
@var{window}.
@var{width} specifies the scroll bar width in pixels (@code{nil} means
use the width specified for the frame). @var{vertical-type} specifies
whether to have a vertical scroll bar and, if so, where. The possible
values are @code{left}, @code{right} and @code{nil}, just like the
values of the @code{vertical-scroll-bars} frame parameter.
The argument @var{horizontal-type} is meant to specify whether and
where to have horizontal scroll bars, but since they are not
implemented, it has no effect. If @var{window} is @code{nil}, the
selected window is used.
@defun frame-scroll-bar-width &optional Lisp_Object &optional frame
This function returns the width of vertical scroll bars of @var{frame}
in pixels.
@end defun
@defun frame-scroll-bar-height &optional Lisp_Object &optional frame
This function returns the height of horizontal scroll bars of
@var{frame} in pixels.
@end defun
You can override the frame specific settings for individual windows by
using the following function:
@defun set-window-scroll-bars window &optional width vertical-type height horizontal-type
This function sets the width and/or height and the types of scroll bars
for window @var{window}.
@var{width} specifies the width of the vertical scroll bar in pixels
(@code{nil} means use the width specified for the frame).
@var{vertical-type} specifies whether to have a vertical scroll bar and,
if so, where. The possible values are @code{left}, @code{right},
@code{t}, which means to use the frame's default, and @code{nil} for no
vertical scroll bar.
@var{height} specifies the height of the horizontal scroll bar in pixels
(@code{nil} means use the height specified for the frame).
@var{horizontal-type} specifies whether to have a horizontal scroll bar.
The possible values are @code{bottom}, @code{t}, which means to use the
frame's default, and @code{nil} for no horizontal scroll bar.
If @var{window} is @code{nil}, the selected window is used.
@end defun
The following four functions take as argument a live window which
defaults to the selected one.
@defun window-scroll-bars &optional window
Report the width and type of scroll bars specified for @var{window}.
If @var{window} is omitted or @code{nil}, the selected window is used.
The value is a list of the form @code{(@var{width}
@var{cols} @var{vertical-type} @var{horizontal-type})}. The value
@var{width} is the value that was specified for the width (which may
be @code{nil}); @var{cols} is the number of columns that the scroll
bar actually occupies.
This function returns a list of the form @code{(@var{width}
@var{columns} @var{vertical-type} @var{height} @var{lines}
@var{horizontal-type})}.
@var{horizontal-type} is not actually meaningful.
The value @var{width} is the value that was specified for the width of
the vertical scroll bar (which may be @code{nil}); @var{columns} is the
(possibly rounded) number of columns that the vertical scroll bar
actually occupies.
The value @var{height} is the value that was specified for the height of
the horizontal scroll bar (which may be @code{nil}); @var{lines} is the
(possibly rounded) number of lines that the horizontally scroll bar
actually occupies.
@end defun
@defun window-current-scroll-bars &optional window
This function reports the scroll bar type for window @var{window}. The
value is a cons cell @code{(@var{vertical-type} .@:
@var{horizontal-type})}. Unlike @code{window-scroll-bars}, this reports
the scroll bar type actually used, once frame defaults and
@code{scroll-bar-mode} are taken into account.
@end defun
@defun window-scroll-bar-width &optional window
This function returns the width in pixels of @var{window}'s vertical
scrollbar. @var{window} must be a live window, and defaults to the
selected window.
scrollbar.
@end defun
@defun window-scroll-bar-height &optional window
This function returns the height in pixels of @var{window}'s horizontal
scrollbar.
@end defun
If you don't specify these values for a window with
@code{set-window-scroll-bars}, the buffer-local variables
@code{scroll-bar-mode} and @code{scroll-bar-width} in the buffer being
displayed control the window's vertical scroll bars. The function
@code{vertical-scroll-bar}, @code{horizontal-scroll-bar},
@code{scroll-bar-width} and @code{scroll-bar-height} in the buffer being
displayed control the window's scroll bars. The function
@code{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 @code{set-window-buffer}
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}
specifying the same buffer that is already displayed.
@defopt scroll-bar-mode
This variable, always local in all buffers, controls whether and where
to put scroll bars in windows displaying the buffer. The possible values
are @code{nil} for no scroll bar, @code{left} to put a scroll bar on
the left, and @code{right} to put a scroll bar on the right.
@end defopt
You can control the appearance of scroll bars for a particular buffer by
setting the following variables which automatically become buffer-local
when set.
@defun window-current-scroll-bars &optional window
This function reports the scroll bar type for window @var{window}.
If @var{window} is omitted or @code{nil}, the selected window is used.
The value is a cons cell
@code{(@var{vertical-type} .@: @var{horizontal-type})}. Unlike
@code{window-scroll-bars}, this reports the scroll bar type actually
used, once frame defaults and @code{scroll-bar-mode} are taken into
account.
@end defun
@defvar vertical-scroll-bar
This variable specifies the location of the vertical scroll bar. The
possible values are @code{left}, @code{right}, @code{t}, which means to
use the frame's default, and @code{nil} for no scroll bar.
@end defvar
@defvar horizontal-scroll-bar
This variable specifies the location of the horizontal scroll bar. The
possible values are @code{bottom}, @code{t}, which means to use the
frame's default, and @code{nil} for no scroll bar.
@end defvar
@defvar scroll-bar-width
This variable, always local in all buffers, specifies the width of the
buffer's scroll bars, measured in pixels. A value of @code{nil} means
to use the value specified by the frame.
This variable specifies the width of the buffer's vertical scroll bars,
measured in pixels. A value of @code{nil} means to use the value
specified by the frame.
@end defvar
@defvar scroll-bar-height
This variable specifies the height of the buffer's horizontal scroll
bar, measured in pixels. A value of @code{nil} means to use the value
specified by the frame.
@end defvar
Finally you can toggle the display of scroll bars on all frames by
customizing the variables @code{scroll-bar-mode} and
@code{horizontal-scroll-bar-mode}.
@defopt scroll-bar-mode
This variable controls whether and where to put vertical scroll bars in
all frames. The possible values are @code{nil} for no scroll bars,
@code{left} to put scroll bars on the left and @code{right} to put
scroll bars on the right.
@end defopt
@defopt horizontal-scroll-bar-mode
This variable controls whether to display horizontal scroll bars on all
frames.
@end defopt
@node Window Dividers
@section Window Dividers
@cindex window dividers

View file

@ -1343,7 +1343,7 @@ Emacs Display
* Faces:: A face defines a graphics style
for text characters: font, colors, etc.
* Fringes:: Controlling window fringes.
* Scroll Bars:: Controlling vertical scroll bars.
* Scroll Bars:: Controlling scroll bars.
* Window Dividers:: Separating windows visually.
* Display Property:: Enabling special display features.
* Images:: Displaying images in Emacs buffers.

View file

@ -709,19 +709,21 @@ Whether the frame has scroll bars for vertical scrolling, and which side
of the frame they should be on. The possible values are @code{left},
@code{right}, and @code{nil} for no scroll bars.
@ignore
@vindex horizontal-scroll-bars, a frame parameter
@item horizontal-scroll-bars
Whether the frame has scroll bars for horizontal scrolling
(non-@code{nil} means yes). Horizontal scroll bars are not currently
implemented.
@end ignore
Whether the frame has scroll bars for horizontal scrolling (@code{t} and
@code{bottom} mean yes, @code{nil} means no).
@vindex scroll-bar-width, a frame parameter
@item scroll-bar-width
The width of vertical scroll bars, in pixels, or @code{nil} meaning to
use the default width.
@vindex scroll-bar-height, a frame parameter
@item scroll-bar-height
The height of horizontal scroll bars, in pixels, or @code{nil} meaning
to use the default height.
@vindex left-fringe, a frame parameter
@vindex right-fringe, a frame parameter
@item left-fringe
@ -735,14 +737,6 @@ these two frame parameters, the return value is always an integer.
When using @code{set-frame-parameter}, passing a @code{nil} value
imposes an actual default value of 8 pixels.
The combined fringe widths must add up to an integral number of
columns, so the actual default fringe widths for the frame, as
reported by @code{frame-parameter}, may be larger than what you
specify. Any extra width is distributed evenly between the left and
right fringe. However, you can force one fringe or the other to a
precise width by specifying that width as a negative integer. If both
widths are negative, only the left fringe gets the specified width.
@vindex right-divider-width, a frame parameter
@item right-divider-width
The width (thickness) reserved for the right divider (@pxref{Window

View file

@ -394,13 +394,14 @@ internal window). The @var{edges} element is a list @code{(@var{left}
@group
____________________________________________
|______________ Header Line ______________|RD| ^
^ |LS|LF|LM| |RM|RF|RS| | |
^ |LS|LM|LF| |RF|RM|RS| | |
| | | | | | | | | | |
Window | | | | Text Area | | | | | Window
Body | | | | | (Window Body) | | | | | Total
Height | | | | | | | | | Height
| | | | |<- Window Body Width ->| | | | | |
v |__|__|__|_______________________|__|__|__| | |
|_________ Horizontal Scroll Bar _________| | |
|_______________ Mode Line _______________|__| |
|_____________ Bottom Divider _______________| v
<---------- Window Total Width ------------>
@ -414,15 +415,15 @@ Height | | | | | | | | | Height
At the center of the window is the @dfn{text area}, or @dfn{body},
where the buffer text is displayed. The text area can be surrounded by
a series of optional areas. On the left and right, from innermost to
outermost, these are the left and right margins, denoted by LM and RM in
the schematic (@pxref{Display Margins}); the left and right fringes,
denoted by LF and RF (@pxref{Fringes}); the left or right scroll bar,
only one of which is present at any time, denoted by LS and RS
(@pxref{Scroll Bars}); and the right divider, denoted by RD
outermost, these are the left and right fringes, denoted by LF and RF
(@pxref{Fringes}); the left and right margins, denoted by LM and RM in
the schematic (@pxref{Display Margins}); the left or right vertical
scroll bar, only one of which is present at any time, denoted by LS and
RS (@pxref{Scroll Bars}); and the right divider, denoted by RD
(@pxref{Window Dividers}). At the top of the window is the header line
(@pxref{Header Lines}); at the bottom of the window is the mode line
(@pxref{Mode Line Format}) followed by the bottom divider (@pxref{Window
Dividers}).
(@pxref{Header Lines}). At the bottom of the window are the horizontal
scroll bar (@pxref{Scroll Bars}); the mode line (@pxref{Mode Line
Format}); and the bottom divider (@pxref{Window Dividers}).
Emacs provides miscellaneous functions for finding the height and
width of a window. The return value of many of these functions can be
@ -439,11 +440,8 @@ displayed within it.
@cindex height of a window
@cindex total height of a window
The @dfn{total height} of a window is the number of lines comprising
the window's body, the header line, the mode line and the bottom divider
(if any). Note that the height of a frame is not the same as the height
of its root window (@pxref{Windows and Frames}), since a frame may also
contain an echo area, a menu bar, and a tool bar (@pxref{Size and
Position}).
the window's body, the header line, the horizontal scroll bar, the mode
line and the bottom divider (if any).
@defun window-total-height &optional window round
This function returns the total height, in lines, of the window
@ -457,8 +455,8 @@ rounded internally. This is done in a way such that, if the window is a
parent window, the sum of the total heights of all its child windows
internally equals the total height of their parent. This means that
although two windows have the same pixel height, their internal total
heights may differ by one line. This means also, that if this window is
vertically combined and has a right sibling, the topmost row of that
heights may differ by one line. This means also, that if window is
vertically combined and has a next sibling, the topmost row of that
sibling can be calculated as the sum of this window's topmost row and
total height (@pxref{Coordinates and Windows})
@ -490,11 +488,10 @@ window, the sum of the total widths of all its children internally
equals the total width of their parent. This means that although two
windows have the same pixel width, their internal total widths may
differ by one column. This means also, that if this window is
horizontally combined and has a right sibling, the leftmost column of
horizontally combined and has a next sibling, the leftmost column of
that sibling can be calculated as the sum of this window's leftmost
column and total width (@pxref{Coordinates and Windows}). The
optional argument @var{round} behaves as it does for
@code{window-total-height}.
column and total width (@pxref{Coordinates and Windows}). The optional
argument @var{round} behaves as it does for @code{window-total-height}.
@end defun
@defun window-total-size &optional window horizontal round
@ -517,9 +514,10 @@ window in units of pixels.
This function returns the total height of window @var{window} in pixels.
@var{window} must be a valid window and defaults to the selected one.
The return value includes mode and header line and a bottom divider, if
any. If @var{window} is an internal window, its pixel height is the
pixel height of the screen areas spanned by its children.
The return value includes mode and header line, a horizontal scroll bar
and a bottom divider, if any. If @var{window} is an internal window,
its pixel height is the pixel height of the screen areas spanned by its
children.
@end defun
@cindex window pixel height
@ -542,10 +540,12 @@ the screen areas spanned by its children.
window has any adjacent windows.
@defun window-full-height-p &optional window
This function returns non-@code{nil} if @var{window} has no other
window above or below it in its frame, i.e., its total height equals
the total height of the root window on that frame. If @var{window} is
omitted or @code{nil}, it defaults to the selected window.
This function returns non-@code{nil} if @var{window} has no other window
above or below it in its frame. More precisely, this means that the
total height of @var{window} equals the total height of the root window
on that frame. The minibuffer window does not count in this regard. If
@var{window} is omitted or @code{nil}, it defaults to the selected
window.
@end defun
@defun window-full-width-p &optional window
@ -559,7 +559,8 @@ that of the root window on that frame. If @var{window} is omitted or
@cindex body height of a window
@cindex window body width
The @dfn{body height} of a window is the height of its text area, which
does not include a mode or header line or a bottom divider.
does not include a mode or header line, a horizontal scroll bar, or a
bottom divider.
@defun window-body-height &optional window pixelwise
This function returns the height, in lines, of the body of window
@ -646,7 +647,8 @@ size:
@defopt window-min-height
This option specifies the minimum total height, in lines, of any window.
Its value has to accommodate at least one text line as well as a mode
and header line and a bottom divider, if present.
and header line, a horizontal scroll bar and a bottom divider, if
present.
@end defopt
@defopt window-min-width
@ -685,10 +687,11 @@ of @var{window}'s lines.
The return value makes sure that all components of @var{window} remain
fully visible if @var{window}'s size were actually set to it. With
@var{horizontal} @code{nil} it includes the mode and header line and the
bottom divider. With @var{horizontal} non-@code{nil} it includes the
fringes, a scroll bar, and a right divider, if present. It does not,
however, include the space reserved for the margins.
@var{horizontal} @code{nil} it includes the mode and header line, the
horizontal scroll bar and the bottom divider. With @var{horizontal}
non-@code{nil} it includes the fringes, a scroll bar, and a right
divider, if present. It does not, however, include the space reserved
for the margins.
The optional argument @var{ignore}, if non-@code{nil}, means ignore
restrictions imposed by fixed size windows, @code{window-min-height} or
@ -740,11 +743,11 @@ Normally, the variables @code{window-min-height} and
(@pxref{Window Sizes}). However, if the optional argument @var{ignore}
is non-@code{nil}, this function ignores @code{window-min-height} and
@code{window-min-width}, as well as @code{window-size-fixed}. Instead,
it considers the minimum-height window to be one consisting of a header,
a mode line and a bottom divider (if any), plus a text area one line
tall; and a minimum-width window as one consisting of fringes, margins,
a scroll bar and a right divider (if any), plus a text area two columns
wide.
it considers the minimum-height window to be one consisting of a header
and a mode line, a horizontal scrollbar and a bottom divider (if any),
plus a text area one line tall; and a minimum-width window as one
consisting of fringes, margins, a scroll bar and a right divider (if
any), plus a text area two columns wide.
If the optional argument @var{pixelwise} is non-@code{nil},
@var{delta} is interpreted as pixels.

View file

@ -292,20 +292,28 @@ optional repeat-count argument.
* Changes in Frames and Windows Code in Emacs 25.1
+++
** Emacs can now draw horizontal scroll bars on some platforms that
provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows.
provide toolkit scroll bars, namely Gtk+, Lucid, Motif and Windows.
Horizontal scroll bars are turned off by default.
*** New function `horizontal-scroll-bars-available-p' telling whether
horizontal scroll bars are available on the underlying system.
*** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll
bars on all existing and future frames.
*** New function `toggle-horizontal-scroll-bar' to toggle horizontal
scroll bars on the selected frame.
*** New frame parameters `horizontal-scroll-bars' and
`scroll-bar-height' to set horizontal scroll bars and their height
for individual frames and in `default-frame-alist'.
*** New function `frame-scroll-bar-height' to return the height of
horizontal scroll bars on a specific frame.
*** New functions `frame-scroll-bar-height' and
`window-scroll-bar-height' return the height of horizontal scroll
bars on a specific frame or window.
*** `set-window-scroll-bars' now accepts five parameters where the last
two specify height and type of the window's horizontal scroll bar.
*** `window-scroll-bars' now returns type and sizes of horizontal scroll
bars too.
*** New buffer-local variables `horizontal-scroll-bar' and
`scroll-bar-height'.
** The height of a frame's menu and tool bar are no more counted in the
frame's text height. This means that the text height stands only for

View file

@ -1,3 +1,13 @@
2014-10-04 Martin Rudalics <rudalics@gmx.at>
* window.el (window-full-height-p): Make it behave correctly for
minibuffer window.
(window-current-scroll-bars): Fix code.
(fit-frame-to-buffer): Use window-scroll-bar-height instead of
window-scroll-bars.
* frame.el (frame-current-scroll-bars): Fix doc-string.
* scroll-bar.el (toggle-horizontal-scroll-bar): New command.
2014-10-04 Mark Oteiza <mvoteiza@udel.edu> (tiny change)
* files.el (auto-mode-alist): Use sh-mode for .zsh files. (Bug#18488)

View file

@ -1263,16 +1263,18 @@ On graphical displays, it is displayed on the frame's title bar."
(list (cons 'name name))))
(defun frame-current-scroll-bars (&optional frame)
"Return the current scroll-bar settings in frame FRAME.
Value is a cons (VERTICAL . HORIZ0NTAL) where VERTICAL specifies the
current location of the vertical scroll-bars (left, right, or nil),
and HORIZONTAL specifies the current location of the horizontal scroll
bars (top, bottom, or nil)."
(let ((vert (frame-parameter frame 'vertical-scroll-bars))
(hor nil))
(unless (memq vert '(left right nil))
(setq vert default-frame-scroll-bars))
(cons vert hor)))
"Return the current scroll-bar types for frame FRAME.
Value is a cons (VERTICAL . HORIZ0NTAL) where VERTICAL specifies
the current location of the vertical scroll-bars (`left', `right'
or nil), and HORIZONTAL specifies the current location of the
horizontal scroll bars (`bottom' or nil). FRAME must specify a
live frame and defaults to the selected one."
(let* ((frame (window-normalize-frame frame))
(vertical (frame-parameter frame 'vertical-scroll-bars))
(horizontal (frame-parameter frame 'horizontal-scroll-bars)))
(unless (memq vertical '(left right nil))
(setq vertical default-frame-scroll-bars))
(cons vertical (and horizontal 'bottom))))
(defun frame-monitor-attributes (&optional frame)
"Return the attributes of the physical monitor dominating FRAME.

View file

@ -79,7 +79,7 @@ SIDE must be the symbol `left' or `right'."
(htype lines)
((frame-parameter nil 'horizontal-scroll-bars)
;; nil means it's a non-toolkit scroll bar (which is currently
;; impossible), and its width in columns is 14 pixels rounded up.
;; impossible), and its height in lines is 14 pixels rounded up.
(ceiling (or (frame-parameter nil 'scroll-bar-height) 14)
(frame-char-width)))
(0))))
@ -178,7 +178,7 @@ created in the future."
(defun toggle-scroll-bar (arg)
"Toggle whether or not the selected frame has vertical scroll bars.
With arg, turn vertical scroll bars on if and only if arg is positive.
With ARG, turn vertical scroll bars on if and only if ARG is positive.
The variable `scroll-bar-mode' controls which side the scroll bars are on
when they are turned on; if it is nil, they go on the left."
(interactive "P")
@ -193,6 +193,21 @@ when they are turned on; if it is nil, they go on the left."
(list (cons 'vertical-scroll-bars
(if (> arg 0)
(or scroll-bar-mode default-frame-scroll-bars))))))
(defun toggle-horizontal-scroll-bar (arg)
"Toggle whether or not the selected frame has horizontal scroll bars.
With ARG, turn vertical scroll bars on if and only if ARG is positive."
(interactive "P")
(if (null arg)
(setq arg
(if (cdr (assq 'horizontal-scroll-bars
(frame-parameters (selected-frame))))
-1 1))
(setq arg (prefix-numeric-value arg)))
(modify-frame-parameters
(selected-frame)
(list (cons 'horizontal-scroll-bars
(when (> arg 0) 'bottom)))))
;;;; Buffer navigation using the scroll bar.

View file

@ -1745,9 +1745,6 @@ doc-string of `window-resizable'."
(defalias 'window-height 'window-total-height)
(defalias 'window-width 'window-body-width)
;; Eventually the following two should work pixelwise.
;; See discussion in bug#4543.
(defun window-full-height-p (&optional window)
"Return t if WINDOW is as high as its containing frame.
More precisely, return t if and only if the total height of
@ -1755,8 +1752,10 @@ WINDOW equals the total height of the root window of WINDOW's
frame. WINDOW must be a valid window and defaults to the
selected one."
(setq window (window-normalize-window window))
(= (window-pixel-height window)
(window-pixel-height (frame-root-window window))))
(if (window-minibuffer-p window)
(eq window (frame-root-window (window-frame window)))
(= (window-pixel-height window)
(window-pixel-height (frame-root-window window)))))
(defun window-full-width-p (&optional window)
"Return t if WINDOW is as wide as its containing frame.
@ -1780,28 +1779,26 @@ optional argument PIXELWISE is passed to the functions."
(window-body-height window pixelwise)))
(defun window-current-scroll-bars (&optional window)
"Return the current scroll bar settings for WINDOW.
"Return the current scroll bar types for WINDOW.
WINDOW must be a live window and defaults to the selected one.
The return value is a cons cell (VERTICAL . HORIZONTAL) where
VERTICAL specifies the current location of the vertical scroll
bars (`left', `right', or nil), and HORIZONTAL specifies the
current location of the horizontal scroll bars (`top', `bottom',
or nil).
bar (`left', `right' or nil), and HORIZONTAL specifies the
current location of the horizontal scroll bar (`bottom' or nil).
Unlike `window-scroll-bars', this function reports the scroll bar
type actually used, once frame defaults and `scroll-bar-mode' are
taken into account."
(setq window (window-normalize-window window t))
(let ((vert (nth 2 (window-scroll-bars window)))
(hor nil))
(when (or (eq vert t) (eq hor t))
(let ((fcsb (frame-current-scroll-bars (window-frame window))))
(if (eq vert t)
(setq vert (car fcsb)))
(if (eq hor t)
(setq hor (cdr fcsb)))))
(cons vert hor)))
(let ((vertical (nth 2 (window-scroll-bars window)))
(horizontal (nth 5 (window-scroll-bars window)))
(inherited (frame-current-scroll-bars (window-frame window))))
(when (eq vertical t)
(setq vertical (car inherited)))
(when (eq horizontal t)
(setq horizontal (cdr inherited)))
(cons vertical (and horizontal 'bottom))))
(defun walk-windows (fun &optional minibuf all-frames)
"Cycle through all live windows, calling FUN for each one.
@ -7176,7 +7173,7 @@ FRAME."
(height
(+ (cdr value)
(window-bottom-divider-width)
(nth 3 (window-scroll-bars)))))
(window-scroll-bar-height))))
;; Don't change height or width when the window's size is fixed
;; in either direction or ONLY forbids it.
(cond
@ -7335,7 +7332,7 @@ accessible position."
;; height. Its width remains fixed.
(setq height (+ (cdr (window-text-pixel-size
nil nil t nil (frame-pixel-height) t))
(nth 3 (window-scroll-bars window))
(window-scroll-bar-height window)
(window-bottom-divider-width)))
;; Round height.
(unless pixelwise

View file

@ -1,3 +1,10 @@
2014-10-04 Martin Rudalics <rudalics@gmx.at>
* buffer.c (scroll_bar_width, scroll_bar_height): Fix
doc-strings.
* window.c (Fset_window_scroll_bars): Fix doc-string.
(Fwindow_scroll_bars): Have it return what the doc-string says.
2014-10-03 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (move_it_by_lines): Call reseat_1 after moving the

View file

@ -5925,12 +5925,12 @@ in a window. To make the change take effect, call `set-window-buffer'. */);
DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
Qintegerp,
doc: /* Width of this buffer's scroll bars in pixels.
doc: /* Width of this buffer's vertical scroll bars in pixels.
A value of nil means to use the scroll bar width from the window's frame. */);
DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height),
Qintegerp,
doc: /* Height of this buffer's scroll bars in pixels.
doc: /* Height of this buffer's horizontal scroll bars in pixels.
A value of nil means to use the scroll bar height from the window's frame. */);
DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),

View file

@ -7002,16 +7002,17 @@ DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars,
doc: /* Set width and type of scroll bars of window WINDOW.
WINDOW must be a live window and defaults to the selected one.
Second parameter WIDTH specifies the pixel width for the scroll bar.
Second parameter WIDTH specifies the pixel width for the vertical scroll
bar. If WIDTH is nil, use the scroll-bar width of WINDOW's frame.
Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
bar: left, right, or nil. If WIDTH is nil, use the frame's scroll-bar
width. If VERTICAL-TYPE is t, use the frame's scroll-bar type.
bar: left, right, or nil. If VERTICAL-TYPE is t, this means use the
frame's scroll-bar type.
Fourth parameter HEIGHT specifies the pixel height for the scroll bar.
Fifth parameter HORIZONTAL-TYPE specifies the type of the vertical
scroll bar: nil, bottom, or t. If HEIGHT is nil, use the frame's
scroll-bar height. If HORIZONTAL-TYPE is t, use the frame's scroll-bar
type.
Fourth parameter HEIGHT specifies the pixel height for the horizontal
scroll bar. If HEIGHT is nil, use the scroll-bar height of WINDOW's
frame. Fifth parameter HORIZONTAL-TYPE specifies the type of the
horizontal scroll bar: nil, bottom, or t. If HORIZONTAL-TYPE is t, this
means to use the frame's horizontal scroll-bar type.
Return t if scroll bars were actually changed and nil otherwise. */)
(Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type,
@ -7029,17 +7030,22 @@ DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
doc: /* Get width and type of scroll bars of window WINDOW.
WINDOW must be a live window and defaults to the selected one.
Value is a list of the form (WIDTH COLS VERTICAL-TYPE HEIGHT LINES
HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or TYPE is t, the window is
using the frame's corresponding value. */)
Value is a list of the form (WIDTH COLUMNS VERTICAL-TYPE HEIGHT LINES
HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or VERTICAL-TYPE or
HORIZONTAL-TYPE is t, the window is using the frame's corresponding
value. */)
(Lisp_Object window)
{
struct window *w = decode_live_window (window);
return Fcons (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)),
return Fcons (((w->scroll_bar_width >= 0)
? make_number (w->scroll_bar_width)
: Qnil),
list5 (make_number (WINDOW_SCROLL_BAR_COLS (w)),
w->vertical_scroll_bar_type,
make_number (WINDOW_SCROLL_BAR_AREA_HEIGHT (w)),
((w->scroll_bar_height >= 0)
? make_number (w->scroll_bar_height)
: Qnil),
make_number (WINDOW_SCROLL_BAR_LINES (w)),
w->horizontal_scroll_bar_type));
}