diff options
-rw-r--r-- | basic.el | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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) |