Function: projectile-session-switch-project-action

projectile-session-switch-project-action is a byte-compiled function defined in projectile.el.

Signature

(projectile-session-switch-project-action)

Documentation

Tab-aware switch action installed by projectile-session-mode(var)/projectile-session-mode(fun).

When the target project already has a tab, select it and restore its live window layout instead of re-running the switch action. Otherwise create a new tab for the project and either restore its saved session (see projectile-session-restore-on-switch) or populate it by calling projectile-session-default-action.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-session-switch-project-action ()
  "Tab-aware switch action installed by `projectile-session-mode'.
When the target project already has a tab, select it and restore its
live window layout instead of re-running the switch action.  Otherwise
create a new tab for the project and either restore its saved session (see
`projectile-session-restore-on-switch') or populate it by calling
`projectile-session-default-action'."
  (let* ((root (projectile-project-root))
         (tab (and root (projectile-session--project-tab root))))
    (cond
     (tab (projectile-session--select-tab tab))
     (root
      (projectile-session--make-project-tab root)
      ;; Bind `default-directory' so the populate action lists the new
      ;; project regardless of what buffer `tab-bar-new-tab' left current
      ;; (e.g. a non-default `tab-bar-new-tab-choice').
      (let ((default-directory root))
        (unless (and projectile-session-restore-on-switch
                     (projectile-session--saved-p root)
                     (projectile-session-restore root))
          (funcall projectile-session-default-action))))
     (t (funcall projectile-session-default-action)))))