summaryrefslogtreecommitdiff
path: root/lisp/window.el
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2011-10-10 19:52:03 +0200
committerMartin Rudalics <rudalics@gmx.at>2011-10-10 19:52:03 +0200
commit366ca7f3da85b695afa34c3c3270b16a16d47f42 (patch)
treeea5b9cb51b10e48b8165da7b3609f525b5385989 /lisp/window.el
parent0563dae9a9e3a8c2b6de454693c0cc207e67f05d (diff)
downloademacs-366ca7f3da85b695afa34c3c3270b16a16d47f42.tar.gz
In vc actions use quit-windows-on instead of delete-windows-on.
* window.el (quit-windows-on): New function. * vc/vc.el (vc-revert, vc-rollback): * vc/vc-dispatcher.el (vc-finish-logentry): Call quit-windows-on instead of deleting windows. (Bug#4557) (Bug#5310) (Bug#5556) (Bug#6183) (Bug#7074)((Bug#7447)
Diffstat (limited to 'lisp/window.el')
-rw-r--r--lisp/window.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 7241e148dae..4d8b3c92b95 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2984,6 +2984,27 @@ one. If non-nil, reset `quit-restore' parameter to nil."
(if kill
(kill-buffer buffer)
(bury-buffer-internal buffer))))
+
+(defun quit-windows-on (&optional buffer-or-name kill frame)
+ "Quit all windows showing BUFFER-OR-NAME.
+BUFFER-OR-NAME may be a buffer or the name of an existing buffer
+and defaults to the current buffer. Optional argument KILL
+non-nil means to kill BUFFER-OR-NAME. KILL nil means to bury
+BUFFER-OR-NAME. Optional argument FRAME is handled as by
+`delete-windows-on'.
+
+This function calls `quit-window' on all candidate windows
+showing BUFFER-OR-NAME."
+ (interactive "BQuit windows on (buffer):\nP")
+ (let ((buffer (window-normalize-buffer buffer-or-name))
+ ;; Handle the "inverted" meaning of the FRAME argument wrt other
+ ;; `window-list-1' based function.
+ (all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame))))
+ (dolist (window (window-list-1 nil nil all-frames))
+ (if (eq (window-buffer window) buffer)
+ (quit-window kill window)
+ ;; If a window doesn't show BUFFER, unrecord BUFFER in it.
+ (unrecord-window-buffer window buffer)))))
;;; Splitting windows.
(defsubst window-split-min-size (&optional horizontal)