diff options
| author | Martin Rudalics | 2012-01-16 10:34:41 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2012-01-16 10:34:41 +0100 |
| commit | 6a6ee00d123a940f5b8858e61a327cd9e183cb1a (patch) | |
| tree | 971207c682aa8a8cb903a4dedad2d8e6fcd86211 /doc | |
| parent | 97912defd376ad75ac582d073851a5a7a4d3cc12 (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 93 |
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 @@ | |||
| 1 | 2012-01-16 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * windows.texi (Window Configurations, Window Parameters): | ||
| 4 | Describe persistent window parameters. | ||
| 5 | |||
| 1 | 2011-12-27 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2011-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 |
| 3105 | This function returns a new object representing @var{frame}'s current | 3105 | This function returns a new object representing @var{frame}'s current |
| 3106 | window configuration. The default for @var{frame} is the selected | 3106 | window configuration. The default for @var{frame} is the selected |
| 3107 | frame. | 3107 | frame. This function saves copies of window parameters listed by the |
| 3108 | variable @code{window-persistent-parameters}, see @ref{Window | ||
| 3109 | Parameters} 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 |
| 3208 | together with the Emacs process. In order to store a window | 3210 | together with the Emacs process. In order to store a window |
| 3209 | configuration on disk and read it back in another Emacs session the | 3211 | configuration on disk and read it back in another Emacs session, the |
| 3210 | following two functions can be used. | 3212 | functions described next can be used. These functions are also useful |
| 3213 | to clone the state of a frame into an arbitrary live window | ||
| 3214 | (@code{set-window-configuration} effectively clones the windows of a | ||
| 3215 | frame 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 |
| 3213 | This function returns the state of @var{window} as a Lisp object. The | 3218 | This function returns the state of @var{window} as a Lisp object. The |
| 3214 | argument @var{window} can be any window and defaults to the root window | 3219 | argument @var{window} can be any window and defaults to the root window |
| 3215 | of the selected frame. | 3220 | of the selected frame. |
| 3216 | 3221 | ||
| 3217 | The optional argument @var{markers} non-@code{nil} means to use markers | 3222 | If the optional argument @var{ignore} is non-@code{nil}, this means to |
| 3218 | for sampling positions like @code{window-point} or @code{window-start}. | 3223 | not use markers for sampling positions like @code{window-point} or |
| 3219 | This 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 |
| 3220 | putting the state back in the same session since markers slow down | 3225 | state shall be written on disk and read back in another session. |
| 3221 | processing. | 3226 | |
| 3227 | The variable @code{window-persistent-parameters} specifies whether and | ||
| 3228 | which window parameters are saved by this function, see @ref{Window | ||
| 3229 | Parameters} for details. | ||
| 3222 | @end defun | 3230 | @end defun |
| 3223 | 3231 | ||
| 3224 | The value returned by @code{window-state-get} can be converted by using | 3232 | The value returned by @code{window-state-get} can be converted, using |
| 3225 | one of the functions defined by Desktop Save Mode (@pxref{Desktop Save | 3233 | one of the functions defined by Desktop Save Mode (@pxref{Desktop Save |
| 3226 | Mode}) to an object that can be written to a file. Such objects can be | 3234 | Mode}), to an object that can be written to a file. Such objects can be |
| 3227 | read back and converted to a Lisp object representing the state of the | 3235 | read back and converted to a Lisp object representing the state of the |
| 3228 | window. That Lisp object can be used as argument for the following | 3236 | window. That Lisp object can be used as argument for the following |
| 3229 | function in order to restore the state window in another window. | 3237 | function 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 | |||
| 3268 | is the selected window. | 3276 | is the selected window. |
| 3269 | @end defun | 3277 | @end defun |
| 3270 | 3278 | ||
| 3279 | By default, functions saving and restoring window configurations or the | ||
| 3280 | states of windows (@xref{Window Configurations}) do not care about | ||
| 3281 | window parameters. This means, that when you change the value of a | ||
| 3282 | parameter within the body of a @code{save-window-excursion}, the | ||
| 3283 | previous value is not restored upon exit of that macro. It also means | ||
| 3284 | that when you clone via @code{window-state-put} a window state saved | ||
| 3285 | earlier by @code{window-state-get}, the cloned windows come up with no | ||
| 3286 | parameters at all. The following variable allows to override the | ||
| 3287 | standard behavior. | ||
| 3288 | |||
| 3289 | @defvar window-persistent-parameters | ||
| 3290 | This variable is an alist specifying which parameters get saved by | ||
| 3291 | @code{current-window-configuration} and @code{window-state-get} and | ||
| 3292 | subsequently restored by @code{set-window-configuration} and | ||
| 3293 | @code{window-state-put}, see @ref{Window Configurations}. | ||
| 3294 | |||
| 3295 | The @sc{car} of each entry of this alist is the symbol specifying the | ||
| 3296 | parameter. The @sc{cdr} must be one of the following: | ||
| 3297 | |||
| 3298 | @table @asis | ||
| 3299 | @item @code{state} | ||
| 3300 | This value means the parameter is saved by @code{window-state-get} | ||
| 3301 | provided its @var{ignore} argument is @code{nil}. The function | ||
| 3302 | @code{current-window-configuration} does not save this parameter. | ||
| 3303 | |||
| 3304 | @item @code{nil} | ||
| 3305 | This value specifies that the parameter is saved by | ||
| 3306 | @code{current-window-configuration} and, provided its @var{ignore} | ||
| 3307 | argument is @code{nil}, by @code{window-state-get}. | ||
| 3308 | |||
| 3309 | @item @code{t} | ||
| 3310 | This means that the parameter is saved unconditionally by both | ||
| 3311 | @code{current-window-configuration} and @code{window-state-get}. This | ||
| 3312 | value should not be used for parameters whose values do not have a read | ||
| 3313 | syntax. Otherwise, invoking @code{window-state-put} in another session | ||
| 3314 | may fail with an @code{invalid-read-syntax} error. | ||
| 3315 | @end table | ||
| 3316 | |||
| 3317 | Parameters 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 | ||
| 3320 | alone by @code{set-window-configuration} respectively are not installed | ||
| 3321 | by @code{window-state-put}. | ||
| 3322 | @end defvar | ||
| 3323 | |||
| 3271 | Some functions, notably @code{delete-window}, | 3324 | Some 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 |
| 3273 | when their @var{window} argument has a parameter set. You can override | 3326 | when 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 | ||
| 3289 | The following parameters are currently used by the window management | 3342 | The following parameters are currently used by the window management |
| 3290 | code. | 3343 | code: |
| 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} |
| 3310 | This parameter marks the window as not selectable by @code{other-window} | 3363 | This 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} | ||
| 3367 | This parameter specifies the window this one has been cloned from and is | ||
| 3368 | installed by @code{window-state-get}, see @ref{Window Configurations}. | ||
| 3369 | |||
| 3370 | @item @code{quit-restore} | ||
| 3371 | This parameter tells how to proceed with a window when the buffer it | ||
| 3372 | shows is no more needed. It is installed by the buffer display | ||
| 3373 | functions (@pxref{Choosing Window}) and consulted by the function | ||
| 3374 | @code{quit-window} (@pxref{Quitting Windows}). | ||
| 3312 | @end table | 3375 | @end table |
| 3313 | 3376 | ||
| 3314 | In addition, the parameters @code{window-atom} and @code{window-side} | 3377 | In addition, the parameters @code{window-atom} and @code{window-side} |
| 3315 | are reserved and should not be used by applications. The | 3378 | are reserved and should not be used by applications. |
| 3316 | @code{quit-restore} parameter tells how to proceed with a window when | ||
| 3317 | the buffer it shows is no more needed. This parameter is installed by | ||
| 3318 | the buffer display functions (@pxref{Choosing Window}) and consulted by | ||
| 3319 | the function @code{quit-window} (@pxref{Quitting Windows}). | ||
| 3320 | 3379 | ||
| 3321 | 3380 | ||
| 3322 | @node Window Hooks | 3381 | @node Window Hooks |