Function: projectile-session--select-tab-by-root

projectile-session--select-tab-by-root is a byte-compiled function defined in projectile.el.

Signature

(projectile-session--select-tab-by-root ROOT)

Documentation

Select the open project tab bound to ROOT, if any.

Returns non-nil when a tab was selected. Resolves the tab to a 1-based index in a single pass and selects by index, so it is robust to tab-bar-select-tab rebuilding tab cons cells as it switches away from the current tab (a captured cons would go stale mid-loop).

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-session--select-tab-by-root (root)
  "Select the open project tab bound to ROOT, if any.
Returns non-nil when a tab was selected.  Resolves the tab to a 1-based
index in a single pass and selects by index, so it is robust to
`tab-bar-select-tab' rebuilding tab cons cells as it switches away from
the current tab (a captured cons would go stale mid-loop)."
  (let ((index 0) (target nil))
    (dolist (tab (tab-bar-tabs))
      (setq index (1+ index))
      (when (and (not target)
                 (projectile-session--same-root-p
                  (projectile-session--tab-root tab) root))
        (setq target index)))
    (when target
      (tab-bar-select-tab target)
      t)))