Function: projectile-switch-sibling-project

projectile-switch-sibling-project is an autoloaded, interactive and byte-compiled function defined in projectile.el.

Signature

(projectile-switch-sibling-project &optional ARG)

Documentation

Switch to a project related to the current one.

Related means grouped with it in projectile-project-groups, or sharing the owner of its upstream remote, or - failing both - starting with the same word. See projectile-sibling-project-functions.

Invokes the command referenced by projectile-switch-project-action on switch. With a prefix ARG invokes projectile-dispatch instead.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;;###autoload
(defun projectile-switch-sibling-project (&optional arg)
  "Switch to a project related to the current one.

Related means grouped with it in `projectile-project-groups', or sharing
the owner of its upstream remote, or - failing both - starting with the
same word.  See `projectile-sibling-project-functions'.

Invokes the command referenced by `projectile-switch-project-action' on
switch.  With a prefix ARG invokes `projectile-dispatch' instead."
  (interactive "P")
  (let* ((root (projectile-acquire-root))
         (siblings (seq-remove
                    (lambda (project)
                      ;; The project we're in isn't somewhere to switch to,
                      ;; and a configured group can name one that has since
                      ;; been moved away.
                      (or (file-equal-p project root)
                          (not (file-directory-p project))))
                    (projectile-sibling-projects root))))
    (unless siblings
      ;; Nothing inferred is a perfectly ordinary outcome - it's what the
      ;; share cap does when a signal relates too much - so point at the
      ;; setting that always works rather than just reporting the miss.
      (user-error "No projects related to %s found - see `projectile-project-groups'"
                  (projectile-project-name root)))
    (projectile-completing-read
     "Switch to sibling project: " siblings
     :action (lambda (project)
               (projectile-switch-project-by-name project arg))
     :category 'projectile-project)))