   "Open eshell in a separate workspace. Requires the (:feature workspaces)
 module to be loaded."
   (interactive "P")
-  (let ((default-directory (if arg default-directory (doom-project-root)))
+  (let ((default-directory (or (if arg default-directory (doom-project-root))
+                               default-directory))
         (buf (+eshell--unused-buffer 'new)))
     (set-frame-parameter nil 'saved-wconf (current-window-configuration))
     (delete-other-windows)

  (interactive "P")
  (when (eq major-mode 'eshell-mode)
    (user-error "Already in an eshell buffer"))
  (let* ((default-directory (if arg default-directory (doom-project-root)))
         (buf (+eshell--unused-buffer)))
    (with-current-buffer (switch-to-buffer buf)
      (if (eq major-mode 'eshell-mode)

(defun +eshell/open-popup (arg &optional command)
  "Open eshell in a popup window."
  (interactive "P")
  (let* ((default-directory (or (if arg default-directory (doom-project-root))
                                default-directory))
         (buf (+eshell--unused-buffer)))
    (with-current-buffer (pop-to-buffer buf)
      (if (eq major-mode 'eshell-mode)
