feature/workspaces: add +workspaces-on-switch-project-behavior #836
To control when a new workspace is created when switching projectile projects.
This commit is contained in:
parent
63b195b133
commit
6515efa19e
2 changed files with 13 additions and 1 deletions
|
@ -549,7 +549,9 @@ This be hooked to `projectile-after-switch-project-hook'."
|
|||
(setq +workspaces--project-dir dir))
|
||||
(when (and persp-mode +workspaces--project-dir)
|
||||
(unwind-protect
|
||||
(if (+workspace-buffer-list)
|
||||
(if (and (not (null +workspaces-on-switch-project-behavior))
|
||||
(or (eq +workspaces-on-switch-project-behavior t)
|
||||
(+workspace-buffer-list)))
|
||||
(let* (persp-p
|
||||
(persp
|
||||
(let ((project-name (doom-project-name +workspaces--project-dir)))
|
||||
|
|
|
@ -25,6 +25,16 @@ new project directory.")
|
|||
"The basename of the file to store single workspace perspectives. Will be
|
||||
stored in `persp-save-dir'.")
|
||||
|
||||
(defvar +workspaces-on-switch-project-behavior 'non-empty
|
||||
"Controls the behavior of workspaces when switching to a new project.
|
||||
|
||||
Can be one of the following:
|
||||
|
||||
t Always create a new workspace for the project
|
||||
'non-empty Only create a new workspace if the current one has no buffers
|
||||
associated with it.
|
||||
nil Never create a new workspace on project switch.")
|
||||
|
||||
;; If emacs is passed --restore, restore the last session on startup. This is
|
||||
;; used by the `+workspace/restart-emacs-then-restore' command.
|
||||
(defun +workspaces-restore-last-session (&rest _)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue