GNU bug report logs -
#16793
window-state-put needs a live window
Previous Next
Reported by: Juanma Barranquero <lekktu <at> gmail.com>
Date: Tue, 18 Feb 2014 16:21:02 UTC
Severity: normal
Found in version 24.3.50
Done: Juanma Barranquero <lekktu <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 16793 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> But I still think that getting a window-state for a window and putting
> it again into the same window should always be allowed, unless Martin
> has a good reason why that symmetry is a bad idea.
I tend to agree with you. But the obvious consequence is that the
WINDOW argument of `window-state-put' could then specify an internal
window that is not the root window of its frame. In this case plain
`delete-other-windows' would be the wrong action. I attach a patch.
martin
[window-state-put.diff (text/plain, inline)]
=== modified file 'lisp/window.el'
--- lisp/window.el 2014-02-10 01:34:22 +0000
+++ lisp/window.el 2014-02-18 18:59:17 +0000
@@ -5026,14 +5026,29 @@
"Put window state STATE into WINDOW.
STATE should be the state of a window returned by an earlier
invocation of `window-state-get'. Optional argument WINDOW must
-specify a live window and defaults to the selected one.
+specify a valid window and defaults to the selected one. If
+WINDOW is not live, delete all child windows of WINDOW before
+putting STATE.
Optional argument IGNORE non-nil means ignore minimum window
sizes and fixed size restrictions. IGNORE equal `safe' means
windows can get as small as `window-safe-min-height' and
`window-safe-min-width'."
(setq window-state-put-stale-windows nil)
- (setq window (window-normalize-window window t))
+ (setq window (window-normalize-window window))
+
+ (unless (window-live-p window)
+ (let ((root (frame-root-window)))
+ (if (eq window root)
+ (setq window (frame-first-window root))
+ (setq root window)
+ (setq window (catch 'live
+ (walk-window-subtree
+ (lambda (window)
+ (when (window-live-p window)))
+ root))))
+ (delete-other-windows-internal window root)))
+
(let* ((frame (window-frame window))
(head (car state))
;; We check here (1) whether the total sizes of root window of
This bug report was last modified 11 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.