(Emacs)+clean buffer list functionality

Better than using ibuffer, just does it like a macro.
This commit is contained in:
2022-08-21 17:45:12 +01:00
parent 4c4fbf6980
commit 2e2ee6e586

View File

@@ -140,6 +140,24 @@ common use of this macro.
`(cond `(cond
,@current-lisp))) ,@current-lisp)))
#+end_src #+end_src
** Clean buffer list
Instead of cleaning my buffer list manually, just use this. Preserves
any buffers in ~+dx/keep-buffer~ and kills the rest.
#+begin_src emacs-lisp
(defconst +dx/keep-buffers (list "config.org" "*scratch*"
"*dashboard*" "*Messages*"
"*Warnings*")
"List of buffer names to preserve")
(defun +dx/clean-buffer-list ()
"Kill all buffers except any with names in +dx/keep-buffers"
(interactive)
(mapcar #'(lambda (buf)
(if (not (member (buffer-name buf) +dx/keep-buffers))
(kill-buffer buf)))
(buffer-list)))
#+end_src
* Aesthetics * Aesthetics
Load my custom "personal-primary-theme" theme which is stored in the Load my custom "personal-primary-theme" theme which is stored in the
Emacs lisp folder (look at [[file:elisp/personal-primary-theme.el][this file]]). Emacs lisp folder (look at [[file:elisp/personal-primary-theme.el][this file]]).
@@ -727,7 +745,8 @@ that makes it easy to manage the various buffers created by packages.
"d" #'kill-current-buffer "d" #'kill-current-buffer
"K" #'kill-buffer "K" #'kill-buffer
"j" #'next-buffer "j" #'next-buffer
"k" #'previous-buffer) "k" #'previous-buffer
"D" #'+dx/clean-buffer-list)
:init :init
(with-eval-after-load "use-package-core" (with-eval-after-load "use-package-core"
(add-to-list 'use-package-keywords ':display) (add-to-list 'use-package-keywords ':display)