diff --git a/CHANGELOG.develop b/CHANGELOG.develop index d560cc020..db2dfc37a 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -508,6 +508,7 @@ Other: - Fixed bug that could overwrites customize variables (thanks to bmag) - Don't suggest ~SPC q r~ if =restart-emacs= package is missing after an update (thanks to Keshav Kini) + - spacemacs-layouts: Add Projectile project buffers to new perspectives. - Resolve symlinks in warning message about duplicate layers (thanks to Ben Gamari) - Check toggle condition in status function (thanks to Eivind Fonn) diff --git a/layers/+spacemacs/spacemacs-layouts/funcs.el b/layers/+spacemacs/spacemacs-layouts/funcs.el index fe488bb55..5bb04378d 100644 --- a/layers/+spacemacs/spacemacs-layouts/funcs.el +++ b/layers/+spacemacs/spacemacs-layouts/funcs.el @@ -689,3 +689,11 @@ containing the buffer." (append (persp-parameter 'gui-eyebrowse-window-configs persp) (persp-parameter 'term-eyebrowse-window-configs persp))) (eyebrowse--rename-window-config-buffers window-config old new))))) + + +;; Persp and Projectile integration + +(defun spacemacs//add-project-buffers-to-persp (persp _persp-hash) + (if-let ((buffers (and (projectile-project-p) + (projectile-project-buffers)))) + (persp-add-buffer buffers persp nil nil))) diff --git a/layers/+spacemacs/spacemacs-layouts/packages.el b/layers/+spacemacs/spacemacs-layouts/packages.el index 1a32c8c0d..e99a48dd1 100644 --- a/layers/+spacemacs/spacemacs-layouts/packages.el +++ b/layers/+spacemacs/spacemacs-layouts/packages.el @@ -219,6 +219,8 @@ (defadvice persp-activate (before spacemacs//save-toggle-layout activate) (setq spacemacs--last-selected-layout persp-last-persp-name)) (add-hook 'persp-mode-hook 'spacemacs//layout-autosave) + (add-hook 'persp-created-functions + #'spacemacs//add-project-buffers-to-persp) (advice-add 'persp-load-state-from-file :before 'spacemacs//layout-wait-for-modeline) ;; Override SPC TAB to only change buffers in perspective (spacemacs/set-leader-keys