changeset 16469:479c96f4be3a

(kill-buffer-and-window): New command. Bind it to C-x 4 0.
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Oct 1996 16:06:37 +0000
parents 0927028baa82
children b050d980c422
files lisp/window.el
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/window.el	Sat Oct 26 16:06:24 1996 +0000
+++ b/lisp/window.el	Sat Oct 26 16:06:37 1996 +0000
@@ -277,12 +277,22 @@
 	    ;; Make sure we unbind buffer-read-only
 	    ;; with the proper current buffer.
 	    (set-buffer buffer))))))
-      
+
+(defun kill-buffer-and-window ()
+  "Kill the current buffer and delete the selected window."
+  (interactive)
+  (if (yes-or-no-p (format "Kill buffer `%s'? " (buffer-name)))
+      (let ((buffer (current-buffer)))
+	(delete-window (selected-window))
+	(kill-buffer buffer))
+    (error "Aborted")))
+
 (define-key ctl-x-map "2" 'split-window-vertically)
 (define-key ctl-x-map "3" 'split-window-horizontally)
 (define-key ctl-x-map "}" 'enlarge-window-horizontally)
 (define-key ctl-x-map "{" 'shrink-window-horizontally)
 (define-key ctl-x-map "-" 'shrink-window-if-larger-than-buffer)
 (define-key ctl-x-map "+" 'balance-windows)
+(define-key ctl-x-4-map "0" 'kill-buffer-and-window)
 
 ;;; windows.el ends here