aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMartin Rudalics2012-01-16 10:34:41 +0100
committerMartin Rudalics2012-01-16 10:34:41 +0100
commit6a6ee00d123a940f5b8858e61a327cd9e183cb1a (patch)
tree971207c682aa8a8cb903a4dedad2d8e6fcd86211 /doc
parent97912defd376ad75ac582d073851a5a7a4d3cc12 (diff)
downloademacs-6a6ee00d123a940f5b8858e61a327cd9e183cb1a.tar.gz
emacs-6a6ee00d123a940f5b8858e61a327cd9e183cb1a.zip
Provide persistent window parameters.
* window.c (Vwindow_persistent_parameters): New variable. (Fset_window_configuration, save_window_save): Handle persistent window parameters. * window.el (window-state-ignored-parameters): Remove variable. (window--state-get-1): Rename argument MARKERS to IGNORE. Handle persistent window parameters. Make copy of clone-of parameter only if requested. (Bug#10348) (window--state-put-2): Install a window parameter only if it has a non-nil value or an existing parameter shall be overwritten. * windows.texi (Window Configurations, Window Parameters): Describe persistent window parameters.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/windows.texi93
2 files changed, 81 insertions, 17 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index f69eeeaadd4..8304554ace6 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12012-01-16 Martin Rudalics <rudalics@gmx.at>
2
3 * windows.texi (Window Configurations, Window Parameters):
4 Describe persistent window parameters.
5
12011-12-27 Stefan Monnier <monnier@iro.umontreal.ca> 62011-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * variables.texi (Creating Buffer-Local): Warn against misuses of 8 * variables.texi (Creating Buffer-Local): Warn against misuses of
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 85e1b9340fc..5f4e530089d 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -3104,7 +3104,9 @@ window configuration; see @ref{Frame Configurations}.
3104@defun current-window-configuration &optional frame 3104@defun current-window-configuration &optional frame
3105This function returns a new object representing @var{frame}'s current 3105This function returns a new object representing @var{frame}'s current
3106window configuration. The default for @var{frame} is the selected 3106window configuration. The default for @var{frame} is the selected
3107frame. 3107frame. This function saves copies of window parameters listed by the
3108variable @code{window-persistent-parameters}, see @ref{Window
3109Parameters} for details.
3108@end defun 3110@end defun
3109 3111
3110@defun set-window-configuration configuration 3112@defun set-window-configuration configuration
@@ -3206,24 +3208,30 @@ configurations.
3206 3208
3207 The objects returned by @code{current-window-configuration} die 3209 The objects returned by @code{current-window-configuration} die
3208together with the Emacs process. In order to store a window 3210together with the Emacs process. In order to store a window
3209configuration on disk and read it back in another Emacs session the 3211configuration on disk and read it back in another Emacs session, the
3210following two functions can be used. 3212functions described next can be used. These functions are also useful
3213to clone the state of a frame into an arbitrary live window
3214(@code{set-window-configuration} effectively clones the windows of a
3215frame into the root window of that very frame only).
3211 3216
3212@defun window-state-get &optional window markers 3217@defun window-state-get &optional window ignore
3213This function returns the state of @var{window} as a Lisp object. The 3218This function returns the state of @var{window} as a Lisp object. The
3214argument @var{window} can be any window and defaults to the root window 3219argument @var{window} can be any window and defaults to the root window
3215of the selected frame. 3220of the selected frame.
3216 3221
3217The optional argument @var{markers} non-@code{nil} means to use markers 3222If the optional argument @var{ignore} is non-@code{nil}, this means to
3218for sampling positions like @code{window-point} or @code{window-start}. 3223not use markers for sampling positions like @code{window-point} or
3219This argument should be non-@code{nil} only if the value is used for 3224@code{window-start}. This argument should be non-@code{nil} when the
3220putting the state back in the same session since markers slow down 3225state shall be written on disk and read back in another session.
3221processing. 3226
3227The variable @code{window-persistent-parameters} specifies whether and
3228which window parameters are saved by this function, see @ref{Window
3229Parameters} for details.
3222@end defun 3230@end defun
3223 3231
3224The value returned by @code{window-state-get} can be converted by using 3232The value returned by @code{window-state-get} can be converted, using
3225one of the functions defined by Desktop Save Mode (@pxref{Desktop Save 3233one of the functions defined by Desktop Save Mode (@pxref{Desktop Save
3226Mode}) to an object that can be written to a file. Such objects can be 3234Mode}), to an object that can be written to a file. Such objects can be
3227read back and converted to a Lisp object representing the state of the 3235read back and converted to a Lisp object representing the state of the
3228window. That Lisp object can be used as argument for the following 3236window. That Lisp object can be used as argument for the following
3229function in order to restore the state window in another window. 3237function in order to restore the state window in another window.
@@ -3268,6 +3276,51 @@ This function sets @var{window}'s value of @var{parameter} to
3268is the selected window. 3276is the selected window.
3269@end defun 3277@end defun
3270 3278
3279By default, functions saving and restoring window configurations or the
3280states of windows (@xref{Window Configurations}) do not care about
3281window parameters. This means, that when you change the value of a
3282parameter within the body of a @code{save-window-excursion}, the
3283previous value is not restored upon exit of that macro. It also means
3284that when you clone via @code{window-state-put} a window state saved
3285earlier by @code{window-state-get}, the cloned windows come up with no
3286parameters at all. The following variable allows to override the
3287standard behavior.
3288
3289@defvar window-persistent-parameters
3290This variable is an alist specifying which parameters get saved by
3291@code{current-window-configuration} and @code{window-state-get} and
3292subsequently restored by @code{set-window-configuration} and
3293@code{window-state-put}, see @ref{Window Configurations}.
3294
3295The @sc{car} of each entry of this alist is the symbol specifying the
3296parameter. The @sc{cdr} must be one of the following:
3297
3298@table @asis
3299@item @code{state}
3300This value means the parameter is saved by @code{window-state-get}
3301provided its @var{ignore} argument is @code{nil}. The function
3302@code{current-window-configuration} does not save this parameter.
3303
3304@item @code{nil}
3305This value specifies that the parameter is saved by
3306@code{current-window-configuration} and, provided its @var{ignore}
3307argument is @code{nil}, by @code{window-state-get}.
3308
3309@item @code{t}
3310This means that the parameter is saved unconditionally by both
3311@code{current-window-configuration} and @code{window-state-get}. This
3312value should not be used for parameters whose values do not have a read
3313syntax. Otherwise, invoking @code{window-state-put} in another session
3314may fail with an @code{invalid-read-syntax} error.
3315@end table
3316
3317Parameters that have been saved are restored to their previous values by
3318@code{set-window-configuration} respectively are installed by
3319@code{window-state-put}. Parameters that have not been saved are left
3320alone by @code{set-window-configuration} respectively are not installed
3321by @code{window-state-put}.
3322@end defvar
3323
3271Some functions, notably @code{delete-window}, 3324Some functions, notably @code{delete-window},
3272@code{delete-other-windows} and @code{split-window} may behave specially 3325@code{delete-other-windows} and @code{split-window} may behave specially
3273when their @var{window} argument has a parameter set. You can override 3326when their @var{window} argument has a parameter set. You can override
@@ -3287,7 +3340,7 @@ windows when exiting that function.
3287@end defvar 3340@end defvar
3288 3341
3289The following parameters are currently used by the window management 3342The following parameters are currently used by the window management
3290code. 3343code:
3291 3344
3292@table @asis 3345@table @asis
3293@item @code{delete-window} 3346@item @code{delete-window}
@@ -3309,14 +3362,20 @@ This parameter affects the execution of @code{other-window}
3309@item @code{no-other-window} 3362@item @code{no-other-window}
3310This parameter marks the window as not selectable by @code{other-window} 3363This parameter marks the window as not selectable by @code{other-window}
3311(@pxref{Cyclic Window Ordering}). 3364(@pxref{Cyclic Window Ordering}).
3365
3366@item @code{clone-of}
3367This parameter specifies the window this one has been cloned from and is
3368installed by @code{window-state-get}, see @ref{Window Configurations}.
3369
3370@item @code{quit-restore}
3371This parameter tells how to proceed with a window when the buffer it
3372shows is no more needed. It is installed by the buffer display
3373functions (@pxref{Choosing Window}) and consulted by the function
3374@code{quit-window} (@pxref{Quitting Windows}).
3312@end table 3375@end table
3313 3376
3314In addition, the parameters @code{window-atom} and @code{window-side} 3377In addition, the parameters @code{window-atom} and @code{window-side}
3315are reserved and should not be used by applications. The 3378are reserved and should not be used by applications.
3316@code{quit-restore} parameter tells how to proceed with a window when
3317the buffer it shows is no more needed. This parameter is installed by
3318the buffer display functions (@pxref{Choosing Window}) and consulted by
3319the function @code{quit-window} (@pxref{Quitting Windows}).
3320 3379
3321 3380
3322@node Window Hooks 3381@node Window Hooks