From 89933acbdecc0a942c8d073b1d462e837587ea61 Mon Sep 17 00:00:00 2001 From: Muneeb Shaikh Date: Wed, 24 Jan 2018 19:05:15 +0530 Subject: [PATCH] spacemacs-layouts: fix creation of perspective with ivy Fix #10240 --- layers/+spacemacs/spacemacs-layouts/funcs.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/layers/+spacemacs/spacemacs-layouts/funcs.el b/layers/+spacemacs/spacemacs-layouts/funcs.el index 773418443..34a2b6111 100644 --- a/layers/+spacemacs/spacemacs-layouts/funcs.el +++ b/layers/+spacemacs/spacemacs-layouts/funcs.el @@ -408,17 +408,24 @@ perspectives does." ;; Ivy integration +(defun spacemacs/ivy-persp-switch-project-advice (project) + (let ((persp-reset-windows-on-nil-window-conf t)) + (persp-switch project))) (defun spacemacs/ivy-persp-switch-project (arg) (interactive "P") (require 'counsel-projectile) + (advice-add 'counsel-projectile-switch-project-action + :before #'spacemacs/ivy-persp-switch-project-advice) (ivy-read "Switch to Project Perspective: " (if (projectile-project-p) (cons (abbreviate-file-name (projectile-project-root)) (projectile-relevant-known-projects)) projectile-known-projects) :action counsel-projectile-switch-project-action - :caller 'spacemacs/ivy-persp-switch-project)) + :caller 'spacemacs/ivy-persp-switch-project) + (advice-remove 'counsel-projectile-switch-project-action + 'spacemacs/ivy-persp-switch-project-advice)) ;; Eyebrowse