aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2011-09-25 17:08:25 +0200
committerMartin Rudalics2011-09-25 17:08:25 +0200
commitc419f5cb552a22202d86d10c3bd15e505af43a21 (patch)
tree568a21a3acb962d6124d07d47856c46ac33a45ac
parentf3f9834230b2cf021984c639072ce5cb377643f0 (diff)
downloademacs-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/ChangeLog6
-rw-r--r--doc/lispref/elisp.texi2
-rw-r--r--doc/lispref/windows.texi167
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
102011-09-25 Chong Yidong <cyd@stupidchicken.com> 162011-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
2777non-@code{nil} value. 2779non-@code{nil} value.
2778@end defun 2780@end defun
2779 2781
2782
2783@node Quitting Windows
2784@section Quitting Windows
2785
2786When you want to get rid of a window used for displaying a buffer you
2787can use the function @code{delete-window} (@pxref{Deleting Windows}) to
2788remove that window from its frame. If the buffer has been shown on a
2789separate frame, you might want to call @code{delete-frame}
2790(@pxref{Deleting Frames}) instead. If, on the other hand, a window has
2791been reused for displaying the buffer, you might prefer showing the
2792buffer previously shown in that window by calling the function
2793@code{switch-to-prev-buffer} (@pxref{Window History}). Finally, you
2794might 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
2798displaying the buffer was obtained in the first place thus attempting to
2799automatize the above decisions for you.
2800
2801@deffn Command quit-window &optional kill window
2802This command quits @var{window} and buries its buffer. The argument
2803@var{window} must be a live window and defaults to the selected one.
2804With prefix argument @var{kill} non-@code{nil}, it kills the buffer
2805instead of burying it.
2806
2807Quitting @var{window} means to proceed as follows: If @var{window} was
2808created specially for displaying its current buffer, delete @var{window}
2809provided its frame contains at least one other live window. If
2810@var{window} is the only window on its frame and other frames still
2811exist, delete the frame together with @var{window}. If, however, there
2812are no other frames left, display some other buffer in @var{window}.
2813
2814If @var{window} was reused for displaying its buffer, this command tries
2815to display the buffer previously shown in it. It also tries to restore
2816the window start (@pxref{Window Start and End}) and point (@pxref{Window
2817Point}) positions of the previously shown buffer. If, in addition, the
2818current buffer was temporarily resized, this command will also try to
2819restore the original height of @var{window}.
2820
2821The three cases described so far require that the buffer shown in
2822@var{window} is still the buffer displayed by the last buffer display
2823function for this window. If another buffer has been shown in the
2824meantime or the buffer previously shown no longer exists, this command
2825calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some
2826other buffer instead.
2827@end deffn
2828
2829The function @code{quit-window} bases its decisions on information
2830stored in @var{window}'s @code{quit-restore} window parameter
2831(@pxref{Window Parameters}) and resets that parameter to @code{nil}
2832after 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 3581A @dfn{window configuration} records the entire layout of one
3527frame---all windows, their sizes, which buffers they contain, how those 3582frame---all windows, their sizes, which buffers they contain, how those
3528buffers are scrolled, and their values of point and the mark; also their 3583buffers are scrolled, and their values of point and the mark; also their
3529fringes, margins, and scroll bar settings. It also includes the value 3584fringes, margins, and scroll bar settings. It also includes the value
3530of @code{minibuffer-scroll-window}. As a special exception, the window 3585of @code{minibuffer-scroll-window}. As a special exception, the window
3531configuration does not record the value of point in the selected window 3586configuration does not record the value of point in the selected window
3532for the current buffer. Also, the window configuration does not record 3587for the current buffer.
3533the 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
3536saved window configuration. If you want to record the layout of all 3590saved 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
3640file @file{winner.el} for some more operations on windows 3694file @file{winner.el} for some more operations on windows
3641configurations. 3695configurations.
3642 3696
3697 The objects returned by @code{current-window-configuration} die
3698together with the Emacs process. In order to store a window
3699configuration on disk and read it back in another Emacs session the
3700following two functions can be used.
3701
3702@defun window-state-get &optional window markers
3703This function returns the state of @var{window} as a Lisp object. The
3704argument @var{window} can be any window and defaults to the root window
3705of the selected frame.
3706
3707The optional argument @var{markers} non-@code{nil} means to use markers
3708for sampling positions like @code{window-point} or @code{window-start}.
3709This argument should be non-@code{nil} only if the value is used for
3710putting the state back in the same session since markers slow down
3711processing.
3712@end defun
3713
3714The value returned by @code{window-state-get} can be converted by using
3715one of the functions defined by Desktop Save Mode (@pxref{Desktop Save
3716Mode}) to an object that can be written to a file. Such objects can be
3717read back and converted to a Lisp object representing the state of the
3718window. That Lisp object can be used as argument for the following
3719function in order to restore the state window in another window.
3720
3721@defun window-state-put state &optional window ignore
3722This function puts the window state @var{state} into @var{window}. The
3723argument @var{state} should be the state of a window returned by an
3724earlier invocation of @code{window-state-get}, see above. The optional
3725argument @var{window} must specify a live window and defaults to the
3726selected one.
3727
3728The optional argument @var{ignore} non-@code{nil} means to ignore
3729minimum window sizes and fixed size restrictions. If @var{ignore}
3730equals @code{safe}, this means subwindows can get as small as one line
3731and/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
3647This sections describes how window parameters can be used to associate 3739This section describes how window parameters can be used to associate
3648additional information with windows. 3740additional information with windows.
3649 3741
3650@defun window-parameter window parameter 3742@defun window-parameter window parameter
3651This function returns @var{window}'s value for @var{parameter}. The 3743This function returns @var{window}'s value for @var{parameter}. The
3652default for @var{window} is the selected window. If @var{window} 3744default for @var{window} is the selected window. If @var{window} has no
3653has no setting for @var{parameter}, this function returns @code{nil}. 3745setting 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
3657This function returns all parameters of @var{window} and their values. 3749This function returns all parameters of @var{window} and their values.
3658The default for @var{window} is the selected window. The return value 3750The default for @var{window} is the selected window. The return value,
3659is an association list of elements of the form @code{(@var{parameter} 3751if 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
3666is the selected window. 3758is the selected window.
3667@end defun 3759@end defun
3668 3760
3669Currently, window parameters are not saved in window configurations and 3761Some functions, notably @code{delete-window},
3670consequently not restored by @code{set-window-configuration}. Hence, 3762@code{delete-other-windows} and @code{split-window} may behave specially
3671any change of a parameter introduced via @code{set-window-parameter} can 3763when their @var{window} argument has a parameter set. You can override
3672be undone only by invoking @code{set-window-parameter} for the same 3764such special behavior by binding the following variable to a
3673parameter again. Since @code{save-window-excursion} relies on window 3765non-@code{nil} value:
3674configurations (@pxref{Window Configurations}), window parameters are 3766
3675not saved and restored by that special form, either. 3767@defvar ignore-window-parameters
3768If this variable is non-@code{nil}, some standard functions do not
3769process window parameters. The functions currently affected by this are
3770@code{split-window}, @code{delete-window}, @code{delete-other-windows}
3771and @code{other-window}.
3772
3773An application can bind this variable to a non-@code{nil} value around
3774calls to these functions. If it does so, the application is fully
3775responsible for correctly assigning the parameters of all involved
3776windows when exiting that function.
3777@end defvar
3778
3779The following parameters are currently used by the window management
3780code.
3781
3782@table @asis
3783@item @code{delete-window}
3784This parameter affects the execution of @code{delete-window}
3785(@pxref{Deleting Windows}).
3786
3787@item @code{delete-other-windows}
3788This parameter affects the execution of @code{delete-other-windows}
3789(@pxref{Deleting Windows}).
3790
3791@item @code{split-window}
3792This parameter affects the execution of @code{split-window}
3793(@pxref{Splitting Windows}).
3794
3795@item @code{other-window}
3796This parameter affects the execution of @code{other-window}
3797(@pxref{Cyclic Window Ordering}).
3798
3799@item @code{no-other-window}
3800This parameter marks the window as not selectable by @code{other-window}
3801(@pxref{Cyclic Window Ordering}).
3802@end table
3803
3804In addition, the parameters @code{window-atom} and @code{window-side}
3805are reserved and should not be used by applications. The
3806@code{quit-restore} parameter tells how to proceed with a window when
3807the buffer it shows is no more needed. This parameter is installed by
3808the buffer display functions (@pxref{Choosing Window}) and consulted by
3809the 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