diff options
| author | David Kastrup | 2006-10-20 15:12:31 +0000 |
|---|---|---|
| committer | David Kastrup | 2006-10-20 15:12:31 +0000 |
| commit | f5da083ed9884178b88bf2ee81486e4527d0da81 (patch) | |
| tree | b50d3336c4edde0ed64773c4da4281b98d4ac0d0 | |
| parent | 98d763e7e7bc46ea8c2e1b633b45648f6507aaac (diff) | |
| download | emacs-f5da083ed9884178b88bf2ee81486e4527d0da81.tar.gz emacs-f5da083ed9884178b88bf2ee81486e4527d0da81.zip | |
(kill-buffer-and-window): Fix a bug where an aborted
operation would still cause some window to collapse later.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/window.el | 22 |
2 files changed, 21 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 44439658b56..e40671e1d99 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2006-10-20 David Kastrup <dak@gnu.org> | ||
| 2 | |||
| 3 | * window.el (kill-buffer-and-window): Fix a bug where an aborted | ||
| 4 | operation would still cause some window to collapse later. | ||
| 5 | |||
| 1 | 2006-10-20 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2006-10-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * vc.el (vc-switch-backend): Try to be more careful with unwanted | 8 | * vc.el (vc-switch-backend): Try to be more careful with unwanted |
| @@ -574,7 +579,7 @@ | |||
| 574 | 579 | ||
| 575 | * autoinsert.el (auto-insert-alist): Doc fix. | 580 | * autoinsert.el (auto-insert-alist): Doc fix. |
| 576 | 581 | ||
| 577 | 2006-10-07 Johan Bockg,be(Brd <bojohan@dd.chalmers.se> | 582 | 2006-10-07 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> |
| 578 | 583 | ||
| 579 | * mouse-sel.el (mouse-insert-selection-internal): | 584 | * mouse-sel.el (mouse-insert-selection-internal): |
| 580 | Use insert-for-yank, so that yank handlers are run. | 585 | Use insert-for-yank, so that yank handlers are run. |
diff --git a/lisp/window.el b/lisp/window.el index 0c50bc63a08..ac4fc0b7c96 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -719,17 +719,25 @@ or if the window is the only window of its frame." | |||
| 719 | "Kill the current buffer and delete the selected window." | 719 | "Kill the current buffer and delete the selected window." |
| 720 | (interactive) | 720 | (interactive) |
| 721 | (let ((window-to-delete (selected-window)) | 721 | (let ((window-to-delete (selected-window)) |
| 722 | (buffer-to-kill (current-buffer)) | ||
| 722 | (delete-window-hook (lambda () | 723 | (delete-window-hook (lambda () |
| 723 | (condition-case nil | 724 | (condition-case nil |
| 724 | (delete-window) | 725 | (delete-window) |
| 725 | (error nil))))) | 726 | (error nil))))) |
| 726 | (add-hook 'kill-buffer-hook delete-window-hook t t) | 727 | (unwind-protect |
| 727 | (if (kill-buffer (current-buffer)) | 728 | (progn |
| 728 | ;; If `delete-window' failed before, we rerun it to regenerate | 729 | (add-hook 'kill-buffer-hook delete-window-hook t t) |
| 729 | ;; the error so it can be seen in the minibuffer. | 730 | (if (kill-buffer (current-buffer)) |
| 730 | (when (eq (selected-window) window-to-delete) | 731 | ;; If `delete-window' failed before, we rerun it to regenerate |
| 731 | (delete-window)) | 732 | ;; the error so it can be seen in the echo area. |
| 732 | (remove-hook 'kill-buffer-hook delete-window-hook t)))) | 733 | (when (eq (selected-window) window-to-delete) |
| 734 | (delete-window)))) | ||
| 735 | ;; If the buffer is not dead for some reason (probably because | ||
| 736 | ;; of a `quit' signal), remove the hook again. | ||
| 737 | (condition-case nil | ||
| 738 | (with-current-buffer buffer-to-kill | ||
| 739 | (remove-hook 'kill-buffer-hook delete-window-hook t)) | ||
| 740 | (error nil))))) | ||
| 733 | 741 | ||
| 734 | (defun quit-window (&optional kill window) | 742 | (defun quit-window (&optional kill window) |
| 735 | "Quit the current buffer. Bury it, and maybe delete the selected frame. | 743 | "Quit the current buffer. Bury it, and maybe delete the selected frame. |