Change doom/kill-all-buffers behavior (C-u = only kill project buffers)

This commit is contained in:
Henrik Lissner 2018-03-23 16:01:35 -04:00
parent 5eba949550
commit f064c5d1ae
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -199,12 +199,13 @@ If DONT-SAVE, don't prompt to save modified buffers (discarding their changes)."
(defun doom/kill-all-buffers (&optional project-p) (defun doom/kill-all-buffers (&optional project-p)
"Kill all buffers and closes their windows. "Kill all buffers and closes their windows.
If PROJECT-P (universal argument), kill only buffers that belong to the current If PROJECT-P (universal argument), don't close windows and only kill buffers
project." that belong to the current project."
(interactive "P") (interactive "P")
(delete-other-windows) (unless project-p
(delete-other-windows))
(switch-to-buffer (doom-fallback-buffer)) (switch-to-buffer (doom-fallback-buffer))
(doom/cleanup-session)) (doom/cleanup-session (if project-p (doom-project-buffer-list))))
;;;###autoload ;;;###autoload
(defun doom/kill-other-buffers (&optional project-p) (defun doom/kill-other-buffers (&optional project-p)
@ -236,11 +237,11 @@ project."
(message "Killed %s buffers" n)))) (message "Killed %s buffers" n))))
;;;###autoload ;;;###autoload
(defun doom/cleanup-session (&optional all-p) (defun doom/cleanup-session (&optional buffer-list)
"Clean up buried buries and orphaned processes in the current workspace. If "Clean up buried buries and orphaned processes in the current workspace. If
ALL-P (universal argument), clean them up globally." ALL-P (universal argument), clean them up globally."
(interactive (list current-prefix-arg)) (interactive)
(let ((buffers (doom-buried-buffers (if all-p (buffer-list)))) (let ((buffers (doom-buried-buffers buffer-list))
(n 0)) (n 0))
(mapc #'kill-buffer buffers) (mapc #'kill-buffer buffers)
(setq n (+ n (length buffers) (doom/cleanup-processes))) (setq n (+ n (length buffers) (doom/cleanup-processes)))