Emacs: kill all buffers

Christian Kruse

I don't really know where I got this from (I'm sure that I didn't write this myself), but this is one of my most used macros when switching projects:

<pre class=”brush: elisp”>(defun kill-all-buffers () (interactive) (mapcar ‘kill-buffer (buffer-list)) (delete-other-windows))(global-set-key (kbd “C-x K”) ‘kill-all-buffers)</pre></code><p> This fun kills all buffers you opened in an emacs instance and binds it to <code>C-x K</code>.</p>