1.5 KiB
1.5 KiB
Clean Buffers at a Regular Interval with Midnight Mode
I feel a little weird just enabling this, let's see what I think about auto-killing any buffer older than six hours. It won't run often, if I want it to run hourly, I could put it in to a repeating timer, myself.
(provide 'cce/midnight-mode)
(setq clean-buffer-list-delay-general 0.5)
(midnight-mode 1)
(setq clean-buffer-list-kill-never-buffer-names
(append clean-buffer-list-kill-never-buffer-names
(list "*Group*")))
I really wish this clean-buffers
functionality could exclude based on mode, what an oversight! We can cheese it, however, with this function which can be added to help:clean-buffer-list-kill-never-regexps.
(defun cce/check-kill-exwm-mode (buffer-name)
"Checks whether the buffer backing [`buffer-name'] is an EXWM-mode buffer to exclude from midnight-mode.
To enable this, add it to [`clean-buffer-list-kill-never-regexps'], which will get it funcall'd in the midnight-mode hook."
(with-current-buffer buffer-name
(eq major-mode 'exwm-mode)))
(add-to-list 'clean-buffer-list-kill-never-regexps #'cce/check-kill-exwm-mode)