15
votes

Is there a configuration hook to make the "Buffers List" buffer automatically closing when a buffer is selected in such window? Each time the buffer list opens and I select a buffer I have to manually close it using C-x C-k and this is annoying, also because it leaves the frame split in at least two windows.

2
Try helm. It will change your Emacs experience forever. You will be able close, preview and search within buffers directly from the buffers list. If you use (helm-mode 1), helm will replace most Emacs menus with the corresponding helm equivalent. - Amelio Vazquez-Reina

2 Answers

17
votes

Not sure about a config option, but you can always use q (or a C-x 1 in your current buffer) instead of C-x C-k to close the temp buffer.

P.S. Almost nobody uses buffer-list these days. Most Emacs users simply remap it to ibuffer (its much smarter and you might like the fact that its temp buffer disappears by default):

(global-set-key (kbd "C-x C-b") 'ibuffer)
0
votes

You can tweak this function for your requirement:

(defun kill-other-buffers ()
  "Kill all other buffers."
  (interactive)
  (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))

This code kills all the buffers except the current one. Source: Emacs Wiki