How do I close all but the current buffer in Emacs? Similar to "Close other tabs" feature in modern web browsers?
Close all buffers besides the current one in Emacs
elispemacs
elispemacs
How do I close all but the current buffer in Emacs? Similar to "Close other tabs" feature in modern web browsers?
Best Answer
For a more manual approach, you can list all buffers with C-x C-b, mark buffers in the list for deletion with d, and then use x to remove them.
I also recommend replacing list-buffers with the more advanced ibuffer:
(global-set-key (kbd "C-x C-b") 'ibuffer)
. The above will work with ibuffer, but you could also do this:m (mark the buffer you want to keep)
t (toggle marks)
D (kill all marked buffers)
I also use this snippet from the Emacs Wiki, which would further streamline this manual approach: