 
 (defun +eshell--remove-buffer (buf)
   (when-let* ((idx (ring-member +eshell-buffers buf)))
-    (ring-remove +eshell-buffers idx)))
+    (ring-remove +eshell-buffers idx)
+    t))
 
 (defun +eshell--current-git-branch ()
   (let ((branch (car (cl-loop for match in (split-string (shell-command-to-string "git branch") "\n")

                 return buf))
      (generate-new-buffer +eshell-buffer-name)))

;;;###autoload
(defun +eshell-prompt ()
  "Generate the prompt string for eshell. Use for `eshell-prompt-function'."

    (dolist (buf (ring-elements +eshell-buffers))
      (unless (buffer-live-p buf)
        (+eshell--remove-buffer buf)))
    (+eshell--add-buffer buf)
    (setq +eshell-last-buffer buf)))

;;;###autoload
(defun +eshell|cleanup ()
  "Close window (or workspace) on quit."
  (let ((buf (current-buffer)))
    (when (+eshell--remove-buffer buf)
      (+eshell--set-window (get-buffer-window buf) nil)
      (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))))
            ((and (fboundp '+popup-window-p) (+popup-window-p))
             (delete-window))))))


;;
