Search code examples
emacskeyboard-shortcuts

How to kill all the `buffers` in emacs at once?


Is there a command to kill all buffers in my emacs? instead of having me doing 'Ctrl -k ' one by one until there is no more buffer?

Thank you.


Solution

  • I am using this function to kill all the buffers in emacs

    (defun nuke-all-buffers ()
      (interactive)
      (mapcar 'kill-buffer (buffer-list))
      (delete-other-windows))
    
    (global-set-key (kbd "C-x K") 'nuke-all-buffers)
    

    Works fine for me :-)