Emacs: kill-buffer Induces Buffer Accumulation

By Xah Lee. Date:

This page discusses emacs user interface issue of the command kill-buffer.

In my usage pattern, i find that one problem of emacs default UI is that it makes it difficult to close a buffer.

To close a file, user calls kill-bufferCtrl+x k】 then Enter, and if it's not saved, one has to type full yes or no. Too many keystrokes. Also, when it is the “*scratch*” or buffer not associated with file, it doesn't ask for save.

These issues induce people not want to close buffer. So, buffer accumulates. Instead of closing files we don't need, people use {bury-buffer, switch-to-buffer}, even though we just want to close it. Tens or hundreds of buffers became a problem, then, {kill-some-buffers, clean-buffer-list, ido-mode}, are invented to solve this new problem.

By habit, i always close buffers that i'm done working with. I did that for the past decade, even if it means painfully using kill-buffer. So, usually i have no more than 20 buffers open. In past years, with ErgoEmacs Keybinding and my own AutoHotkey setup, i have single key to close buffer, and with just y/n if unsaved. This also makes switching to next/prev buffer much more useful (both are single key), much like switching tabs in a web browser.

This post is inspired by jcs's blog The Emacs clean-buffer-list Command At http://irreal.org/blog/?p=765

Emacs Modernization