aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2017-03-24 12:10:06 -0700
committerEric Abrahamsen2017-03-25 09:56:28 -0700
commit0a911b68eae3e295139609b1ad94b70a4d421f9b (patch)
tree278b3524b1ee5d0e548648eb1db2223ad025deae
parent501d07981ed1840ae72fe7dd599ab0b9f85b4a7f (diff)
downloademacs-0a911b68eae3e295139609b1ad94b70a4d421f9b.tar.gz
emacs-0a911b68eae3e295139609b1ad94b70a4d421f9b.zip
Expand manual section on quitting windows
* doc/lispref/windows.texi (Quitting Windows): Provide more information about the elements of the quit-restore window parameter, and how they affect the behavior of quit-restore-window.
-rw-r--r--doc/lispref/windows.texi108
1 files changed, 65 insertions, 43 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index a4f8400170e..6aa9591e09f 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2803,12 +2803,13 @@ put it in the selected window.
2803@section Window History 2803@section Window History
2804@cindex window history 2804@cindex window history
2805 2805
2806Each window remembers in a list the buffers it has previously displayed, 2806Each window remembers in a list the buffers it has previously
2807and the order in which these buffers were removed from it. This history 2807displayed, and the order in which these buffers were removed from it.
2808is used, for example, by @code{replace-buffer-in-windows} 2808This history is used, for example, by @code{replace-buffer-in-windows}
2809(@pxref{Buffers and Windows}). The list is automatically maintained by 2809(@pxref{Buffers and Windows}), and when quitting windows
2810Emacs, but you can use the following functions to explicitly inspect or 2810(@pxref{Quitting Windows}). The list is automatically maintained by
2811alter it: 2811Emacs, but you can use the following functions to explicitly inspect
2812or alter it:
2812 2813
2813@defun window-prev-buffers &optional window 2814@defun window-prev-buffers &optional window
2814This function returns a list specifying the previous contents of 2815This function returns a list specifying the previous contents of
@@ -2994,33 +2995,35 @@ described next to deal with the window and its buffer.
2994@end deffn 2995@end deffn
2995 2996
2996@defun quit-restore-window &optional window bury-or-kill 2997@defun quit-restore-window &optional window bury-or-kill
2997This function tries to restore the state of @var{window} that existed 2998This function handles @var{window} and its buffer after quitting. The
2998before its buffer was displayed in it. The optional argument 2999optional argument @var{window} must be a live window and defaults to
2999@var{window} must be a live window and defaults to the selected one. 3000the selected one. The function's behavior is determined by the four
3001elements of the @code{quit-restore} window parameter (@pxref{Window
3002Parameters}), which is set to nil afterwards.
3003
3004The window is deleted entirely if: 1) the first element of the
3005@code{quit-restore} parameter is one of 'window or 'frame, 2) the
3006window has no history of previously-displayed buffers, and 3) the
3007displayed buffer matches the one in the fourth element of the
3008@code{quit-restore} parameter. If @var{window} is the
3009only window on its frame and there are other frames on the frame's
3010terminal, the value of the optional argument @var{bury-or-kill}
3011determines how to proceed with the window. If @var{bury-or-kill}
3012equals @code{kill}, the frame is deleted unconditionally. Otherwise,
3013the fate of the frame is determined by calling
3014@code{frame-auto-hide-function} (see below) with that frame as sole
3015argument.
3000 3016
3001If @var{window} was created specially for displaying its buffer, this 3017If the third element of the @code{quit-restore} parameter is a list of
3002function deletes @var{window} provided its frame contains at least one 3018buffer, window start (@pxref{Window Start and End}), and point
3003other live window. If @var{window} is the only window on its frame and 3019(@pxref{Window Point}), and that buffer is still live, the buffer will
3004there are other frames on the frame's terminal, the value of the 3020be displayed, and start and point set accordingly. If, in addition,
3005optional argument @var{bury-or-kill} determines how to proceed with the
3006window. If @var{bury-or-kill} equals @code{kill}, the frame is deleted
3007unconditionally. Otherwise, the fate of the frame is determined by
3008calling @code{frame-auto-hide-function} (see below) with that frame as
3009sole argument.
3010
3011Otherwise, this function tries to redisplay the buffer previously shown
3012in @var{window}. It also tries to restore the window start
3013(@pxref{Window Start and End}) and point (@pxref{Window Point})
3014positions of the previously shown buffer. If, in addition,
3015@var{window}'s buffer was temporarily resized, this function will also 3021@var{window}'s buffer was temporarily resized, this function will also
3016try to restore the original height of @var{window}. 3022try to restore the original height of @var{window}.
3017 3023
3018The cases described so far require that the buffer shown in @var{window} 3024Otherwise, if @var{window} was previously used for displaying other
3019is still the buffer displayed by the last buffer display function for 3025buffers (@pxref{Window History}), the most recent buffer in that
3020this window. If another buffer has been shown in the meantime, or the 3026history will be displayed.
3021buffer previously shown no longer exists, this function calls
3022@code{switch-to-prev-buffer} (@pxref{Window History}) to show some other
3023buffer instead.
3024 3027
3025The optional argument @var{bury-or-kill} specifies how to deal with 3028The optional argument @var{bury-or-kill} specifies how to deal with
3026@var{window}'s buffer. The following values are handled: 3029@var{window}'s buffer. The following values are handled:
@@ -3048,9 +3051,24 @@ buffer again without killing the buffer.
3048This means to kill @var{window}'s buffer. 3051This means to kill @var{window}'s buffer.
3049@end table 3052@end table
3050 3053
3051@code{quit-restore-window} bases its decisions on information stored in 3054Typically, the display routines run by @code{display-buffer} will set
3052@var{window}'s @code{quit-restore} window parameter (@pxref{Window 3055the @code{quit-restore} window parameter correctly. It's also
3053Parameters}), and resets that parameter to @code{nil} after it's done. 3056possible to set it manually, using the following code for displaying
3057@var{buffer} in @var{window}:
3058
3059@example
3060@group
3061(display-buffer-record-window type window buffer)
3062
3063(set-window-buffer window buffer)
3064
3065(set-window-prev-buffers window nil)
3066@end group
3067@end example
3068
3069Setting the window history to nil ensures that a future call to
3070@code{quit-window} can delete the window altogether.
3071
3054@end defun 3072@end defun
3055 3073
3056The following option specifies how to deal with a frame containing just 3074The following option specifies how to deal with a frame containing just
@@ -4845,25 +4863,32 @@ This parameter is installed by the buffer display functions
4845(@pxref{Choosing Window}) and consulted by @code{quit-restore-window} 4863(@pxref{Choosing Window}) and consulted by @code{quit-restore-window}
4846(@pxref{Quitting Windows}). It contains four elements: 4864(@pxref{Quitting Windows}). It contains four elements:
4847 4865
4848The first element is one of the symbols @code{window}, meaning that the 4866The first element is one of the symbols @code{window}, meaning that
4849window has been specially created by @code{display-buffer}; @code{frame}, 4867the window has been specially created by @code{display-buffer};
4850a separate frame has been created; @code{same}, the window has 4868@code{frame}, a separate frame has been created; @code{same}, the
4851displayed the same buffer before; or @code{other}, the window showed 4869window has only ever displayed this buffer; or @code{other}, the
4852another buffer before. 4870window showed another buffer before. @code{frame} and @code{window}
4871affect how the window is quit, while @code{same} and @code{other}
4872affect the redisplay of buffers previously shown in this window.
4853 4873
4854The second element is either one of the symbols @code{window} or 4874The second element is either one of the symbols @code{window} or
4855@code{frame}, or a list whose elements are the buffer shown in the 4875@code{frame}, or a list whose elements are the buffer shown in the
4856window before, that buffer's window start and window point positions, 4876window before, that buffer's window start and window point positions,
4857and the window's height at that time. 4877and the window's height at that time. If that buffer is still live
4878when the window is quit, then the function @code{quit-restore-window}
4879reuses the window to display the buffer.
4858 4880
4859The third element is the window selected at the time the parameter was 4881The third element is the window selected at the time the parameter was
4860created. The function @code{quit-restore-window} tries to reselect that 4882created. If @code{quit-restore-window} deletes the window passed to
4861window when it deletes the window passed to it as argument. 4883it as argument, it then tries to reselect this window.
4862 4884
4863The fourth element is the buffer whose display caused the creation of 4885The fourth element is the buffer whose display caused the creation of
4864this parameter. @code{quit-restore-window} deletes the specified window 4886this parameter. @code{quit-restore-window} deletes the specified window
4865only if it still shows that buffer. 4887only if it still shows that buffer.
4866 4888
4889See the description of @code{quit-restore-window} in @ref{Quitting
4890Windows} for details.
4891
4867@item @code{window-side} @code{window-slot} 4892@item @code{window-side} @code{window-slot}
4868These parameters are used for implementing side windows (@pxref{Side 4893These parameters are used for implementing side windows (@pxref{Side
4869Windows}). 4894Windows}).
@@ -4894,9 +4919,6 @@ applications. It might be replaced by an improved solution in future
4894versions of Emacs. 4919versions of Emacs.
4895@end table 4920@end table
4896 4921
4897The @code{window-atom} parameter is used for implementing atomic windows.
4898
4899
4900@node Window Hooks 4922@node Window Hooks
4901@section Hooks for Window Scrolling and Changes 4923@section Hooks for Window Scrolling and Changes
4902@cindex hooks for window operations 4924@cindex hooks for window operations