about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-04-19 15:25:04 -0500
committerCase Duckworth2021-04-19 15:25:04 -0500
commitd057fde4ce970b3f08c7ac9c916a760c9ad5ba02 (patch)
tree9c9efdd62142da7a344122f7924484ac3a7b47b1 /lisp
parentMerge branch 'main' of https://tildegit.org/acdw/emacs (diff)
downloademacs-d057fde4ce970b3f08c7ac9c916a760c9ad5ba02.tar.gz
emacs-d057fde4ce970b3f08c7ac9c916a760c9ad5ba02.zip
Add `acdw/kill-a-buffer' and keybinding
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el18
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
132C-x k => Kill CURRENT buffer and window
133C-u C-x k => Kill OTHER buffer and window
134C-u C-u C-x k => Kill ALL OTHER buffers and windows
135
136Prompt 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