summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-10-26 16:06:37 +0000
committerRichard M. Stallman <rms@gnu.org>1996-10-26 16:06:37 +0000
commit8938b702d62396253f798b8f50f7383e5a67eabd (patch)
treefbd2c65f7fc7af956784ac01b8b108316f73e6ee
parentaa20fd3d9322e163235e8f691a161557d4b8aff1 (diff)
downloademacs-8938b702d62396253f798b8f50f7383e5a67eabd.tar.gz
(kill-buffer-and-window): New command.
Bind it to C-x 4 0.
-rw-r--r--lisp/window.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 5468999991b..0b55ccbe9a3 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -277,12 +277,22 @@ or if the window is the only window of its frame."
;; 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