feat: add kill-other-buffers function

Convenience function to prune buffers.
This will kill all buffers except for scratch and Messages
This commit is contained in:
Laurens Miers 2023-06-06 09:56:07 +02:00
parent 8014257b46
commit 342307ce23

View file

@ -10,6 +10,7 @@
- [[#emacs-262][Emacs 26.2]]
- [[#utils][Utils]]
- [[#custom-command-line-arguments][Custom command line arguments]]
- [[#kill-other-buffers][Kill other buffers]]
- [[#global-variables][Global variables]]
- [[#ripgrep][Ripgrep]]
- [[#term][Term]]
@ -143,6 +144,23 @@ If it was found, we delete it from the list of command line arguments.
found-switch))
#+END_SRC
** Kill other buffers
Function to kill other buffers but the current open one (and some standard buffers which should be kept alive).
Stolen from https://www.emacswiki.org/emacs/KillingBuffers .
#+BEGIN_SRC emacs-lisp
(setq not-to-kill-buffer-list '("*scratch*" "*Messages*"))
(defun kill-other-buffers ()
"Kill all other buffers."
(interactive)
(if (member (buffer-name (current-buffer)) not-to-kill-buffer-list)
(bury-buffer)
(kill-buffer (current-buffer))))
#+END_SRC
** Global variables
Some package behave strangely if we have custom command line parameters.