aboutsummaryrefslogtreecommitdiff
path: root/Emacs/.config/emacs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2022-08-21 17:45:12 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2022-09-14 00:45:42 +0100
commit2e2ee6e5863166312bd1a09f59fca4373b53067b (patch)
treeec9c5147f3fdf0f7e825cb84eb0bc4c1b6e9b9ec /Emacs/.config/emacs
parent4c4fbf6980906fdf57028d56995c621fbe8cdff7 (diff)
downloaddotfiles-2e2ee6e5863166312bd1a09f59fca4373b53067b.tar.gz
dotfiles-2e2ee6e5863166312bd1a09f59fca4373b53067b.tar.bz2
dotfiles-2e2ee6e5863166312bd1a09f59fca4373b53067b.zip
(Emacs)+clean buffer list functionality
Better than using ibuffer, just does it like a macro.
Diffstat (limited to 'Emacs/.config/emacs')
-rw-r--r--Emacs/.config/emacs/config.org21
1 files changed, 20 insertions, 1 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index 95ce998..8f748b8 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -140,6 +140,24 @@ common use of this macro.
`(cond
,@current-lisp)))
#+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
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]]).
@@ -727,7 +745,8 @@ that makes it easy to manage the various buffers created by packages.
"d" #'kill-current-buffer
"K" #'kill-buffer
"j" #'next-buffer
- "k" #'previous-buffer)
+ "k" #'previous-buffer
+ "D" #'+dx/clean-buffer-list)
:init
(with-eval-after-load "use-package-core"
(add-to-list 'use-package-keywords ':display)