doom-force-kill-buffer => doom/kill-this-buffer-in-all-windows
This commit is contained in:
parent
6279241ec3
commit
f61d7c9e7f
2 changed files with 16 additions and 14 deletions
|
@ -186,19 +186,6 @@ See `doom-real-buffer-p' for what 'real' means."
|
|||
(kill-buffer buffer)))
|
||||
(not (eq (current-buffer) buffer))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-force-kill-buffer (&optional buffer dont-save)
|
||||
"Kill BUFFER globally and ensure all windows previously showing BUFFER have
|
||||
switched to a real buffer."
|
||||
(interactive)
|
||||
(let* ((buffer (or buffer (current-buffer)))
|
||||
(windows (get-buffer-window-list buffer nil t)))
|
||||
(doom-kill-buffer buffer dont-save)
|
||||
(dolist (win windows)
|
||||
(with-selected-window win
|
||||
(unless (doom-real-buffer-p)
|
||||
(doom/previous-buffer))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-kill-buffer-and-windows (buffer)
|
||||
"Kill the buffer and delete all the windows it's displayed in."
|
||||
|
@ -239,6 +226,21 @@ regex PATTERN. Returns the number of killed buffers."
|
|||
(when (and (not (doom-kill-buffer)) interactive-p)
|
||||
(message "Nowhere left to go!")))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-this-buffer-in-all-windows (buffer &optional dont-save)
|
||||
"Kill BUFFER globally and ensure all windows previously showing this buffer
|
||||
have switched to a real buffer.
|
||||
|
||||
If DONT-SAVE, don't prompt to save modified buffers (discarding their changes)."
|
||||
(interactive
|
||||
(list (current-buffer) current-prefix-arg))
|
||||
(cl-assert (bufferp buffer) t)
|
||||
(let ((windows (get-buffer-window-list buffer nil t)))
|
||||
(doom-kill-buffer buffer dont-save)
|
||||
(cl-loop for win in windows
|
||||
if (doom-real-buffer-p (window-buffer win))
|
||||
do (with-selected-window win (doom/previous-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/kill-all-buffers (&optional project-p)
|
||||
"Kill all buffers and closes their windows.
|
||||
|
|
|
@ -35,7 +35,7 @@ kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)."
|
|||
(error "Failed to delete %s" short-path)
|
||||
;; Ensures that windows displaying this buffer will be switched
|
||||
;; to real buffers (`doom-real-buffer-p')
|
||||
(doom-force-kill-buffer buf t)
|
||||
(doom/kill-this-buffer-in-all-windows buf t)
|
||||
(+evil--forget-file fname)
|
||||
(message "Successfully deleted %s" short-path))))))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue