diff options
| author | Martin Rudalics | 2014-12-19 11:27:43 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-12-19 11:27:43 +0100 |
| commit | 276bd75ca56d29b6ddbd2aca3659c83118b3f548 (patch) | |
| tree | da67f549691fa46128ed4477c90cec056552534b /doc | |
| parent | ad013ba63134d4fe6470665abf2f9e33a595848a (diff) | |
| download | emacs-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/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 132 |
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 @@ | |||
| 1 | 2014-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 | |||
| 1 | 2014-12-18 Eli Zaretskii <eliz@gnu.org> | 12 | 2014-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 | |||
| 657 | margins, fringes, a scroll bar and a right divider, if present. | 658 | margins, fringes, a scroll bar and a right divider, if present. |
| 658 | @end defopt | 659 | @end defopt |
| 659 | 660 | ||
| 660 | @defvar window-size-fixed | ||
| 661 | If this buffer-local variable is non-@code{nil}, the size of any | ||
| 662 | window displaying the buffer cannot normally be changed. Deleting a | ||
| 663 | window or changing the frame's size may still change its size, if | ||
| 664 | there is no choice. | ||
| 665 | |||
| 666 | If the value is @code{height}, then only the window's height is fixed; | ||
| 667 | if the value is @code{width}, then only the window's width is fixed. | ||
| 668 | Any other non-@code{nil} value fixes both the width and the height. | ||
| 669 | |||
| 670 | If this variable is @code{nil}, this does not necessarily mean that any | ||
| 671 | window showing the buffer can be resized in the desired direction. To | ||
| 672 | determine that, use the function @code{window-resizable}. | ||
| 673 | @xref{Resizing Windows}. | ||
| 674 | @end defvar | ||
| 675 | |||
| 676 | The following function tells how small a specific window can get taking | 661 | The following function tells how small a specific window can get taking |
| 677 | into account the sizes of its areas and the values of | 662 | into 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 |
| 818 | called interactively, they act on the selected window. | 803 | called 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 |
| 821 | This command adjusts the height or width of @var{window} to fit the text | 806 | This command adjusts the height or width of @var{window} to fit the text |
| 822 | in it. It returns non-@code{nil} if it was able to resize @var{window}, | 807 | in it. It returns non-@code{nil} if it was able to resize @var{window}, |
| 823 | and @code{nil} otherwise. If @var{window} is omitted or @code{nil}, it | 808 | and @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 | |||
| 845 | specified in columns and include fringes, margins and scrollbars, if | 830 | specified in columns and include fringes, margins and scrollbars, if |
| 846 | any. | 831 | any. |
| 847 | 832 | ||
| 833 | The optional argument @var{preserve-size}, if non-@code{nil}, will | ||
| 834 | install a parameter to preserve the size of @var{window} during future | ||
| 835 | resize operations (@pxref{Preserving Window Sizes}). | ||
| 836 | |||
| 848 | If the option @code{fit-frame-to-buffer} (see below) is non-@code{nil}, | 837 | If the option @code{fit-frame-to-buffer} (see below) is non-@code{nil}, |
| 849 | this function will try to resize the frame of @var{window} to fit its | 838 | this function will try to resize the frame of @var{window} to fit its |
| 850 | contents by calling @code{fit-frame-to-buffer} (@pxref{Size and | 839 | contents by calling @code{fit-frame-to-buffer} (@pxref{Size and |
| @@ -1078,6 +1067,99 @@ point was previously on. Note that this only affects | |||
| 1078 | function. | 1067 | function. |
| 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 | |||
| 1075 | A window can get resized explicitly by using one of the functions from | ||
| 1076 | the preceding section or implicitly, for example, when resizing an | ||
| 1077 | adjacent window, when splitting or deleting a window (@pxref{Splitting | ||
| 1078 | Windows}, @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 | ||
| 1082 | there are one or more other resizable windows on the same frame. For | ||
| 1083 | this purpose, Emacs must be advised to @dfn{preserve} the size of that | ||
| 1084 | window. There are two basic ways to do that. | ||
| 1085 | |||
| 1086 | @defvar window-size-fixed | ||
| 1087 | If this buffer-local variable is non-@code{nil}, the size of any window | ||
| 1088 | displaying the buffer cannot normally be changed. Deleting a window or | ||
| 1089 | changing the frame's size may still change the window's size, if there | ||
| 1090 | is no choice. | ||
| 1091 | |||
| 1092 | If the value is @code{height}, then only the window's height is fixed; | ||
| 1093 | if the value is @code{width}, then only the window's width is fixed. | ||
| 1094 | Any other non-@code{nil} value fixes both the width and the height. | ||
| 1095 | |||
| 1096 | If this variable is @code{nil}, this does not necessarily mean that any | ||
| 1097 | window showing the buffer can be resized in the desired direction. To | ||
| 1098 | determine that, use the function @code{window-resizable}. | ||
| 1099 | @xref{Resizing Windows}. | ||
| 1100 | @end defvar | ||
| 1101 | |||
| 1102 | Often @code{window-size-fixed} is overly aggressive because it inhibits | ||
| 1103 | any attempt to explicitly resize or split an affected window as well. | ||
| 1104 | This may even happen after the window has been resized implicitly, for | ||
| 1105 | example, when deleting an adjacent window or resizing the window's | ||
| 1106 | frame. The following function tries hard to never disallow resizing | ||
| 1107 | such a window explicitly: | ||
| 1108 | |||
| 1109 | @defun window-preserve-size &optional window horizontal preserve | ||
| 1110 | This function (un-)marks the height of window @var{window} as preserved | ||
| 1111 | for future resize operations. @var{window} must be a live window and | ||
| 1112 | defaults to the selected one. If the optional argument @var{horizontal} | ||
| 1113 | is non-@code{nil}, it (un-)marks the width of @var{window} as preserved. | ||
| 1114 | |||
| 1115 | If the optional argument @var{preserve} is @code{t}, this means to | ||
| 1116 | preserve the current height/width of @var{window}'s body. The | ||
| 1117 | height/width of @var{window} will change only if Emacs has no better | ||
| 1118 | choice. Resizing a window whose height/width is preserved by this | ||
| 1119 | function never throws an error. | ||
| 1120 | |||
| 1121 | If @var{preserve} is @code{nil}, this means to stop preserving the | ||
| 1122 | height/width of @var{window}, lifting any respective restraint induced | ||
| 1123 | by 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 | ||
| 1126 | remove the respective restraint. | ||
| 1127 | @end defun | ||
| 1128 | |||
| 1129 | @code{window-preserve-size} is currently invoked by the following | ||
| 1130 | functions: | ||
| 1131 | |||
| 1132 | @table @code | ||
| 1133 | @item fit-window-to-buffer | ||
| 1134 | If the optional argument @var{preserve-size} of that function | ||
| 1135 | (@pxref{Resizing Windows}) is non-@code{nil}, the size established by | ||
| 1136 | that function is preserved. | ||
| 1137 | |||
| 1138 | @item display-buffer | ||
| 1139 | If the @var{alist} argument of that function (@pxref{Choosing Window}) | ||
| 1140 | contains a @code{preserve-size} entry, the size of the window produced | ||
| 1141 | by that function is preserved. | ||
| 1142 | @end table | ||
| 1143 | |||
| 1144 | @code{window-preserve-size} installs a window parameter (@pxref{Window | ||
| 1145 | Parameters}) called @code{preserved-size} which is consulted by the | ||
| 1146 | window resizing functions. This parameter will not prevent resizing the | ||
| 1147 | window when the window shows another buffer than the one when | ||
| 1148 | @code{window-preserve-size} was invoked or if its size has changed since | ||
| 1149 | then. | ||
| 1150 | |||
| 1151 | The following function can be used to check whether the height of a | ||
| 1152 | particular window is preserved: | ||
| 1153 | |||
| 1154 | @defun window-preserved-size &optional window horizontal | ||
| 1155 | This function returns the preserved height of window @var{window} in | ||
| 1156 | pixels. @var{window} must be a live window and defaults to the selected | ||
| 1157 | one. If the optional argument @var{horizontal} is non-@code{nil}, it | ||
| 1158 | returns the preserved width of @var{window}. It returns @code{nil} if | ||
| 1159 | the 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 | |||
| 2233 | of the window; its return value is ignored. | 2315 | of the window; its return value is ignored. |
| 2234 | @end itemize | 2316 | @end itemize |
| 2235 | 2317 | ||
| 2318 | If @var{alist} contains a @code{preserve-size} entry, Emacs will try to | ||
| 2319 | preserve the size of the new window during future resize operations | ||
| 2320 | (@pxref{Preserving Window Sizes}). The @sc{cdr} of that entry must be a | ||
| 2321 | cons cell whose @sc{car}, if non-@code{nil}, means to preserve the width | ||
| 2322 | of the window and whose @sc{cdr}, if non-@code{nil}, means to preserve | ||
| 2323 | the height of the window. | ||
| 2324 | |||
| 2236 | This function can fail if no window splitting can be performed for some | 2325 | This function can fail if no window splitting can be performed for some |
| 2237 | reason (e.g., if the selected frame has an @code{unsplittable} frame | 2326 | reason (e.g., if the selected frame has an @code{unsplittable} frame |
| 2238 | parameter; @pxref{Buffer Parameters}). | 2327 | parameter; @pxref{Buffer Parameters}). |
| @@ -3900,6 +3989,15 @@ This parameter specifies the window that this one has been cloned | |||
| 3900 | from. It is installed by @code{window-state-get} (@pxref{Window | 3989 | from. It is installed by @code{window-state-get} (@pxref{Window |
| 3901 | Configurations}). | 3990 | Configurations}). |
| 3902 | 3991 | ||
| 3992 | @item @code{preserved-size} | ||
| 3993 | This parameter specifies a buffer, a direction where @code{nil} means | ||
| 3994 | vertical and @code{t} horizontal, and a size in pixels. If this window | ||
| 3995 | displays the specified buffer and its size in the indicated direction | ||
| 3996 | equals the size specified by this parameter, then Emacs will try to | ||
| 3997 | preserve the size of this window in the indicated direction. This | ||
| 3998 | parameter 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} |
| 3904 | This parameter is installed by the buffer display functions | 4002 | This 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} |