diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 44d15d0..650cb3f 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -126,6 +126,24 @@ if MAKE-DIRECTORY is non-nil." | |||
126 | (directory-files-recursively | 126 | (directory-files-recursively |
127 | user-emacs-directory "\.el$")))) | 127 | user-emacs-directory "\.el$")))) |
128 | 128 | ||
129 | (defun acdw/kill-a-buffer (&optional prefix) | ||
130 | "Kill a buffer based on the following rules: | ||
131 | |||
132 | C-x k => Kill CURRENT buffer and window | ||
133 | C-u C-x k => Kill OTHER buffer and window | ||
134 | C-u C-u C-x k => Kill ALL OTHER buffers and windows | ||
135 | |||
136 | Prompt only if there are unsaved changes." | ||
137 | (interactive "P") | ||
138 | (pcase (or (car prefix) 0) | ||
139 | (0 (kill-current-buffer) | ||
140 | (unless (one-window-p) (delete-window))) | ||
141 | (4 (other-window 1) | ||
142 | (kill-current-buffer) | ||
143 | (unless (one-window-p) (delete-window))) | ||
144 | (16 (mapc 'kill-buffer (delq (current-) (buffer-list))) | ||
145 | (delete-other-windows)))) | ||
146 | |||
129 | 147 | ||
130 | ;; Make `C-z' more useful | 148 | ;; Make `C-z' more useful |
131 | (defvar acdw/leader | 149 | (defvar acdw/leader |