diff options
| author | Martin Rudalics | 2011-09-03 12:55:37 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2011-09-03 12:55:37 +0200 |
| commit | 1f3c99ca9f35c430fcb3b3244df3bf6fca04e62b (patch) | |
| tree | 27f4904bb80e002f8c9e8fe389582606762bc373 /lisp | |
| parent | a3cf097fd06591ad03de58b85fce803cb8617e65 (diff) | |
| download | emacs-1f3c99ca9f35c430fcb3b3244df3bf6fca04e62b.tar.gz emacs-1f3c99ca9f35c430fcb3b3244df3bf6fca04e62b.zip | |
Don't delete frame when there's a previous buffer to show (Bug#9419).
* window.el (window-deletable-p): Don't return a non-nil value
when there's a buffer that was shown in the window before.
(Bug#9419)
(display-buffer-pop-up-frame, display-buffer-pop-up-window): Set
window's previous buffers to nil.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/window.el | 48 |
2 files changed, 43 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 781833d309c..a365d6078ea 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2011-09-03 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.el (window-deletable-p): Don't return a non-nil value | ||
| 4 | when there's a buffer that was shown in the window before. | ||
| 5 | (Bug#9419) | ||
| 6 | (display-buffer-pop-up-frame, display-buffer-pop-up-window): Set | ||
| 7 | window's previous buffers to nil. | ||
| 8 | |||
| 1 | 2011-09-03 Eli Zaretskii <eliz@gnu.org> | 9 | 2011-09-03 Eli Zaretskii <eliz@gnu.org> |
| 2 | 10 | ||
| 3 | * mail/rmailmm.el (rmail-mime-insert-tagline): Insert an extra | 11 | * mail/rmailmm.el (rmail-mime-insert-tagline): Insert an extra |
diff --git a/lisp/window.el b/lisp/window.el index d078fbec35d..5272841a9c7 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -2291,29 +2291,45 @@ frame." | |||
| 2291 | (setq window (window-atom-root window)))) | 2291 | (setq window (window-atom-root window)))) |
| 2292 | (let ((parent (window-parent window)) | 2292 | (let ((parent (window-parent window)) |
| 2293 | (frame (window-frame window)) | 2293 | (frame (window-frame window)) |
| 2294 | (buffer (window-buffer window)) | ||
| 2294 | (dedicated (and (window-buffer window) (window-dedicated-p window))) | 2295 | (dedicated (and (window-buffer window) (window-dedicated-p window))) |
| 2295 | (quit-restore (window-parameter window 'quit-restore))) | 2296 | (quit-restore (window-parameter window 'quit-restore))) |
| 2296 | (cond | 2297 | (cond |
| 2297 | ((frame-root-window-p window) | 2298 | ((frame-root-window-p window) |
| 2299 | ;; Don't delete FRAME if `frame-auto-delete' is nil. | ||
| 2298 | (when (and (or (eq frame-auto-delete t) | 2300 | (when (and (or (eq frame-auto-delete t) |
| 2299 | (and (eq frame-auto-delete 'automatic) | 2301 | (and (eq frame-auto-delete 'automatic) |
| 2302 | ;; Delete FRAME only if it's either dedicated | ||
| 2303 | ;; or quit-restore's car is `new-frame' and | ||
| 2304 | ;; WINDOW still displays the same buffer | ||
| 2300 | (or dedicated | 2305 | (or dedicated |
| 2301 | (and (eq (car-safe quit-restore) 'new-frame) | 2306 | (and (eq (car-safe quit-restore) 'new-frame) |
| 2302 | (eq (nth 1 quit-restore) | 2307 | (eq (nth 1 quit-restore) |
| 2303 | (window-buffer window)))))) | 2308 | (window-buffer window)))))) |
| 2309 | ;; Don't delete FRAME if we have another buffer in | ||
| 2310 | ;; WINDOW's previous buffers. Bug#9419. | ||
| 2311 | (or (not (window-prev-buffers window)) | ||
| 2312 | (eq (caar (window-prev-buffers window)) buffer)) | ||
| 2313 | ;; Don't try to delete FRAME when there are no other | ||
| 2314 | ;; visible frames left. | ||
| 2304 | (other-visible-frames-p frame)) | 2315 | (other-visible-frames-p frame)) |
| 2305 | ;; WINDOW is the root window of its frame. Return `frame' but | ||
| 2306 | ;; only if WINDOW is (1) either dedicated or quit-restore's car | ||
| 2307 | ;; is `new-frame' and the window still displays the same buffer | ||
| 2308 | ;; and (2) there are other frames left. | ||
| 2309 | 'frame)) | 2316 | 'frame)) |
| 2310 | ((and (not ignore-window-parameters) | 2317 | ;; Don't delete WINDOW if we find another buffer in WINDOW's |
| 2311 | (eq (window-parameter window 'window-side) 'none) | 2318 | ;; previous buffers. |
| 2312 | (or (not parent) | 2319 | ((and (or (not (window-prev-buffers window)) |
| 2313 | (not (eq (window-parameter parent 'window-side) 'none)))) | 2320 | (eq (caar (window-prev-buffers window)) buffer)) |
| 2314 | ;; Can't delete last main window. | 2321 | ;; Delete WINDOW only if it's dedicated or quit-restore's car |
| 2315 | nil) | 2322 | ;; is `new-frame' or `new-window' and it still displays the |
| 2316 | (t)))) | 2323 | ;; same buffer. |
| 2324 | (or dedicated | ||
| 2325 | (and (memq (car-safe quit-restore) '(new-window new-frame)) | ||
| 2326 | (eq (nth 1 quit-restore) (window-buffer window)))) | ||
| 2327 | ;; Don't delete the last main window. | ||
| 2328 | (or ignore-window-parameters | ||
| 2329 | (not (eq (window-parameter window 'window-side) 'none)) | ||
| 2330 | (and parent | ||
| 2331 | (eq (window-parameter parent 'window-side) 'none)))) | ||
| 2332 | t)))) | ||
| 2317 | 2333 | ||
| 2318 | (defun window-or-subwindow-p (subwindow window) | 2334 | (defun window-or-subwindow-p (subwindow window) |
| 2319 | "Return t if SUBWINDOW is either WINDOW or a subwindow of WINDOW." | 2335 | "Return t if SUBWINDOW is either WINDOW or a subwindow of WINDOW." |
| @@ -4714,7 +4730,10 @@ return the window on the new frame; otherwise return nil." | |||
| 4714 | (setq frame (funcall fun)) | 4730 | (setq frame (funcall fun)) |
| 4715 | (setq window (frame-selected-window frame))) | 4731 | (setq window (frame-selected-window frame))) |
| 4716 | (display-buffer-record-window 'pop-up-frame window buffer) | 4732 | (display-buffer-record-window 'pop-up-frame window buffer) |
| 4717 | (window--display-buffer-2 buffer window)))) | 4733 | (window--display-buffer-2 buffer window) |
| 4734 | ;; Reset list of WINDOW's previous buffers to nil. | ||
| 4735 | (set-window-prev-buffers window nil) | ||
| 4736 | window))) | ||
| 4718 | 4737 | ||
| 4719 | (defun display-buffer-pop-up-window (buffer alist) | 4738 | (defun display-buffer-pop-up-window (buffer alist) |
| 4720 | "Display BUFFER by popping up a new window. | 4739 | "Display BUFFER by popping up a new window. |
| @@ -4737,7 +4756,10 @@ If sucessful, return the new window; otherwise return nil." | |||
| 4737 | (window--try-to-split-window | 4756 | (window--try-to-split-window |
| 4738 | (get-lru-window frame t))))) | 4757 | (get-lru-window frame t))))) |
| 4739 | (display-buffer-record-window 'pop-up-window window buffer) | 4758 | (display-buffer-record-window 'pop-up-window window buffer) |
| 4740 | (window--display-buffer-2 buffer window)))) | 4759 | (window--display-buffer-2 buffer window) |
| 4760 | ;; Reset list of WINDOW's previous buffers to nil. | ||
| 4761 | (set-window-prev-buffers window nil) | ||
| 4762 | window))) | ||
| 4741 | 4763 | ||
| 4742 | ;; This display action function groups together some lower-level ones: | 4764 | ;; This display action function groups together some lower-level ones: |
| 4743 | (defun display-buffer-reuse-or-pop-window (buffer alist) | 4765 | (defun display-buffer-reuse-or-pop-window (buffer alist) |