Commit c089653d authored by Martin Rudalics's avatar Martin Rudalics

In window--state-put-2 don't process buffer state when buffer doesn't exist (Bug#15382).

* window.el (window--state-put-2): Don't process buffer state
when buffer doesn't exist any more (Bug#15382).
parent 820a4cbe
2013-09-15 Martin Rudalics <rudalics@gmx.at>
* window.el (window--state-put-2): Don't process buffer state
when buffer doesn't exist any more (Bug#15382).
2013-09-15 Glenn Morris <rgm@gnu.org>
* eshell/em-unix.el (eshell/rm):
......
......@@ -4464,62 +4464,66 @@ value can be also stored on disk and read back in a new session."
(set-window-parameter window (car parameter) (cdr parameter))))
;; Process buffer related state.
(when state
;; We don't want to raise an error in case the buffer does not
;; exist anymore, so we switch to a previous one and save the
;; window with the intention of deleting it later if possible.
(let ((buffer (get-buffer (car state))))
(if buffer
(set-window-buffer window buffer)
(with-current-buffer buffer
(set-window-buffer window buffer)
(set-window-hscroll window (cdr (assq 'hscroll state)))
(apply 'set-window-fringes
(cons window (cdr (assq 'fringes state))))
(let ((margins (cdr (assq 'margins state))))
(set-window-margins window (car margins) (cdr margins)))
(let ((scroll-bars (cdr (assq 'scroll-bars state))))
(set-window-scroll-bars
window (car scroll-bars) (nth 2 scroll-bars)
(nth 3 scroll-bars)))
(set-window-vscroll window (cdr (assq 'vscroll state)))
;; Adjust vertically.
(if (memq window-size-fixed '(t height))
;; A fixed height window, try to restore the
;; original size.
(let ((delta (- (cdr (assq 'total-height item))
(window-total-height window)))
window-size-fixed)
(when (window-resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not high enough.
(let* ((min-size (window-min-size window nil ignore))
(delta (- min-size (window-total-size window))))
(when (and (> delta 0)
(window-resizable-p window delta nil ignore))
(window-resize window delta nil ignore))))
;; Adjust horizontally.
(if (memq window-size-fixed '(t width))
;; A fixed width window, try to restore the original
;; size.
(let ((delta (- (cdr (assq 'total-width item))
(window-total-width window)))
window-size-fixed)
(when (window-resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not wide enough.
(let* ((min-size (window-min-size window t ignore))
(delta (- min-size (window-total-size window t))))
(when (and (> delta 0)
(window-resizable-p window delta t ignore))
(window-resize window delta t ignore))))
;; Set dedicated status.
(set-window-dedicated-p window (cdr (assq 'dedicated state)))
;; Install positions (maybe we should do this after all
;; windows have been created and sized).
(ignore-errors
(set-window-start window (cdr (assq 'start state)))
(set-window-point window (cdr (assq 'point state))))
;; Select window if it's the selected one.
(when (cdr (assq 'selected state))
(select-window window)))
;; We don't want to raise an error in case the buffer does
;; not exist anymore, so we switch to a previous one and
;; save the window with the intention of deleting it later
;; if possible.
(switch-to-prev-buffer window)
(push window window-state-put-stale-windows)))
(with-current-buffer (window-buffer window)
(set-window-hscroll window (cdr (assq 'hscroll state)))
(apply 'set-window-fringes
(cons window (cdr (assq 'fringes state))))
(let ((margins (cdr (assq 'margins state))))
(set-window-margins window (car margins) (cdr margins)))
(let ((scroll-bars (cdr (assq 'scroll-bars state))))
(set-window-scroll-bars
window (car scroll-bars) (nth 2 scroll-bars) (nth 3 scroll-bars)))
(set-window-vscroll window (cdr (assq 'vscroll state)))
;; Adjust vertically.
(if (memq window-size-fixed '(t height))
;; A fixed height window, try to restore the original size.
(let ((delta (- (cdr (assq 'total-height item))
(window-total-height window)))
window-size-fixed)
(when (window-resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not high enough.
(let* ((min-size (window-min-size window nil ignore))
(delta (- min-size (window-total-size window))))
(when (and (> delta 0)
(window-resizable-p window delta nil ignore))
(window-resize window delta nil ignore))))
;; Adjust horizontally.
(if (memq window-size-fixed '(t width))
;; A fixed width window, try to restore the original size.
(let ((delta (- (cdr (assq 'total-width item))
(window-total-width window)))
window-size-fixed)
(when (window-resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not wide enough.
(let* ((min-size (window-min-size window t ignore))
(delta (- min-size (window-total-size window t))))
(when (and (> delta 0)
(window-resizable-p window delta t ignore))
(window-resize window delta t ignore))))
;; Set dedicated status.
(set-window-dedicated-p window (cdr (assq 'dedicated state)))
;; Install positions (maybe we should do this after all windows
;; have been created and sized).
(ignore-errors
(set-window-start window (cdr (assq 'start state)))
(set-window-point window (cdr (assq 'point state))))
;; Select window if it's the selected one.
(when (cdr (assq 'selected state))
(select-window window)))))))
(push window window-state-put-stale-windows)))))))
(defun window-state-put (state &optional window ignore)
"Put window state STATE into WINDOW.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment