diff options
| author | Martin Rudalics | 2011-09-25 17:08:25 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2011-09-25 17:08:25 +0200 |
| commit | c419f5cb552a22202d86d10c3bd15e505af43a21 (patch) | |
| tree | 568a21a3acb962d6124d07d47856c46ac33a45ac | |
| parent | f3f9834230b2cf021984c639072ce5cb377643f0 (diff) | |
| download | emacs-c419f5cb552a22202d86d10c3bd15e505af43a21.tar.gz emacs-c419f5cb552a22202d86d10c3bd15e505af43a21.zip | |
Describe window quitting, configuration and parameter additions.
* windows.texi (Quitting Windows): New node.
(Window Configurations): Add descriptions of window-state-get
and window-state-put.
(Window Parameters): Describe variable ignore-window-parameters.
Sketch some window parameters currently in use.
* elisp.texi (Top): Update node listing.
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 167 |
3 files changed, 159 insertions, 16 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index e45fa693fec..423e052068b 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -6,6 +6,12 @@ | |||
| 6 | Reword description of replace-buffer-in-windows. | 6 | Reword description of replace-buffer-in-windows. |
| 7 | (Window History): Fix some typos and refer to frame local buffer | 7 | (Window History): Fix some typos and refer to frame local buffer |
| 8 | list. | 8 | list. |
| 9 | (Quitting Windows): New node. | ||
| 10 | (Window Configurations): Add descriptions of window-state-get | ||
| 11 | and window-state-put. | ||
| 12 | (Window Parameters): Describe variable ignore-window-parameters. | ||
| 13 | Sketch some window parameters currently in use. | ||
| 14 | * elisp.texi (Top): Update node listing. | ||
| 9 | 15 | ||
| 10 | 2011-09-25 Chong Yidong <cyd@stupidchicken.com> | 16 | 2011-09-25 Chong Yidong <cyd@stupidchicken.com> |
| 11 | 17 | ||
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 45eaeb85ad8..8350c9b7080 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -942,6 +942,8 @@ Windows | |||
| 942 | * Window History:: Each window remembers the buffers displayed in it. | 942 | * Window History:: Each window remembers the buffers displayed in it. |
| 943 | * Dedicated Windows:: How to avoid displaying another buffer in | 943 | * Dedicated Windows:: How to avoid displaying another buffer in |
| 944 | a specific window. | 944 | a specific window. |
| 945 | * Quitting Windows:: How to restore the state prior to displaying a | ||
| 946 | buffer. | ||
| 945 | * Window Point:: Each window has its own location of point. | 947 | * Window Point:: Each window has its own location of point. |
| 946 | * Window Start and End:: Buffer positions indicating which text is | 948 | * Window Start and End:: Buffer positions indicating which text is |
| 947 | on-screen in a window. | 949 | on-screen in a window. |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 1276246a0e3..96d489d1203 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -29,6 +29,8 @@ is displayed in windows. | |||
| 29 | * Window History:: Each window remembers the buffers displayed in it. | 29 | * Window History:: Each window remembers the buffers displayed in it. |
| 30 | * Dedicated Windows:: How to avoid displaying another buffer in | 30 | * Dedicated Windows:: How to avoid displaying another buffer in |
| 31 | a specific window. | 31 | a specific window. |
| 32 | * Quitting Windows:: How to restore the state prior to displaying a | ||
| 33 | buffer. | ||
| 32 | * Window Point:: Each window has its own location of point. | 34 | * Window Point:: Each window has its own location of point. |
| 33 | * Window Start and End:: Buffer positions indicating which text is | 35 | * Window Start and End:: Buffer positions indicating which text is |
| 34 | on-screen in a window. | 36 | on-screen in a window. |
| @@ -2777,6 +2779,59 @@ display. Other functions do not treat @code{t} differently from any | |||
| 2777 | non-@code{nil} value. | 2779 | non-@code{nil} value. |
| 2778 | @end defun | 2780 | @end defun |
| 2779 | 2781 | ||
| 2782 | |||
| 2783 | @node Quitting Windows | ||
| 2784 | @section Quitting Windows | ||
| 2785 | |||
| 2786 | When you want to get rid of a window used for displaying a buffer you | ||
| 2787 | can use the function @code{delete-window} (@pxref{Deleting Windows}) to | ||
| 2788 | remove that window from its frame. If the buffer has been shown on a | ||
| 2789 | separate frame, you might want to call @code{delete-frame} | ||
| 2790 | (@pxref{Deleting Frames}) instead. If, on the other hand, a window has | ||
| 2791 | been reused for displaying the buffer, you might prefer showing the | ||
| 2792 | buffer previously shown in that window by calling the function | ||
| 2793 | @code{switch-to-prev-buffer} (@pxref{Window History}). Finally, you | ||
| 2794 | might want to either bury (@pxref{The Buffer List}) or kill | ||
| 2795 | (@pxref{Killing Buffers}) the window's buffer. | ||
| 2796 | |||
| 2797 | The following function uses information on how the window for | ||
| 2798 | displaying the buffer was obtained in the first place thus attempting to | ||
| 2799 | automatize the above decisions for you. | ||
| 2800 | |||
| 2801 | @deffn Command quit-window &optional kill window | ||
| 2802 | This command quits @var{window} and buries its buffer. The argument | ||
| 2803 | @var{window} must be a live window and defaults to the selected one. | ||
| 2804 | With prefix argument @var{kill} non-@code{nil}, it kills the buffer | ||
| 2805 | instead of burying it. | ||
| 2806 | |||
| 2807 | Quitting @var{window} means to proceed as follows: If @var{window} was | ||
| 2808 | created specially for displaying its current buffer, delete @var{window} | ||
| 2809 | provided its frame contains at least one other live window. If | ||
| 2810 | @var{window} is the only window on its frame and other frames still | ||
| 2811 | exist, delete the frame together with @var{window}. If, however, there | ||
| 2812 | are no other frames left, display some other buffer in @var{window}. | ||
| 2813 | |||
| 2814 | If @var{window} was reused for displaying its buffer, this command tries | ||
| 2815 | to display the buffer previously shown in it. It also tries to restore | ||
| 2816 | the window start (@pxref{Window Start and End}) and point (@pxref{Window | ||
| 2817 | Point}) positions of the previously shown buffer. If, in addition, the | ||
| 2818 | current buffer was temporarily resized, this command will also try to | ||
| 2819 | restore the original height of @var{window}. | ||
| 2820 | |||
| 2821 | The three cases described so far require that the buffer shown in | ||
| 2822 | @var{window} is still the buffer displayed by the last buffer display | ||
| 2823 | function for this window. If another buffer has been shown in the | ||
| 2824 | meantime or the buffer previously shown no longer exists, this command | ||
| 2825 | calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some | ||
| 2826 | other buffer instead. | ||
| 2827 | @end deffn | ||
| 2828 | |||
| 2829 | The function @code{quit-window} bases its decisions on information | ||
| 2830 | stored in @var{window}'s @code{quit-restore} window parameter | ||
| 2831 | (@pxref{Window Parameters}) and resets that parameter to @code{nil} | ||
| 2832 | after it's done. | ||
| 2833 | |||
| 2834 | |||
| 2780 | @node Window Point | 2835 | @node Window Point |
| 2781 | @section Windows and Point | 2836 | @section Windows and Point |
| 2782 | @cindex window position | 2837 | @cindex window position |
| @@ -3523,14 +3578,13 @@ argument because it always uses the frame that @var{window} is on. | |||
| 3523 | @cindex window configurations | 3578 | @cindex window configurations |
| 3524 | @cindex saving window information | 3579 | @cindex saving window information |
| 3525 | 3580 | ||
| 3526 | A @dfn{window configuration} records the entire layout of one | 3581 | A @dfn{window configuration} records the entire layout of one |
| 3527 | frame---all windows, their sizes, which buffers they contain, how those | 3582 | frame---all windows, their sizes, which buffers they contain, how those |
| 3528 | buffers are scrolled, and their values of point and the mark; also their | 3583 | buffers are scrolled, and their values of point and the mark; also their |
| 3529 | fringes, margins, and scroll bar settings. It also includes the value | 3584 | fringes, margins, and scroll bar settings. It also includes the value |
| 3530 | of @code{minibuffer-scroll-window}. As a special exception, the window | 3585 | of @code{minibuffer-scroll-window}. As a special exception, the window |
| 3531 | configuration does not record the value of point in the selected window | 3586 | configuration does not record the value of point in the selected window |
| 3532 | for the current buffer. Also, the window configuration does not record | 3587 | for the current buffer. |
| 3533 | the values of window parameters; see @ref{Window Parameters}. | ||
| 3534 | 3588 | ||
| 3535 | You can bring back an entire frame layout by restoring a previously | 3589 | You can bring back an entire frame layout by restoring a previously |
| 3536 | saved window configuration. If you want to record the layout of all | 3590 | saved window configuration. If you want to record the layout of all |
| @@ -3640,24 +3694,62 @@ sense, but are not implemented because we did not need them. See the | |||
| 3640 | file @file{winner.el} for some more operations on windows | 3694 | file @file{winner.el} for some more operations on windows |
| 3641 | configurations. | 3695 | configurations. |
| 3642 | 3696 | ||
| 3697 | The objects returned by @code{current-window-configuration} die | ||
| 3698 | together with the Emacs process. In order to store a window | ||
| 3699 | configuration on disk and read it back in another Emacs session the | ||
| 3700 | following two functions can be used. | ||
| 3701 | |||
| 3702 | @defun window-state-get &optional window markers | ||
| 3703 | This function returns the state of @var{window} as a Lisp object. The | ||
| 3704 | argument @var{window} can be any window and defaults to the root window | ||
| 3705 | of the selected frame. | ||
| 3706 | |||
| 3707 | The optional argument @var{markers} non-@code{nil} means to use markers | ||
| 3708 | for sampling positions like @code{window-point} or @code{window-start}. | ||
| 3709 | This argument should be non-@code{nil} only if the value is used for | ||
| 3710 | putting the state back in the same session since markers slow down | ||
| 3711 | processing. | ||
| 3712 | @end defun | ||
| 3713 | |||
| 3714 | The value returned by @code{window-state-get} can be converted by using | ||
| 3715 | one of the functions defined by Desktop Save Mode (@pxref{Desktop Save | ||
| 3716 | Mode}) to an object that can be written to a file. Such objects can be | ||
| 3717 | read back and converted to a Lisp object representing the state of the | ||
| 3718 | window. That Lisp object can be used as argument for the following | ||
| 3719 | function in order to restore the state window in another window. | ||
| 3720 | |||
| 3721 | @defun window-state-put state &optional window ignore | ||
| 3722 | This function puts the window state @var{state} into @var{window}. The | ||
| 3723 | argument @var{state} should be the state of a window returned by an | ||
| 3724 | earlier invocation of @code{window-state-get}, see above. The optional | ||
| 3725 | argument @var{window} must specify a live window and defaults to the | ||
| 3726 | selected one. | ||
| 3727 | |||
| 3728 | The optional argument @var{ignore} non-@code{nil} means to ignore | ||
| 3729 | minimum window sizes and fixed size restrictions. If @var{ignore} | ||
| 3730 | equals @code{safe}, this means subwindows can get as small as one line | ||
| 3731 | and/or two columns. | ||
| 3732 | @end defun | ||
| 3733 | |||
| 3734 | |||
| 3643 | @node Window Parameters | 3735 | @node Window Parameters |
| 3644 | @section Window Parameters | 3736 | @section Window Parameters |
| 3645 | @cindex window parameters | 3737 | @cindex window parameters |
| 3646 | 3738 | ||
| 3647 | This sections describes how window parameters can be used to associate | 3739 | This section describes how window parameters can be used to associate |
| 3648 | additional information with windows. | 3740 | additional information with windows. |
| 3649 | 3741 | ||
| 3650 | @defun window-parameter window parameter | 3742 | @defun window-parameter window parameter |
| 3651 | This function returns @var{window}'s value for @var{parameter}. The | 3743 | This function returns @var{window}'s value for @var{parameter}. The |
| 3652 | default for @var{window} is the selected window. If @var{window} | 3744 | default for @var{window} is the selected window. If @var{window} has no |
| 3653 | has no setting for @var{parameter}, this function returns @code{nil}. | 3745 | setting for @var{parameter}, this function returns @code{nil}. |
| 3654 | @end defun | 3746 | @end defun |
| 3655 | 3747 | ||
| 3656 | @defun window-parameters &optional window | 3748 | @defun window-parameters &optional window |
| 3657 | This function returns all parameters of @var{window} and their values. | 3749 | This function returns all parameters of @var{window} and their values. |
| 3658 | The default for @var{window} is the selected window. The return value | 3750 | The default for @var{window} is the selected window. The return value, |
| 3659 | is an association list of elements of the form @code{(@var{parameter} | 3751 | if non-@code{nil} is an association list whose elements have the form |
| 3660 | . @var{value})}. | 3752 | @code{(@var{parameter} . @var{value})}. |
| 3661 | @end defun | 3753 | @end defun |
| 3662 | 3754 | ||
| 3663 | @defun set-window-parameter window parameter value | 3755 | @defun set-window-parameter window parameter value |
| @@ -3666,13 +3758,56 @@ This function sets @var{window}'s value of @var{parameter} to | |||
| 3666 | is the selected window. | 3758 | is the selected window. |
| 3667 | @end defun | 3759 | @end defun |
| 3668 | 3760 | ||
| 3669 | Currently, window parameters are not saved in window configurations and | 3761 | Some functions, notably @code{delete-window}, |
| 3670 | consequently not restored by @code{set-window-configuration}. Hence, | 3762 | @code{delete-other-windows} and @code{split-window} may behave specially |
| 3671 | any change of a parameter introduced via @code{set-window-parameter} can | 3763 | when their @var{window} argument has a parameter set. You can override |
| 3672 | be undone only by invoking @code{set-window-parameter} for the same | 3764 | such special behavior by binding the following variable to a |
| 3673 | parameter again. Since @code{save-window-excursion} relies on window | 3765 | non-@code{nil} value: |
| 3674 | configurations (@pxref{Window Configurations}), window parameters are | 3766 | |
| 3675 | not saved and restored by that special form, either. | 3767 | @defvar ignore-window-parameters |
| 3768 | If this variable is non-@code{nil}, some standard functions do not | ||
| 3769 | process window parameters. The functions currently affected by this are | ||
| 3770 | @code{split-window}, @code{delete-window}, @code{delete-other-windows} | ||
| 3771 | and @code{other-window}. | ||
| 3772 | |||
| 3773 | An application can bind this variable to a non-@code{nil} value around | ||
| 3774 | calls to these functions. If it does so, the application is fully | ||
| 3775 | responsible for correctly assigning the parameters of all involved | ||
| 3776 | windows when exiting that function. | ||
| 3777 | @end defvar | ||
| 3778 | |||
| 3779 | The following parameters are currently used by the window management | ||
| 3780 | code. | ||
| 3781 | |||
| 3782 | @table @asis | ||
| 3783 | @item @code{delete-window} | ||
| 3784 | This parameter affects the execution of @code{delete-window} | ||
| 3785 | (@pxref{Deleting Windows}). | ||
| 3786 | |||
| 3787 | @item @code{delete-other-windows} | ||
| 3788 | This parameter affects the execution of @code{delete-other-windows} | ||
| 3789 | (@pxref{Deleting Windows}). | ||
| 3790 | |||
| 3791 | @item @code{split-window} | ||
| 3792 | This parameter affects the execution of @code{split-window} | ||
| 3793 | (@pxref{Splitting Windows}). | ||
| 3794 | |||
| 3795 | @item @code{other-window} | ||
| 3796 | This parameter affects the execution of @code{other-window} | ||
| 3797 | (@pxref{Cyclic Window Ordering}). | ||
| 3798 | |||
| 3799 | @item @code{no-other-window} | ||
| 3800 | This parameter marks the window as not selectable by @code{other-window} | ||
| 3801 | (@pxref{Cyclic Window Ordering}). | ||
| 3802 | @end table | ||
| 3803 | |||
| 3804 | In addition, the parameters @code{window-atom} and @code{window-side} | ||
| 3805 | are reserved and should not be used by applications. The | ||
| 3806 | @code{quit-restore} parameter tells how to proceed with a window when | ||
| 3807 | the buffer it shows is no more needed. This parameter is installed by | ||
| 3808 | the buffer display functions (@pxref{Choosing Window}) and consulted by | ||
| 3809 | the function @code{quit-window} (@pxref{Quitting Windows}). | ||
| 3810 | |||
| 3676 | 3811 | ||
| 3677 | @node Window Hooks | 3812 | @node Window Hooks |
| 3678 | @section Hooks for Window Scrolling and Changes | 3813 | @section Hooks for Window Scrolling and Changes |