Fix new workspace & file prompt on project switch
Properly initialize a new workspace, switch to the fallback buffer (scratch/dash), update its default-directory to the project root, and fuzzy-prompt for a file to open.
This commit is contained in:
parent
85c28444b3
commit
6d44cec666
2 changed files with 16 additions and 9 deletions
|
@ -459,12 +459,6 @@ the workspace and move to the next."
|
|||
(+workspace/new)
|
||||
(set-frame-parameter frame 'assoc-persp (+workspace-current-name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspaces|create-project-workspace ()
|
||||
"Create a new workspace when switching project with `projectile'."
|
||||
(when persp-mode
|
||||
(+workspace-switch (projectile-project-name) t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspaces|delete-associated-workspace-maybe (frame)
|
||||
"Delete workspace associated with current frame IF it has no real buffers."
|
||||
|
@ -480,3 +474,15 @@ the workspace and move to the next."
|
|||
(when (doom-real-buffer-list)
|
||||
(apply orig-fn args))
|
||||
t)
|
||||
|
||||
;;;###autoload
|
||||
(defun +workspaces*switch-project-by-name (orig-fn &rest args)
|
||||
"Switch to a project and prompt for a file to open.
|
||||
|
||||
Ensures the scratch (or dashboard) buffers are CDed into the project's root."
|
||||
(when persp-mode
|
||||
(+workspace-switch (car args) t)
|
||||
(with-current-buffer (switch-to-buffer (doom-fallback-buffer))
|
||||
(setq default-directory (car args))))
|
||||
(apply orig-fn args))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue