Skip to content

Commit

Permalink
Simplify my/kill-this-buffer in Emacs
Browse files Browse the repository at this point in the history
kill-buffer non-interactively without an argument acts on the current buffer.
  • Loading branch information
bkhl committed Jan 4, 2025
1 parent 7be6984 commit bc8581e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions content/emacs-configuration.org
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,12 @@ Change the default keybinding for killing a buffer, ~C-x k~, so that it kills th
Also binds ~C-x M-k~ to bury the current buffer, a command that's not bound to any key by default.

#+begin_src emacs-lisp
(defun my/kill-this-buffer ()
"Kill current buffer, prompting if there are unsaved changes."
(interactive)
(kill-buffer (current-buffer)))

(global-set-key (kbd "C-x k") #'my/kill-this-buffer)
(global-set-key
(kbd "C-x k")
(defun my/kill-this-buffer ()
"Kill current buffer, prompting if there are unsaved changes."
(interactive)
(kill-buffer)))
(global-set-key (kbd "C-x K") #'kill-buffer)
(global-set-key (kbd "C-x M-k") #'bury-buffer)
#+end_src
Expand Down

0 comments on commit bc8581e

Please sign in to comment.