Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2021 18:28
What would you like to do?
(defun kill-all-buffers ()
(mapcar (lambda (b)
;; Don't blow away scratch, for reasons, and also because doing so screws up
;; default-directory, setting it to the last thing we tab-completed (!?). This
;; causes annoyance when you try to set a path in the minibuffer later, making
;; it try to cd to that directory and then complaining that it's not there.
(if (not (string= (buffer-name b) "*scratch*"))
(kill-buffer b)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment