diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 00bc84d09..6662b9863 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -46,7 +46,8 @@ they are absolute." ;;;###autoload (defun doom-project-name (&optional dir) "Return the name of the current project." - (let ((project-root (projectile-project-root dir))) + (let ((project-root (or (projectile-project-root dir) + (if dir (expand-file-name dir))))) (if project-root (funcall projectile-project-name-function project-root) "-"))) diff --git a/modules/feature/workspaces/autoload/workspaces.el b/modules/feature/workspaces/autoload/workspaces.el index 4464b621e..8a55d622c 100644 --- a/modules/feature/workspaces/autoload/workspaces.el +++ b/modules/feature/workspaces/autoload/workspaces.el @@ -552,8 +552,7 @@ This be hooked to `projectile-after-switch-project-hook'." (if (+workspace-buffer-list) (let* (persp-p (persp - (let* ((default-directory +workspaces--project-dir) - (project-name (doom-project-name 'nocache))) + (let ((project-name (doom-project-name +workspaces--project-dir))) (or (setq persp-p (+workspace-get project-name t)) (+workspace-new project-name)))) (new-name (persp-name persp))) @@ -569,7 +568,7 @@ This be hooked to `projectile-after-switch-project-hook'." 'success)) (with-current-buffer (switch-to-buffer (doom-fallback-buffer)) (setq default-directory +workspaces--project-dir) - (message "Switched to '%s'" (doom-project-name 'nocache))) + (message "Switched to '%s'" (doom-project-name +workspaces--project-dir))) (unless current-prefix-arg (funcall +workspaces-switch-project-function +workspaces--project-dir))) (setq +workspaces--project-dir nil)))) diff --git a/modules/ui/treemacs/autoload.el b/modules/ui/treemacs/autoload.el index b88ec058e..6f8b75a9c 100644 --- a/modules/ui/treemacs/autoload.el +++ b/modules/ui/treemacs/autoload.el @@ -9,9 +9,10 @@ (dolist (project (treemacs-workspace->projects (treemacs-current-workspace))) (treemacs-do-remove-project-from-workspace project)) (with-current-buffer origin-buffer - (treemacs-do-add-project-to-workspace - (treemacs--canonical-path (doom-project-root)) - (doom-project-name)) + (let ((project-root (or (doom-project-root) default-directory))) + (treemacs-do-add-project-to-workspace + (treemacs--canonical-path project-root) + (doom-project-name project-root))) (setq treemacs--ready-to-follow t) (when (or treemacs-follow-after-init treemacs-follow-mode) (treemacs--follow)))))