15

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.

Fingolfin
  • 5,363
  • 6
  • 45
  • 66
fluca1978
  • 3,968
  • 2
  • 15
  • 15
  • 2
    Try [helm](https://github.com/emacs-helm/helm/wiki). 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 Apr 01 '14 at 18:05

2 Answers2

17

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)
Jeff Bauer
  • 13,890
  • 9
  • 51
  • 73
Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
  • Help about ibuffer at: [emacswiki.org/emacs/IbufferMode](https://www.emacswiki.org/emacs/IbufferMode). You might not need to "install", it may already be part of your standard emacs installation, just try `M-x ibuffer ` and see. – Rolazaro Azeveires Dec 23 '17 at 16:41
0

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

Sibi
  • 47,472
  • 16
  • 95
  • 163