Integrate counsel-projectile-switch-project & restore file prompt when switching projects

This commit is contained in:
Henrik Lissner 2018-01-28 03:34:18 -05:00
parent d0cce3cafb
commit 3578d433c2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 21 additions and 3 deletions

View file

@ -479,6 +479,19 @@ created."
`+workspaces|switch-to-project'."
(setq +workspaces--project-dir default-directory))
;;;###autoload
(defun +workspaces|switch-counsel-project-action (project)
"A `counsel-projectile-switch-project-action' that creates a dedicated
workspace for a new project, before prompting to open a file."
(when persp-mode
(let ((+workspaces--project-dir project)
(inhibit-message t))
(+workspaces|switch-to-project)))
(counsel-projectile-switch-project-action project)
(+workspace-message
(format "Switched to '%s' in new workspace" new-name)
'success))
;;;###autoload
(defun +workspaces|switch-to-project ()
"Creates a workspace dedicated to a new project. Should be hooked to
@ -491,6 +504,9 @@ created."
(new-name (persp-name persp)))
(+workspace-switch new-name)
(switch-to-buffer (doom-fallback-buffer))
(call-interactively
(or (command-remapping #'projectile-find-file)
#'projectile-find-file))
(+workspace-message
(format "Switched to '%s' in new workspace" new-name)
'success))