aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2013-09-15 18:08:04 +0200
committerMartin Rudalics2013-09-15 18:08:04 +0200
commitc089653d568d5c696f2d35e1bcf9bba64af85b97 (patch)
treec8c21b0285b7d18bce3e9923f2c9454fda87323e
parent820a4cbeb61a8d16c3ad77788245b0ad1c711f71 (diff)
downloademacs-c089653d568d5c696f2d35e1bcf9bba64af85b97.tar.gz
emacs-c089653d568d5c696f2d35e1bcf9bba64af85b97.zip
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).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/window.el110
2 files changed, 62 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e151ca9312b..01400a96009 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-09-15 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (window--state-put-2): Don't process buffer state
4 when buffer doesn't exist any more (Bug#15382).
5
12013-09-15 Glenn Morris <rgm@gnu.org> 62013-09-15 Glenn Morris <rgm@gnu.org>
2 7
3 * eshell/em-unix.el (eshell/rm): 8 * eshell/em-unix.el (eshell/rm):
diff --git a/lisp/window.el b/lisp/window.el
index a111b3cb5b4..14e9f6bc128 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4464,62 +4464,66 @@ value can be also stored on disk and read back in a new session."
4464 (set-window-parameter window (car parameter) (cdr parameter)))) 4464 (set-window-parameter window (car parameter) (cdr parameter))))
4465 ;; Process buffer related state. 4465 ;; Process buffer related state.
4466 (when state 4466 (when state
4467 ;; We don't want to raise an error in case the buffer does not
4468 ;; exist anymore, so we switch to a previous one and save the
4469 ;; window with the intention of deleting it later if possible.
4470 (let ((buffer (get-buffer (car state)))) 4467 (let ((buffer (get-buffer (car state))))
4471 (if buffer 4468 (if buffer
4472 (set-window-buffer window buffer) 4469 (with-current-buffer buffer
4470 (set-window-buffer window buffer)
4471 (set-window-hscroll window (cdr (assq 'hscroll state)))
4472 (apply 'set-window-fringes
4473 (cons window (cdr (assq 'fringes state))))
4474 (let ((margins (cdr (assq 'margins state))))
4475 (set-window-margins window (car margins) (cdr margins)))
4476 (let ((scroll-bars (cdr (assq 'scroll-bars state))))
4477 (set-window-scroll-bars
4478 window (car scroll-bars) (nth 2 scroll-bars)
4479 (nth 3 scroll-bars)))
4480 (set-window-vscroll window (cdr (assq 'vscroll state)))
4481 ;; Adjust vertically.
4482 (if (memq window-size-fixed '(t height))
4483 ;; A fixed height window, try to restore the
4484 ;; original size.
4485 (let ((delta (- (cdr (assq 'total-height item))
4486 (window-total-height window)))
4487 window-size-fixed)
4488 (when (window-resizable-p window delta)
4489 (window-resize window delta)))
4490 ;; Else check whether the window is not high enough.
4491 (let* ((min-size (window-min-size window nil ignore))
4492 (delta (- min-size (window-total-size window))))
4493 (when (and (> delta 0)
4494 (window-resizable-p window delta nil ignore))
4495 (window-resize window delta nil ignore))))
4496 ;; Adjust horizontally.
4497 (if (memq window-size-fixed '(t width))
4498 ;; A fixed width window, try to restore the original
4499 ;; size.
4500 (let ((delta (- (cdr (assq 'total-width item))
4501 (window-total-width window)))
4502 window-size-fixed)
4503 (when (window-resizable-p window delta)
4504 (window-resize window delta)))
4505 ;; Else check whether the window is not wide enough.
4506 (let* ((min-size (window-min-size window t ignore))
4507 (delta (- min-size (window-total-size window t))))
4508 (when (and (> delta 0)
4509 (window-resizable-p window delta t ignore))
4510 (window-resize window delta t ignore))))
4511 ;; Set dedicated status.
4512 (set-window-dedicated-p window (cdr (assq 'dedicated state)))
4513 ;; Install positions (maybe we should do this after all
4514 ;; windows have been created and sized).
4515 (ignore-errors
4516 (set-window-start window (cdr (assq 'start state)))
4517 (set-window-point window (cdr (assq 'point state))))
4518 ;; Select window if it's the selected one.
4519 (when (cdr (assq 'selected state))
4520 (select-window window)))
4521 ;; We don't want to raise an error in case the buffer does
4522 ;; not exist anymore, so we switch to a previous one and
4523 ;; save the window with the intention of deleting it later
4524 ;; if possible.
4473 (switch-to-prev-buffer window) 4525 (switch-to-prev-buffer window)
4474 (push window window-state-put-stale-windows))) 4526 (push window window-state-put-stale-windows)))))))
4475 (with-current-buffer (window-buffer window)
4476 (set-window-hscroll window (cdr (assq 'hscroll state)))
4477 (apply 'set-window-fringes
4478 (cons window (cdr (assq 'fringes state))))
4479 (let ((margins (cdr (assq 'margins state))))
4480 (set-window-margins window (car margins) (cdr margins)))
4481 (let ((scroll-bars (cdr (assq 'scroll-bars state))))
4482 (set-window-scroll-bars
4483 window (car scroll-bars) (nth 2 scroll-bars) (nth 3 scroll-bars)))
4484 (set-window-vscroll window (cdr (assq 'vscroll state)))
4485 ;; Adjust vertically.
4486 (if (memq window-size-fixed '(t height))
4487 ;; A fixed height window, try to restore the original size.
4488 (let ((delta (- (cdr (assq 'total-height item))
4489 (window-total-height window)))
4490 window-size-fixed)
4491 (when (window-resizable-p window delta)
4492 (window-resize window delta)))
4493 ;; Else check whether the window is not high enough.
4494 (let* ((min-size (window-min-size window nil ignore))
4495 (delta (- min-size (window-total-size window))))
4496 (when (and (> delta 0)
4497 (window-resizable-p window delta nil ignore))
4498 (window-resize window delta nil ignore))))
4499 ;; Adjust horizontally.
4500 (if (memq window-size-fixed '(t width))
4501 ;; A fixed width window, try to restore the original size.
4502 (let ((delta (- (cdr (assq 'total-width item))
4503 (window-total-width window)))
4504 window-size-fixed)
4505 (when (window-resizable-p window delta)
4506 (window-resize window delta)))
4507 ;; Else check whether the window is not wide enough.
4508 (let* ((min-size (window-min-size window t ignore))
4509 (delta (- min-size (window-total-size window t))))
4510 (when (and (> delta 0)
4511 (window-resizable-p window delta t ignore))
4512 (window-resize window delta t ignore))))
4513 ;; Set dedicated status.
4514 (set-window-dedicated-p window (cdr (assq 'dedicated state)))
4515 ;; Install positions (maybe we should do this after all windows
4516 ;; have been created and sized).
4517 (ignore-errors
4518 (set-window-start window (cdr (assq 'start state)))
4519 (set-window-point window (cdr (assq 'point state))))
4520 ;; Select window if it's the selected one.
4521 (when (cdr (assq 'selected state))
4522 (select-window window)))))))
4523 4527
4524(defun window-state-put (state &optional window ignore) 4528(defun window-state-put (state &optional window ignore)
4525 "Put window state STATE into WINDOW. 4529 "Put window state STATE into WINDOW.