diff options
| author | Richard M. Stallman | 1996-10-26 16:06:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-10-26 16:06:37 +0000 |
| commit | b691df0c08b37358cd4e083898989fdde197aef1 (patch) | |
| tree | 99c348f9c7c998639d5c95a826a2cd9532486e49 | |
| parent | 44d7776b5b20e082a385a106147477c94d2e29bf (diff) | |
| download | emacs-b691df0c08b37358cd4e083898989fdde197aef1.tar.gz emacs-b691df0c08b37358cd4e083898989fdde197aef1.zip | |
(kill-buffer-and-window): New command.
Bind it to C-x 4 0.
| -rw-r--r-- | lisp/window.el | 12 |
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." | |||
| 277 | ;; Make sure we unbind buffer-read-only | 277 | ;; Make sure we unbind buffer-read-only |
| 278 | ;; with the proper current buffer. | 278 | ;; with the proper current buffer. |
| 279 | (set-buffer buffer)))))) | 279 | (set-buffer buffer)))))) |
| 280 | 280 | ||
| 281 | (defun kill-buffer-and-window () | ||
| 282 | "Kill the current buffer and delete the selected window." | ||
| 283 | (interactive) | ||
| 284 | (if (yes-or-no-p (format "Kill buffer `%s'? " (buffer-name))) | ||
| 285 | (let ((buffer (current-buffer))) | ||
| 286 | (delete-window (selected-window)) | ||
| 287 | (kill-buffer buffer)) | ||
| 288 | (error "Aborted"))) | ||
| 289 | |||
| 281 | (define-key ctl-x-map "2" 'split-window-vertically) | 290 | (define-key ctl-x-map "2" 'split-window-vertically) |
| 282 | (define-key ctl-x-map "3" 'split-window-horizontally) | 291 | (define-key ctl-x-map "3" 'split-window-horizontally) |
| 283 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) | 292 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) |
| 284 | (define-key ctl-x-map "{" 'shrink-window-horizontally) | 293 | (define-key ctl-x-map "{" 'shrink-window-horizontally) |
| 285 | (define-key ctl-x-map "-" 'shrink-window-if-larger-than-buffer) | 294 | (define-key ctl-x-map "-" 'shrink-window-if-larger-than-buffer) |
| 286 | (define-key ctl-x-map "+" 'balance-windows) | 295 | (define-key ctl-x-map "+" 'balance-windows) |
| 296 | (define-key ctl-x-4-map "0" 'kill-buffer-and-window) | ||
| 287 | 297 | ||
| 288 | ;;; windows.el ends here | 298 | ;;; windows.el ends here |