Some time ago, I enabled
save-desktop-mode in Emacs and I've been really happy with it. I generally never close Emacs but sometimes I need to restart it for one reason or another or an OS upgrade requires me to reboot. Since I have a number of buffers that are always open, restarting Emacs was a pain before I started saving the sessions. Now when I restart Emacs, everything is just like it was before the restart. A downside of
save-desktop-mode is that the buffer list grows and grows. Every once in a while I run
ibuffer to get a list of active buffers and cull the list.
Today, I discovered the
clean-buffer-list command that automates the process. The idea is that buffers that haven't been displayed recently are closed. The meaning of “recently” is, of course, configurable along with other attributes of the process. This is the command that the so-called Midnight Mode uses. My machines are usually asleep at midnight so in order for me to use automatic cleaning I'd have to schedule it for when I'm on the machine and I don't want to do that.
Happily, I can just run
clean-buffer-list when I notice that the number of buffers is getting over large and have the list culled automatically for me. Another win for Emacs.