tools/eshell: fix overeager cleanup deleting other windows along with eshell

This commit is contained in:
Henrik Lissner 2018-03-28 17:32:26 -04:00
parent 5ca78c3984
commit 3fb7b24544
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -115,19 +115,11 @@ module to be loaded."
;; Hooks
;;
;;;###autoload
(defun +eshell|delete-window ()
(if (one-window-p)
(unless (doom-real-buffer-p (progn (previous-buffer) (current-buffer)))
(switch-to-buffer (doom-fallback-buffer)))
(delete-window)))
;;;###autoload
(defun +eshell|init ()
"Keep track of eshell buffers."
(let ((buf (current-buffer)))
(remove-hook 'kill-buffer-query-functions #'doom|protect-visible-buffers t)
(add-hook 'kill-buffer-hook #'+eshell|delete-window nil t)
(dolist (buf (ring-elements +eshell-buffers))
(unless (buffer-live-p buf)
(+eshell--remove-buffer buf)))
@ -138,9 +130,14 @@ module to be loaded."
(defun +eshell|cleanup ()
"Close window (or workspace) on quit."
(+eshell--remove-buffer (current-buffer))
(when (and (featurep! :feature workspaces)
(string= "eshell" (+workspace-current-name)))
(+workspace/delete "eshell")))
(cond ((and (featurep! :feature workspaces)
(string= "eshell" (+workspace-current-name)))
(+workspace/delete "eshell"))
((one-window-p)
(unless (doom-real-buffer-p (progn (previous-buffer) (current-buffer)))
(switch-to-buffer (doom-fallback-buffer))))
((delete (current-buffer) (get-buffer-window-list))
(delete-window))))
;;