diff options
| author | Chong Yidong | 2011-11-08 23:34:21 +0800 |
|---|---|---|
| committer | Chong Yidong | 2011-11-08 23:34:21 +0800 |
| commit | e7313f338961e383f1f27bfa3d6083814d0d09ab (patch) | |
| tree | cbfeea8f75a206846d8fcd599670510afa04e1be | |
| parent | fcbcac2e86dbc2069c97d5309937d17cb40d4573 (diff) | |
| download | emacs-e7313f338961e383f1f27bfa3d6083814d0d09ab.tar.gz emacs-e7313f338961e383f1f27bfa3d6083814d0d09ab.zip | |
* doc/lispref/windows.texi (Resizing Windows): Simplify introduction.
Don't document enlarge-window, shrink-window, enlarge-window-horizontally,
and shrink-window-horizontally; they are no longer preferred for calling
from Lisp, and are already documented in the Emacs manual.
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 204 |
2 files changed, 74 insertions, 134 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 47214596c1a..7a1e34de159 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -4,6 +4,10 @@ | |||
| 4 | window-text-height. Remove window-min-height and window-min-width | 4 | window-text-height. Remove window-min-height and window-min-width |
| 5 | discussion, referring instead to Emacs manual. | 5 | discussion, referring instead to Emacs manual. |
| 6 | (Splitting Windows, Resizing Windows): Add xref to Emacs manual. | 6 | (Splitting Windows, Resizing Windows): Add xref to Emacs manual. |
| 7 | (Resizing Windows): Simplify introduction. Don't document | ||
| 8 | enlarge-window, shrink-window, enlarge-window-horizontally, and | ||
| 9 | shrink-window-horizontally; they are no longer preferred for | ||
| 10 | calling from Lisp, and are already documented in the Emacs manual. | ||
| 7 | 11 | ||
| 8 | 2011-11-07 Glenn Morris <rgm@gnu.org> | 12 | 2011-11-07 Glenn Morris <rgm@gnu.org> |
| 9 | 13 | ||
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 2bb30dd4cbc..46ed4476036 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -274,7 +274,7 @@ the leftmost child window for a horizontal combination. If | |||
| 274 | @defun window-combined-p &optional window horizontal | 274 | @defun window-combined-p &optional window horizontal |
| 275 | This function returns a non-@code{nil} value if and only if | 275 | This function returns a non-@code{nil} value if and only if |
| 276 | @var{window} is part of a vertical combination. If @var{window} is | 276 | @var{window} is part of a vertical combination. If @var{window} is |
| 277 | omitted or nil, it defaults to the selected one. | 277 | omitted or @code{nil}, it defaults to the selected one. |
| 278 | 278 | ||
| 279 | If the optional argument @var{horizontal} is non-@code{nil}, this | 279 | If the optional argument @var{horizontal} is non-@code{nil}, this |
| 280 | means to return non-@code{nil} if and only if @var{window} is part of | 280 | means to return non-@code{nil} if and only if @var{window} is part of |
| @@ -542,138 +542,74 @@ function @code{window-resizable}. @xref{Resizing Windows}. | |||
| 542 | @cindex changing window size | 542 | @cindex changing window size |
| 543 | @cindex window size, changing | 543 | @cindex window size, changing |
| 544 | 544 | ||
| 545 | Emacs does not permit overlapping windows or gaps between windows, so | 545 | This section describes functions for resizing a window without |
| 546 | changing the size of a window always affects at least one other window. | 546 | changing the size of its frame. Because live windows do not overlap, |
| 547 | When a frame contains just one window, that window can be resized only | 547 | these functions are meaningful only on frames that contain two or more |
| 548 | by resizing the window's frame. The functions described below are | 548 | windows: resizing a window also changes the size of a neighboring |
| 549 | therefore meaningful only in the context of a frame containing at least | 549 | window. If there is just one window on a frame, its size cannot be |
| 550 | two windows. The size of the corresponding frame never changes when | 550 | changed except by resizing the frame (@pxref{Size and Position}). |
| 551 | invoking a function described in this section. | 551 | |
| 552 | 552 | Except where noted, these functions also accept internal windows as | |
| 553 | The routines changing window sizes always operate in one dimension at | 553 | arguments. Resizing an internal window causes its child windows to be |
| 554 | a time. This means that windows can be resized only either vertically | 554 | resized to fit the same space. |
| 555 | or horizontally. If a window shall be resized in both dimensions, it | ||
| 556 | must be resized in one dimension first and in the other dimension | ||
| 557 | afterwards. If the second resize operation fails, the frame might end | ||
| 558 | up in an unsatisfactory state. To avoid such states, it might be useful | ||
| 559 | to save the current window configuration (@pxref{Window Configurations}) | ||
| 560 | before attempting the first resize operation and restore the saved | ||
| 561 | configuration in case the second resize operation fails. | ||
| 562 | |||
| 563 | Functions that resize windows are supposed to obey restrictions | ||
| 564 | imposed by window minimum sizes and fixed-size windows, see @ref{Window | ||
| 565 | Sizes}. In order to determine whether resizing a specific window is | ||
| 566 | possible in the first place, the following function can be used: | ||
| 567 | 555 | ||
| 568 | @defun window-resizable window delta &optional horizontal ignore side noup nodown | 556 | @defun window-resizable window delta &optional horizontal ignore side noup nodown |
| 569 | This function returns @var{delta} if the size of @var{window} can be | 557 | This function returns @var{delta} if the size of @var{window} can be |
| 570 | changed vertically by @var{delta} lines. Optional argument | 558 | changed vertically by @var{delta} lines. If the optional argument |
| 571 | @var{horizontal} non-@code{nil} means to return @var{delta} if | 559 | @var{horizontal} is non-@code{nil}, it instead returns @var{delta} if |
| 572 | @var{window} can be resized horizontally by @var{delta} columns. A | 560 | @var{window} can be resized horizontally by @var{delta} columns. It |
| 573 | return value of zero means that @var{window} is not resizable. | 561 | does not actually change the window size. |
| 574 | 562 | ||
| 575 | If @var{delta} is a positive number, this means that @var{window} shall | 563 | If @var{window} is @code{nil}, it defaults to the selected window. |
| 576 | be enlarged by @var{delta} lines or columns. If @var{window} cannot be | 564 | |
| 577 | enlarged by @var{delta} lines or columns, this function returns the | 565 | A positive value of @var{delta} enlarges the window by that number of |
| 578 | maximum value in the range from 0 to @var{delta} by which @var{window} | 566 | lines or columns; a negative value of @var{delta} shrinks it. If |
| 579 | can be enlarged. | 567 | @var{delta} is non-zero, a return value of 0 means that the window |
| 580 | 568 | cannot be resized. | |
| 581 | If @var{delta} is a negative number, this means that @var{window} shall | 569 | |
| 582 | be shrunk by -@var{delta} lines or columns. If @var{window} cannot be | 570 | Normally, the variables @code{window-min-height} and |
| 583 | shrunk by -@var{delta} lines or columns, this function returns the | 571 | @code{window-min-width} specify the smallest allowable window size. |
| 584 | minimum value in the range from @var{delta} to 0 that can be used for | 572 | @xref{Change Window,, Deleting and Rearranging Windows, emacs, The GNU |
| 585 | shrinking @var{window}. | 573 | Emacs Manual}. However, if the optional argument @var{ignore} is |
| 586 | 574 | non-@code{nil}, this function ignores @code{window-min-height} and | |
| 587 | Normally, the customizable variables @code{window-min-height} and | 575 | @code{window-min-width}, as well as @code{window-size-fixed}. |
| 588 | @code{window-min-width} specify the smallest allowable size of a | 576 | Instead, it considers the minimum-height window to be one consisting |
| 589 | window. @xref{Change Window,,Deleting and Rearranging Windows, | 577 | of a header (if any), a mode line, plus a text area one line tall; and |
| 590 | emacs, The GNU Emacs Manual}. If resizing would result in making any | 578 | a minimum-width window as one consisting of fringes, margins, and |
| 591 | window smaller than this, this function usually signals an error. | 579 | scroll bar (if any), plus a text area two columns wide. |
| 592 | However, if the optional argument @var{ignore} is non-@code{nil}, this | 580 | |
| 593 | function ignores @code{window-min-height} and @code{window-min-width}, | 581 | If the optional argument @var{noup} is non-@code{nil}, this function |
| 594 | as well as @code{window-size-fixed}. In that case, the minimum-height | 582 | considers a resize operation that does not alter the window parent of |
| 595 | window consists of a header (if any), a mode line, plus a text area | 583 | @var{window}, only its siblings. If the optional argument |
| 596 | one line tall; the minimum-width window consists of any fringes, | 584 | @var{nodown} is non-@code{nil}, it does not attempt to check whether |
| 597 | margins and scroll bar, plus a text area two columns wide. | 585 | @var{window} itself and its child windows can be resized. |
| 598 | 586 | @end defun | |
| 599 | If @var{ignore} denotes a window, this means to ignore restrictions for | ||
| 600 | that window only. If @var{ignore} equals the constant @code{safe}, this | ||
| 601 | means a live window may get as small as one line or two columns. | ||
| 602 | |||
| 603 | Optional argument @var{noup} non-@code{nil} means don't go up in the | ||
| 604 | window tree but try to steal or distribute the space needed for the | ||
| 605 | resize operation among the other windows within @var{window}'s | ||
| 606 | combination. Optional argument @var{nodown} non-@code{nil} means don't | ||
| 607 | check whether @var{window} itself and its child windows can be resized. | ||
| 608 | @end defun | ||
| 609 | |||
| 610 | The function @code{window-resizable} does not change any window sizes. | ||
| 611 | The following function does: | ||
| 612 | 587 | ||
| 613 | @defun window-resize window delta &optional horizontal ignore | 588 | @defun window-resize window delta &optional horizontal ignore |
| 614 | This function resizes @var{window} vertically by @var{delta} lines. The | 589 | This function resizes @var{window} by @var{delta} increments. If |
| 615 | argument @var{window} can denote an arbitrary window and defaults to the | 590 | @var{horizontal} is @code{nil}, it changes the height by @var{delta} |
| 616 | selected one. An attempt to resize the root window of a frame will | 591 | lines; otherwise, it changes the width by @var{delta} columns. A |
| 617 | raise an error. | 592 | positive @var{delta} means to enlarge the window, and a negative |
| 618 | 593 | @var{delta} means to shrink it. | |
| 619 | Second argument @var{delta} a positive number means @var{window} shall | ||
| 620 | be enlarged by @var{delta} lines. If @var{delta} is negative, that | ||
| 621 | means @var{window} shall be shrunk by -@var{delta} lines. | ||
| 622 | |||
| 623 | Optional argument @var{horizontal} non-@code{nil} means to resize | ||
| 624 | @var{window} horizontally by @var{delta} columns. In this case a | ||
| 625 | positive @var{delta} means enlarge @var{window} by @var{delta} columns. | ||
| 626 | A negative @var{delta} means @var{window} shall be shrunk by | ||
| 627 | -@var{delta} columns. | ||
| 628 | |||
| 629 | Optional argument @var{ignore} has the same meaning as for the function | ||
| 630 | @code{window-resizable} above. | ||
| 631 | |||
| 632 | This function can simultaneously move two edges of WINDOW. Exactly | ||
| 633 | which edges of @var{window} are moved and which other windows are | ||
| 634 | resized along with @var{window} is determined by the splits and nest | ||
| 635 | status of the involved windows (@pxref{Splitting Windows}). If only the | ||
| 636 | low (right) edge of @var{window} shall be moved, the function | ||
| 637 | @code{adjust-window-trailing-edge} described below should be used. | ||
| 638 | @end defun | ||
| 639 | |||
| 640 | The next four commands are simple interfaces to @code{window-resize}. | ||
| 641 | They always operate on the selected window, never delete any window, and | ||
| 642 | always raise an error when resizing would violate a restriction imposed | ||
| 643 | by @code{window-min-height}, @code{window-min-width}, or | ||
| 644 | @code{window-size-fixed}. | ||
| 645 | |||
| 646 | @deffn Command enlarge-window delta &optional horizontal | ||
| 647 | This function makes the selected window @var{delta} lines taller. | ||
| 648 | Interactively, if no argument is given, it makes the selected window one | ||
| 649 | line taller. If optional argument @var{horizontal} is non-@code{nil}, | ||
| 650 | it makes the selected window wider by @var{delta} columns. If | ||
| 651 | @var{delta} is negative, it shrinks the selected window by -@var{delta} | ||
| 652 | lines or columns. The return value is @code{nil}. | ||
| 653 | @end deffn | ||
| 654 | 594 | ||
| 655 | @deffn Command enlarge-window-horizontally delta | 595 | If @var{window} is @code{nil}, it defaults to the selected window. If |
| 656 | This function makes the selected window @var{delta} columns wider. | 596 | the window cannot be resized as demanded, an error is signaled. |
| 657 | Interactively, if no argument is given, it makes the selected window one | ||
| 658 | column wider. | ||
| 659 | @end deffn | ||
| 660 | 597 | ||
| 661 | @deffn Command shrink-window delta &optional horizontal | 598 | The optional argument @var{ignore} has the same meaning as for the |
| 662 | This function makes the selected window @var{delta} lines smaller. | 599 | function @code{window-resizable} above. |
| 663 | Interactively, if no argument is given, it makes the selected window one | ||
| 664 | line smaller. If optional argument @var{horizontal} is non-@code{nil}, | ||
| 665 | it makes the selected window narrower by @var{delta} columns. If | ||
| 666 | @var{delta} is negative, it enlarges the selected window by -@var{delta} | ||
| 667 | lines or columns. The return value is @code{nil}. | ||
| 668 | @end deffn | ||
| 669 | 600 | ||
| 670 | @deffn Command shrink-window-horizontally delta | 601 | The choice of which window edge this function alters depends on the |
| 671 | This function makes the selected window @var{delta} columns narrower. | 602 | splitting and nesting status of the involved windows; in some cases, |
| 672 | Interactively, if no argument is given, it makes the selected window one | 603 | it may alter both edges. @xref{Splitting Windows}. To resize by |
| 673 | column narrower. | 604 | moving only the bottom or right edge of a window, use the function |
| 674 | @end deffn | 605 | @code{adjust-window-trailing-edge}, below. |
| 606 | @end defun | ||
| 607 | |||
| 608 | @c The commands enlarge-window, enlarge-window-horizontally, | ||
| 609 | @c shrink-window, and shrink-window-horizontally are documented in the | ||
| 610 | @c Emacs manual. They are not preferred for calling from Lisp. | ||
| 675 | 611 | ||
| 676 | The following function is useful for moving the line dividing two | 612 | The following function is useful for moving the line dividing two |
| 677 | windows. | 613 | windows. |
| 678 | 614 | ||
| 679 | @defun adjust-window-trailing-edge window delta &optional horizontal | 615 | @defun adjust-window-trailing-edge window delta &optional horizontal |
| @@ -1101,9 +1037,9 @@ configuration. | |||
| 1101 | @code{split-window}. | 1037 | @code{split-window}. |
| 1102 | 1038 | ||
| 1103 | @defopt window-splits | 1039 | @defopt window-splits |
| 1104 | If this variable is nil, the function @code{split-window} can split a | 1040 | If this variable is @code{nil}, the function @code{split-window} can |
| 1105 | window if and only if that window's screen estate is sufficiently large | 1041 | split a window if and only if that window's screen estate is |
| 1106 | to accommodate both--itself and the new window. | 1042 | sufficiently large to accommodate both--itself and the new window. |
| 1107 | 1043 | ||
| 1108 | If this variable is non-@code{nil}, @code{split-window} tries to resize | 1044 | If this variable is non-@code{nil}, @code{split-window} tries to resize |
| 1109 | all windows that are part of the same combination as the old window to | 1045 | all windows that are part of the same combination as the old window to |
| @@ -1488,11 +1424,11 @@ function, it calls that function with @var{window} as its sole argument. | |||
| 1488 | @end deffn | 1424 | @end deffn |
| 1489 | 1425 | ||
| 1490 | @deffn Command delete-windows-on &optional buffer-or-name frame | 1426 | @deffn Command delete-windows-on &optional buffer-or-name frame |
| 1491 | This function deletes all windows showing @var{buffer-or-name} and | 1427 | This function deletes all windows showing @var{buffer-or-name}. If |
| 1492 | returns nil. If there are no windows showing @var{buffer-or-name}, it | 1428 | there are no windows showing @var{buffer-or-name}, it does nothing. |
| 1493 | does nothing. The optional argument @var{buffer-or-name} may be a | 1429 | The optional argument @var{buffer-or-name} may be a buffer or the name |
| 1494 | buffer or the name of an existing buffer and defaults to the current | 1430 | of an existing buffer and defaults to the current buffer. Invoking |
| 1495 | buffer. Invoking this command on a minibuffer signals an error. | 1431 | this command on a minibuffer signals an error. |
| 1496 | 1432 | ||
| 1497 | The function @code{delete-windows-on} operates by calling | 1433 | The function @code{delete-windows-on} operates by calling |
| 1498 | @code{delete-window} for each window showing @var{buffer-or-name}. If a | 1434 | @code{delete-window} for each window showing @var{buffer-or-name}. If a |
| @@ -2108,7 +2044,7 @@ The constant @code{display-buffer-fallback-action}. | |||
| 2108 | @noindent | 2044 | @noindent |
| 2109 | Each action function is called in turn, passing the buffer as the | 2045 | Each action function is called in turn, passing the buffer as the |
| 2110 | first argument and the combined action alist as the second argument, | 2046 | first argument and the combined action alist as the second argument, |
| 2111 | until one of the functions returns non-nil. | 2047 | until one of the functions returns non-@code{nil}. |
| 2112 | 2048 | ||
| 2113 | The argument @var{action} can also have a non-@code{nil}, non-list | 2049 | The argument @var{action} can also have a non-@code{nil}, non-list |
| 2114 | value. This has the special meaning that the buffer should be | 2050 | value. This has the special meaning that the buffer should be |
| @@ -2159,7 +2095,7 @@ returns the window if it succeeds, and @code{nil} if it fails. | |||
| 2159 | This function tries to display @var{buffer} in the selected window. | 2095 | This function tries to display @var{buffer} in the selected window. |
| 2160 | It fails if the selected window is a minibuffer window or is dedicated | 2096 | It fails if the selected window is a minibuffer window or is dedicated |
| 2161 | to another buffer (@pxref{Dedicated Windows}). It also fails if | 2097 | to another buffer (@pxref{Dedicated Windows}). It also fails if |
| 2162 | @var{alist} has a non-nil @code{inhibit-same-window} entry. | 2098 | @var{alist} has a non-@code{nil} @code{inhibit-same-window} entry. |
| 2163 | @end defun | 2099 | @end defun |
| 2164 | 2100 | ||
| 2165 | @defun display-buffer-reuse-window buffer alist | 2101 | @defun display-buffer-reuse-window buffer alist |