Output feedback from buffer/session kill commands
This commit is contained in:
parent
491e80a568
commit
a49c0b6691
2 changed files with 37 additions and 24 deletions
|
@ -272,6 +272,12 @@ If DONT-SAVE, don't prompt to save modified buffers (discarding their changes)."
|
|||
(set-buffer-modified-p nil)))
|
||||
(doom-kill-buffer-fixup-windows buffer))
|
||||
|
||||
|
||||
(defun doom--message-or-count (interactive message count)
|
||||
(if interactive
|
||||
(message message count)
|
||||
count))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-all-buffers (&optional buffer-list interactive)
|
||||
"Kill all buffers and closes their windows.
|
||||
|
@ -290,10 +296,10 @@ belong to the current project."
|
|||
(when (memq (current-buffer) buffer-list)
|
||||
(switch-to-buffer (doom-fallback-buffer)))
|
||||
(mapc #'kill-buffer buffer-list)
|
||||
(when interactive
|
||||
(message "Killed %s buffers"
|
||||
(doom--message-or-count
|
||||
interactive "Killed %d buffers"
|
||||
(- (length buffer-list)
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list)))))))
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-other-buffers (&optional buffer-list interactive)
|
||||
|
@ -308,10 +314,10 @@ project."
|
|||
(doom-buffer-list)))
|
||||
t))
|
||||
(mapc #'doom-kill-buffer-and-windows buffer-list)
|
||||
(when interactive
|
||||
(message "Killed %s buffers"
|
||||
(doom--message-or-count
|
||||
interactive "Killed %d other buffers"
|
||||
(- (length buffer-list)
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list))))))
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-matching-buffers (pattern &optional buffer-list interactive)
|
||||
|
@ -341,10 +347,10 @@ current project."
|
|||
(if current-prefix-arg (doom-project-buffer-list)))
|
||||
t))
|
||||
(mapc #'kill-buffer buffer-list)
|
||||
(when interactive
|
||||
(message "Killed %s buried buffers"
|
||||
(doom--message-or-count
|
||||
interactive "Killed %d buried buffers"
|
||||
(- (length buffer-list)
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list))))))
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-project-buffers (project &optional interactive)
|
||||
|
@ -362,9 +368,9 @@ current project."
|
|||
nil)
|
||||
t))
|
||||
(when project
|
||||
(let ((buffers (doom-project-buffer-list project)))
|
||||
(doom-kill-buffers-fixup-windows buffers)
|
||||
(when interactive
|
||||
(message "Killed %d buffer(s)"
|
||||
(- (length buffers)
|
||||
(length (cl-remove-if-not #'buffer-live-p buffers))))))))
|
||||
(let ((buffer-list (doom-project-buffer-list project)))
|
||||
(doom-kill-buffers-fixup-windows buffer-list)
|
||||
(doom--message-or-count
|
||||
interactive "Killed %d project buffers"
|
||||
(- (length buffer-list)
|
||||
(length (cl-remove-if-not #'buffer-live-p buffer-list)))))))
|
||||
|
|
|
@ -268,13 +268,20 @@ workspace to delete."
|
|||
('error (+workspace-error ex t))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace/kill-session ()
|
||||
(defun +workspace/kill-session (&optional interactive)
|
||||
"Delete the current session, all workspaces, windows and their buffers."
|
||||
(interactive)
|
||||
(interactive (list t))
|
||||
(let ((windows (length (window-list)))
|
||||
(persps (length (+workspace-list-names)))
|
||||
(buffers 0))
|
||||
(let ((persp-autokill-buffer-on-remove t))
|
||||
(unless (cl-every #'+workspace-delete (+workspace-list-names))
|
||||
(+workspace-error "Could not clear session"))
|
||||
(+workspace-error "Could not clear session")))
|
||||
(+workspace-switch +workspaces-main t)
|
||||
(doom/kill-all-buffers (buffer-list)))
|
||||
(setq buffers (doom/kill-all-buffers (buffer-list)))
|
||||
(when interactive
|
||||
(message "Killed %d workspace(s), %d window(s) & %d buffer(s)"
|
||||
persps windows buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspace/kill-session-and-quit ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue