emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114294: In window--state-put-2 don't process buffer


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r114294: In window--state-put-2 don't process buffer state when buffer doesn't exist (Bug#15382).
Date: Sun, 15 Sep 2013 16:08:24 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114294
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Sun 2013-09-15 18:08:04 +0200
message:
  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).
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/window.el                 window.el-20091113204419-o5vbwnq5f7feedwu-94
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-09-15 00:35:54 +0000
+++ b/lisp/ChangeLog    2013-09-15 16:08:04 +0000
@@ -1,3 +1,8 @@
+2013-09-15  Martin Rudalics  <address@hidden>
+
+       * 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  <address@hidden>
 
        * eshell/em-unix.el (eshell/rm):

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2013-08-27 12:46:00 +0000
+++ b/lisp/window.el    2013-09-15 16:08:04 +0000
@@ -4464,62 +4464,66 @@
          (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]