[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106892: Fix handling of persistent w
From: |
martin rudalics |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106892: Fix handling of persistent window parameters. |
Date: |
Thu, 19 Jan 2012 11:38:31 +0100 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106892
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2012-01-19 11:38:31 +0100
message:
Fix handling of persistent window parameters.
* window.c (save_window_save, Fcurrent_window_configuration)
(Vwindow_persistent_parameters): Do not use Qstate. Rewrite
doc-strings.
* window.el (window--state-get-1, window-state-get): Do not use
special state value for window-persistent-parameters. Rename
argument IGNORE to WRITABLE. Rewrite doc-string.
(window--state-put-2): Reset all window parameters to nil before
assigning values of persistent parameters.
* windows.texi (Window Configurations): Rewrite references to
persistent window parameters.
(Window Parameters): Fix description of persistent window
parameters.
modified:
doc/lispref/ChangeLog
doc/lispref/windows.texi
lisp/ChangeLog
lisp/window.el
src/ChangeLog
src/window.c
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog 2012-01-19 07:21:25 +0000
+++ b/doc/lispref/ChangeLog 2012-01-19 10:38:31 +0000
@@ -1,3 +1,10 @@
+2012-01-19 Martin Rudalics <address@hidden>
+
+ * windows.texi (Window Configurations): Rewrite references to
+ persistent window parameters.
+ (Window Parameters): Fix description of persistent window
+ parameters.
+
2012-01-16 Juanma Barranquero <address@hidden>
* windows.texi (Window Parameters): Use @pxref.
=== modified file 'doc/lispref/windows.texi'
--- a/doc/lispref/windows.texi 2012-01-19 07:21:25 +0000
+++ b/doc/lispref/windows.texi 2012-01-19 10:38:31 +0000
@@ -3104,9 +3104,9 @@
@defun current-window-configuration &optional frame
This function returns a new object representing @var{frame}'s current
window configuration. The default for @var{frame} is the selected
-frame. This function saves copies of window parameters listed by the
-variable @code{window-persistent-parameters}, see @ref{Window
-Parameters} for details.
+frame. The variable @code{window-persistent-parameters} specifies
+whether and which window parameters are saved by this function, see
address@hidden Parameters} for details.
@end defun
@defun set-window-configuration configuration
@@ -3214,27 +3214,25 @@
(@code{set-window-configuration} effectively clones the windows of a
frame into the root window of that very frame only).
address@hidden window-state-get &optional window ignore
address@hidden window-state-get &optional window writable
This function returns the state of @var{window} as a Lisp object. The
argument @var{window} can be any window and defaults to the root window
of the selected frame.
-If the optional argument @var{ignore} is address@hidden, this means to
+If the optional argument @var{writable} is address@hidden, this means to
not use markers for sampling positions like @code{window-point} or
@code{window-start}. This argument should be address@hidden when the
-state shall be written on disk and read back in another session.
+state shall be written to disk and read back in another session.
-The variable @code{window-persistent-parameters} specifies whether and
-which window parameters are saved by this function, see @ref{Window
-Parameters} for details.
+Together, the argument @var{writable} and the variable
address@hidden specify which window parameters are
+saved by this function, see @ref{Window Parameters} for details.
@end defun
-The value returned by @code{window-state-get} can be converted, using
-one of the functions defined by Desktop Save Mode (@pxref{Desktop Save
-Mode}), to an object that can be written to a file. Such objects can be
-read back and converted to a Lisp object representing the state of the
-window. That Lisp object can be used as argument for the following
-function in order to restore the state window in another window.
+The value returned by @code{window-state-get} can be used in the same
+session to make a clone of a window in another window. It can be also
+written to disk and read back in another session. In either case, use
+the function described next to restore the state of the window.
@defun window-state-put state &optional window ignore
This function puts the window state @var{state} into @var{window}. The
@@ -3281,10 +3279,10 @@
window parameters. This means, that when you change the value of a
parameter within the body of a @code{save-window-excursion}, the
previous value is not restored upon exit of that macro. It also means
-that when you clone via @code{window-state-put} a window state saved
-earlier by @code{window-state-get}, the cloned windows come up with no
-parameters at all. The following variable allows to override the
-standard behavior.
+that when you restore via @code{window-state-put} a window state saved
+earlier by @code{window-state-get}, all cloned windows have their
+parameters reset to @code{nil}. The following variable allows to
+override the standard behavior.
@defvar window-persistent-parameters
This variable is an alist specifying which parameters get saved by
@@ -3293,32 +3291,25 @@
@code{window-state-put}, see @ref{Window Configurations}.
The @sc{car} of each entry of this alist is the symbol specifying the
-parameter. The @sc{cdr} must be one of the following:
+parameter. The @sc{cdr} should be one of the following:
@table @asis
address@hidden @code{state}
-This value means the parameter is saved by @code{window-state-get}
-provided its @var{ignore} argument is @code{nil}. The function
address@hidden does not save this parameter.
-
@item @code{nil}
+This value means the parameter is neither saved by
address@hidden nor by @code{current-window-configuration}.
+
address@hidden @code{t}
This value specifies that the parameter is saved by
address@hidden and, provided its @var{ignore}
address@hidden and, provided its @var{writable}
argument is @code{nil}, by @code{window-state-get}.
address@hidden @code{t}
address@hidden @code{writable}
This means that the parameter is saved unconditionally by both
@code{current-window-configuration} and @code{window-state-get}. This
value should not be used for parameters whose values do not have a read
syntax. Otherwise, invoking @code{window-state-put} in another session
may fail with an @code{invalid-read-syntax} error.
@end table
-
-Parameters that have been saved are restored to their previous values by
address@hidden respectively are installed by
address@hidden Parameters that have not been saved are left
-alone by @code{set-window-configuration} respectively are not installed
-by @code{window-state-put}.
@end defvar
Some functions, notably @code{delete-window},
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-01-19 07:21:25 +0000
+++ b/lisp/ChangeLog 2012-01-19 10:38:31 +0000
@@ -1,3 +1,11 @@
+2012-01-19 Martin Rudalics <address@hidden>
+
+ * window.el (window--state-get-1, window-state-get): Do not use
+ special state value for window-persistent-parameters. Rename
+ argument IGNORE to WRITABLE. Rewrite doc-string.
+ (window--state-put-2): Reset all window parameters to nil before
+ assigning values of persistent parameters.
+
2012-01-18 Alan Mackenzie <address@hidden>
Eliminate sluggishness and hangs in fontification of "semicolon
=== modified file 'lisp/window.el'
--- a/lisp/window.el 2012-01-19 07:21:25 +0000
+++ b/lisp/window.el 2012-01-19 10:38:31 +0000
@@ -3568,7 +3568,7 @@
))
;;; Window states, how to get them and how to put them in a window.
-(defun window--state-get-1 (window &optional ignore)
+(defun window--state-get-1 (window &optional writable)
"Helper function for `window-state-get'."
(let* ((type
(cond
@@ -3585,29 +3585,22 @@
(normal-height . ,(window-normal-size window))
(normal-width . ,(window-normal-size window t))
(combination-limit . ,(window-combination-limit window))
- ,@(let (list)
- ;; Make copies of persistent window parameters whose cdr
- ;; is either t or, when IGNORE is non-nil, is either nil
- ;; or `state'.
- (dolist (pers window-persistent-parameters)
- (when (and (consp pers)
- (or (eq (cdr pers) t)
- (and (memq (cdr pers) '(state nil))
- (not ignore))))
- (let ((par (assq (car pers) (window-parameters window))))
- (setq list (cons (cons (car pers) (when par (cdr par)))
- list)))))
- ;; Save `clone-of' parameter unless IGNORE or
- ;; `window-persistent-parameters' prevail.
- (when (and (not (assq 'clone-of (window-parameters window)))
- (let ((clone-of
- (assq 'clone-of
- window-persistent-parameters)))
- (when clone-of
- (if ignore
- (eq (cdr clone-of) t)
- (memq (cdr clone-of) '(state nil))))))
- (setq list (cons (cons 'clone-of window) list)))
+ ,@(let ((parameters (window-parameters window))
+ list)
+ ;; Make copies of those window parameters whose
+ ;; persistence property is `writable' if WRITABLE is
+ ;; non-nil and non-nil if WRITABLE is nil.
+ (dolist (par parameters)
+ (let ((pers (cdr (assq (car par)
+ window-persistent-parameters))))
+ (when (and pers (or (not writable) (eq pers 'writable)))
+ (setq list (cons (cons (car par) (cdr par)) list)))))
+ ;; Add `clone-of' parameter if necessary.
+ (let ((pers (cdr (assq 'clone-of
+ window-persistent-parameters))))
+ (when (and pers (or (not writable) (eq pers 'writable))
+ (not (assq 'clone-of list)))
+ (setq list (cons (cons 'clone-of window) list))))
(when list
`((parameters . ,list))))
,@(when buffer
@@ -3628,31 +3621,34 @@
(scroll-bars . ,(window-scroll-bars window))
(vscroll . ,(window-vscroll window))
(dedicated . ,(window-dedicated-p window))
- (point . ,(if ignore point (copy-marker point)))
- (start . ,(if ignore start (copy-marker start)))
+ (point . ,(if writable point (copy-marker point)))
+ (start . ,(if writable start (copy-marker start)))
,@(when mark
- `((mark . ,(if ignore
+ `((mark . ,(if writable
mark (copy-marker mark))))))))))))
(tail
(when (memq type '(vc hc))
(let (list)
(setq window (window-child window))
(while window
- (setq list (cons (window--state-get-1 window ignore) list))
+ (setq list (cons (window--state-get-1 window writable) list))
(setq window (window-right window)))
(nreverse list)))))
(append head tail)))
-(defun window-state-get (&optional window ignore)
+(defun window-state-get (&optional window writable)
"Return state of WINDOW as a Lisp object.
WINDOW can be any window and defaults to the root window of the
selected frame.
-Optional argument IGNORE non-nil means do not use markers for
-sampling positions like `window-point' or `window-start' and do
-not record parameters unless `window-persistent-parameters'
-requests it. IGNORE should be non-nil when the return value
-shall be written to a file and read back in another session.
+Optional argument WRITABLE non-nil means do not use markers for
+sampling `window-point' and `window-start'. Together, WRITABLE
+and the variable `window-persistent-parameters' specify which
+window parameters are saved by this function. WRITABLE should be
+non-nil when the return value shall be written to a file and read
+back in another session. Otherwise, an application may run into
+an `invalid-read-syntax' error while attempting to read back the
+value from file.
The return value can be used as argument for `window-state-put'
to put the state recorded here into an arbitrary window. The
@@ -3678,7 +3674,7 @@
;; These are probably not needed.
,@(when (window-size-fixed-p window) `((fixed-height . t)))
,@(when (window-size-fixed-p window t) `((fixed-width . t))))
- (window--state-get-1 window ignore)))
+ (window--state-get-1 window writable)))
(defvar window-state-put-list nil
"Helper variable for `window-state-put'.")
@@ -3757,15 +3753,13 @@
(state (cdr (assq 'buffer item))))
(when combination-limit
(set-window-combination-limit window combination-limit))
- ;; Assign saved window parameters. If a parameter's value is nil,
- ;; don't assign it unless the new window has it set already (which
- ;; shouldn't happen unless some `window-configuration-change-hook'
- ;; function installed it).
+ ;; Reset window's parameters and assign saved ones (we might want
+ ;; a `remove-window-parameters' function here).
+ (dolist (parameter (window-parameters window))
+ (set-window-parameter window (car parameter) nil))
(when parameters
(dolist (parameter parameters)
- (when (or (cdr parameter)
- (window-parameter window (car parameter)))
- (set-window-parameter window (car parameter) (cdr parameter)))))
+ (set-window-parameter window (car parameter) (cdr parameter))))
;; Process buffer related state.
(when state
;; We don't want to raise an error here so we create a buffer if
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-01-19 07:21:25 +0000
+++ b/src/ChangeLog 2012-01-19 10:38:31 +0000
@@ -1,3 +1,9 @@
+2012-01-19 Martin Rudalics <address@hidden>
+
+ * window.c (save_window_save, Fcurrent_window_configuration)
+ (Vwindow_persistent_parameters): Do not use Qstate. Rewrite
+ doc-strings.
+
2012-01-19 Kenichi Handa <address@hidden>
* character.c (char_width): New function.
=== modified file 'src/window.c'
--- a/src/window.c 2012-01-19 07:21:25 +0000
+++ b/src/window.c 2012-01-19 10:38:31 +0000
@@ -57,7 +57,7 @@
static Lisp_Object Qwindow_resize_root_window,
Qwindow_resize_root_window_vertically;
static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
static Lisp_Object Qsafe, Qabove, Qbelow;
-static Lisp_Object Qauto_buffer_name, Qclone_of, Qstate;
+static Lisp_Object Qauto_buffer_name, Qclone_of;
static int displayed_window_lines (struct window *);
static struct window *decode_window (Lisp_Object);
@@ -5889,9 +5889,8 @@
tem = XCDR (tem))
{
pers = XCAR (tem);
- /* Save values for persistent window parameters whose cdr
- is either nil or t. */
- if (CONSP (pers) && (NILP (XCDR (pers)) || EQ (XCDR (pers), Qt)))
+ /* Save values for persistent window parameters. */
+ if (CONSP (pers) && !NILP (XCDR (pers)))
{
par = Fassq (XCAR (pers), w->window_parameters);
if (NILP (par))
@@ -5966,7 +5965,9 @@
point and mark. An exception is made for point in the current buffer:
its value is -not- saved.
This also records the currently selected frame, and FRAME's focus
-redirection (see `redirect-frame-focus'). */)
+redirection (see `redirect-frame-focus'). The variable
+`window-persistent-parameters' specifies which window parameters are
+saved by this function. */)
(Lisp_Object frame)
{
register Lisp_Object tem;
@@ -6504,7 +6505,6 @@
DEFSYM (Qbelow, "below");
DEFSYM (Qauto_buffer_name, "auto-buffer-name");
DEFSYM (Qclone_of, "clone-of");
- DEFSYM (Qstate, "state");
staticpro (&Vwindow_list);
@@ -6616,28 +6616,28 @@
DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters,
doc: /* Alist of persistent window parameters.
-Parameters in this list are saved by `current-window-configuration' and
-`window-state-get' and subsequently restored to their previous values by
-`set-window-configuration' and `window-state-put'.
+This alist specifies which window parameters shall get saved by
+`current-window-configuration' and `window-state-get' and subsequently
+restored to their previous values by `set-window-configuration' and
+`window-state-put'.
The car of each entry of this alist is the symbol specifying the
parameter. The cdr is one of the following:
-The symbol `state' means the parameter is saved by `window-state-get'
-provided its IGNORE argument is nil. `current-window-configuration'
-does not save this parameter.
-
-nil means the parameter is saved by `current-window-configuration' and,
-provided its IGNORE argument is nil, by `window-state-get'.
-
-t means the parameter is saved unconditionally by both
-`current-window-configuration' and `window-state-get'. Parameters
-without read syntax (like windows or frames) should not use that.
+nil means the parameter is neither saved by `window-state-get' nor by
+`current-window-configuration'.
+
+t means the parameter is saved by `current-window-configuration' and,
+provided its WRITABLE argument is nil, by `window-state-get'.
+
+The symbol `writable' means the parameter is saved unconditionally by
+both `current-window-configuration' and `window-state-get'. Do not use
+this value for parameters without read syntax (like windows or frames).
Parameters not saved by `current-window-configuration' or
`window-state-get' are left alone by `set-window-configuration'
respectively are not installed by `window-state-put'. */);
- Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qstate));
+ Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qt));
defsubr (&Sselected_window);
defsubr (&Sminibuffer_window);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106892: Fix handling of persistent window parameters.,
martin rudalics <=