summaryrefslogtreecommitdiff
path: root/basic.el
diff options
context:
space:
mode:
Diffstat (limited to 'basic.el')
-rw-r--r--basic.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/basic.el b/basic.el
index 256052c..c8619d4 100644
--- a/basic.el
+++ b/basic.el
@@ -123,6 +123,26 @@
(display-buffer-at-bottom)
(window-height . 0.2))))
+;;; Custom kill buffer function
+
+;;;###autoload
+(defun durand-kill-current-buffer (&optional arg)
+ "Kill the current buffer.
+
+If the optional ARG is non-nil, and if there are more than one
+window, then also delete the selected window."
+ (interactive "P")
+ (cond
+ ((window-minibuffer-p (selected-window))
+ ;; this is the same as calling `abort-recursive-edit'.
+ (throw 'exit t))
+ (t (kill-buffer (current-buffer))))
+ (cond
+ ((and arg (not (one-window-p t)))
+ (delete-window (selected-window)))))
+
+(define-key global-map (vector ?\s-k) #'durand-kill-current-buffer)
+
;;; auto-fill for texts
(set 'adaptive-fill-mode t)