aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMartin Rudalics2014-12-19 11:27:43 +0100
committerMartin Rudalics2014-12-19 11:27:43 +0100
commit276bd75ca56d29b6ddbd2aca3659c83118b3f548 (patch)
treeda67f549691fa46128ed4477c90cec056552534b /doc
parentad013ba63134d4fe6470665abf2f9e33a595848a (diff)
downloademacs-276bd75ca56d29b6ddbd2aca3659c83118b3f548.tar.gz
emacs-276bd75ca56d29b6ddbd2aca3659c83118b3f548.zip
Describe window size preserving options.
* windows.texi (Resizing Windows): Describe new argument of `fit-window-to-buffer'. Move description of `window-size-fixed' to new section below. (Preserving Window Sizes): New section describing `window-size-fixed' and `window-preserve-size'. (Display Action Functions): Describe `preserve-size' alist entry. (Window Parameters): Describe `preserved-size' parameter.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog11
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/windows.texi132
3 files changed, 127 insertions, 17 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 7424ab07cdf..5b3750697c8 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,14 @@
12014-12-19 Martin Rudalics <rudalics@gmx.at>
2
3 * windows.texi (Resizing Windows): Describe new argument of
4 `fit-window-to-buffer'. Move description of `window-size-fixed'
5 to new section below.
6 (Preserving Window Sizes): New section describing
7 `window-size-fixed' and `window-preserve-size'.
8 (Display Action Functions): Describe `preserve-size' alist
9 entry.
10 (Window Parameters): Describe `preserved-size' parameter.
11
12014-12-18 Eli Zaretskii <eliz@gnu.org> 122014-12-18 Eli Zaretskii <eliz@gnu.org>
2 13
3 * display.texi (Low-Level Font): Document font-info and query-font. 14 * display.texi (Low-Level Font): Document font-info and query-font.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index fa665da34a4..f6e7729e646 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1006,6 +1006,7 @@ Windows
1006* Windows and Frames:: Relating windows to the frame they appear on. 1006* Windows and Frames:: Relating windows to the frame they appear on.
1007* Window Sizes:: Accessing a window's size. 1007* Window Sizes:: Accessing a window's size.
1008* Resizing Windows:: Changing the sizes of windows. 1008* Resizing Windows:: Changing the sizes of windows.
1009* Preserving Window Sizes:: Preserving the size of windows.
1009* Splitting Windows:: Splitting one window into two windows. 1010* Splitting Windows:: Splitting one window into two windows.
1010* Deleting Windows:: Deleting a window gives its space to other windows. 1011* Deleting Windows:: Deleting a window gives its space to other windows.
1011* Recombining Windows:: Preserving the frame layout when splitting and 1012* Recombining Windows:: Preserving the frame layout when splitting and
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 5060fef804f..c54eb900da1 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -16,6 +16,7 @@ is displayed in windows.
16* Windows and Frames:: Relating windows to the frame they appear on. 16* Windows and Frames:: Relating windows to the frame they appear on.
17* Window Sizes:: Accessing a window's size. 17* Window Sizes:: Accessing a window's size.
18* Resizing Windows:: Changing the sizes of windows. 18* Resizing Windows:: Changing the sizes of windows.
19* Preserving Window Sizes:: Preserving the size of windows.
19* Splitting Windows:: Creating a new window. 20* Splitting Windows:: Creating a new window.
20* Deleting Windows:: Removing a window from its frame. 21* Deleting Windows:: Removing a window from its frame.
21* Recombining Windows:: Preserving the frame layout when splitting and 22* Recombining Windows:: Preserving the frame layout when splitting and
@@ -657,22 +658,6 @@ window. Its value has to accommodate two text columns as well as
657margins, fringes, a scroll bar and a right divider, if present. 658margins, fringes, a scroll bar and a right divider, if present.
658@end defopt 659@end defopt
659 660
660@defvar window-size-fixed
661If this buffer-local variable is non-@code{nil}, the size of any
662window displaying the buffer cannot normally be changed. Deleting a
663window or changing the frame's size may still change its size, if
664there is no choice.
665
666If the value is @code{height}, then only the window's height is fixed;
667if the value is @code{width}, then only the window's width is fixed.
668Any other non-@code{nil} value fixes both the width and the height.
669
670If this variable is @code{nil}, this does not necessarily mean that any
671window showing the buffer can be resized in the desired direction. To
672determine that, use the function @code{window-resizable}.
673@xref{Resizing Windows}.
674@end defvar
675
676The following function tells how small a specific window can get taking 661The following function tells how small a specific window can get taking
677into account the sizes of its areas and the values of 662into account the sizes of its areas and the values of
678@code{window-min-height}, @code{window-min-width} and 663@code{window-min-height}, @code{window-min-width} and
@@ -817,7 +802,7 @@ option is @code{nil}. The default value is @code{nil}.
817 The following commands resize windows in more specific ways. When 802 The following commands resize windows in more specific ways. When
818called interactively, they act on the selected window. 803called interactively, they act on the selected window.
819 804
820@deffn Command fit-window-to-buffer &optional window max-height min-height max-width min-width 805@deffn Command fit-window-to-buffer &optional window max-height min-height max-width min-width preserve-size
821This command adjusts the height or width of @var{window} to fit the text 806This command adjusts the height or width of @var{window} to fit the text
822in it. It returns non-@code{nil} if it was able to resize @var{window}, 807in it. It returns non-@code{nil} if it was able to resize @var{window},
823and @code{nil} otherwise. If @var{window} is omitted or @code{nil}, it 808and @code{nil} otherwise. If @var{window} is omitted or @code{nil}, it
@@ -845,6 +830,10 @@ defaults to the width of @var{window}'s frame. The optional argument
845specified in columns and include fringes, margins and scrollbars, if 830specified in columns and include fringes, margins and scrollbars, if
846any. 831any.
847 832
833The optional argument @var{preserve-size}, if non-@code{nil}, will
834install a parameter to preserve the size of @var{window} during future
835resize operations (@pxref{Preserving Window Sizes}).
836
848If the option @code{fit-frame-to-buffer} (see below) is non-@code{nil}, 837If the option @code{fit-frame-to-buffer} (see below) is non-@code{nil},
849this function will try to resize the frame of @var{window} to fit its 838this function will try to resize the frame of @var{window} to fit its
850contents by calling @code{fit-frame-to-buffer} (@pxref{Size and 839contents by calling @code{fit-frame-to-buffer} (@pxref{Size and
@@ -1078,6 +1067,99 @@ point was previously on. Note that this only affects
1078function. 1067function.
1079@end defopt 1068@end defopt
1080 1069
1070
1071@node Preserving Window Sizes
1072@section Preserving Window Sizes
1073@cindex preserving window sizes
1074
1075A window can get resized explicitly by using one of the functions from
1076the preceding section or implicitly, for example, when resizing an
1077adjacent window, when splitting or deleting a window (@pxref{Splitting
1078Windows}, @pxref{Deleting Windows}) or when resizing the window's frame
1079(@pxref{Size and Position}).
1080
1081 It is possible to avoid implicit resizing of a specific window when
1082there are one or more other resizable windows on the same frame. For
1083this purpose, Emacs must be advised to @dfn{preserve} the size of that
1084window. There are two basic ways to do that.
1085
1086@defvar window-size-fixed
1087If this buffer-local variable is non-@code{nil}, the size of any window
1088displaying the buffer cannot normally be changed. Deleting a window or
1089changing the frame's size may still change the window's size, if there
1090is no choice.
1091
1092If the value is @code{height}, then only the window's height is fixed;
1093if the value is @code{width}, then only the window's width is fixed.
1094Any other non-@code{nil} value fixes both the width and the height.
1095
1096If this variable is @code{nil}, this does not necessarily mean that any
1097window showing the buffer can be resized in the desired direction. To
1098determine that, use the function @code{window-resizable}.
1099@xref{Resizing Windows}.
1100@end defvar
1101
1102Often @code{window-size-fixed} is overly aggressive because it inhibits
1103any attempt to explicitly resize or split an affected window as well.
1104This may even happen after the window has been resized implicitly, for
1105example, when deleting an adjacent window or resizing the window's
1106frame. The following function tries hard to never disallow resizing
1107such a window explicitly:
1108
1109@defun window-preserve-size &optional window horizontal preserve
1110This function (un-)marks the height of window @var{window} as preserved
1111for future resize operations. @var{window} must be a live window and
1112defaults to the selected one. If the optional argument @var{horizontal}
1113is non-@code{nil}, it (un-)marks the width of @var{window} as preserved.
1114
1115If the optional argument @var{preserve} is @code{t}, this means to
1116preserve the current height/width of @var{window}'s body. The
1117height/width of @var{window} will change only if Emacs has no better
1118choice. Resizing a window whose height/width is preserved by this
1119function never throws an error.
1120
1121If @var{preserve} is @code{nil}, this means to stop preserving the
1122height/width of @var{window}, lifting any respective restraint induced
1123by a previous call of this function for @var{window}. Calling
1124@code{enlarge-window}, @code{shrink-window} or
1125@code{fit-window-to-buffer} with @var{window} as argument may also
1126remove the respective restraint.
1127@end defun
1128
1129@code{window-preserve-size} is currently invoked by the following
1130functions:
1131
1132@table @code
1133@item fit-window-to-buffer
1134If the optional argument @var{preserve-size} of that function
1135(@pxref{Resizing Windows}) is non-@code{nil}, the size established by
1136that function is preserved.
1137
1138@item display-buffer
1139If the @var{alist} argument of that function (@pxref{Choosing Window})
1140contains a @code{preserve-size} entry, the size of the window produced
1141by that function is preserved.
1142@end table
1143
1144 @code{window-preserve-size} installs a window parameter (@pxref{Window
1145Parameters}) called @code{preserved-size} which is consulted by the
1146window resizing functions. This parameter will not prevent resizing the
1147window when the window shows another buffer than the one when
1148@code{window-preserve-size} was invoked or if its size has changed since
1149then.
1150
1151The following function can be used to check whether the height of a
1152particular window is preserved:
1153
1154@defun window-preserved-size &optional window horizontal
1155This function returns the preserved height of window @var{window} in
1156pixels. @var{window} must be a live window and defaults to the selected
1157one. If the optional argument @var{horizontal} is non-@code{nil}, it
1158returns the preserved width of @var{window}. It returns @code{nil} if
1159the size of @var{window} is not preserved.
1160@end defun
1161
1162
1081@node Deleting Windows 1163@node Deleting Windows
1082@section Deleting Windows 1164@section Deleting Windows
1083@cindex deleting windows 1165@cindex deleting windows
@@ -2233,6 +2315,13 @@ argument: the new window. The function is supposed to adjust the width
2233of the window; its return value is ignored. 2315of the window; its return value is ignored.
2234@end itemize 2316@end itemize
2235 2317
2318If @var{alist} contains a @code{preserve-size} entry, Emacs will try to
2319preserve the size of the new window during future resize operations
2320(@pxref{Preserving Window Sizes}). The @sc{cdr} of that entry must be a
2321cons cell whose @sc{car}, if non-@code{nil}, means to preserve the width
2322of the window and whose @sc{cdr}, if non-@code{nil}, means to preserve
2323the height of the window.
2324
2236This function can fail if no window splitting can be performed for some 2325This function can fail if no window splitting can be performed for some
2237reason (e.g., if the selected frame has an @code{unsplittable} frame 2326reason (e.g., if the selected frame has an @code{unsplittable} frame
2238parameter; @pxref{Buffer Parameters}). 2327parameter; @pxref{Buffer Parameters}).
@@ -3900,6 +3989,15 @@ This parameter specifies the window that this one has been cloned
3900from. It is installed by @code{window-state-get} (@pxref{Window 3989from. It is installed by @code{window-state-get} (@pxref{Window
3901Configurations}). 3990Configurations}).
3902 3991
3992@item @code{preserved-size}
3993This parameter specifies a buffer, a direction where @code{nil} means
3994vertical and @code{t} horizontal, and a size in pixels. If this window
3995displays the specified buffer and its size in the indicated direction
3996equals the size specified by this parameter, then Emacs will try to
3997preserve the size of this window in the indicated direction. This
3998parameter is installed and updated by the function
3999@code{window-preserve-size} (@pxref{Preserving Window Sizes}).
4000
3903@item @code{quit-restore} 4001@item @code{quit-restore}
3904This parameter is installed by the buffer display functions 4002This parameter is installed by the buffer display functions
3905(@pxref{Choosing Window}) and consulted by @code{quit-restore-window} 4003(@pxref{Choosing Window}) and consulted by @code{quit-restore-window}