Function: projectile-session--saved-roots

projectile-session--saved-roots is a byte-compiled function defined in projectile.el.

Signature

(projectile-session--saved-roots)

Documentation

Return the roots of every project with a session saved on disk.

Scan projectile-session-directory for session files, read each (skipping any that is unreadable or of a mismatched version, via projectile-session--read-file), and collect the :root it stores. The result is sorted so projectile-session-restore-all reopens tabs in a stable order across calls and restarts.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-session--saved-roots ()
  "Return the roots of every project with a session saved on disk.
Scan `projectile-session-directory' for session files, read each (skipping
any that is unreadable or of a mismatched version, via
`projectile-session--read-file'), and collect the `:root' it stores.  The
result is sorted so `projectile-session-restore-all' reopens tabs in a
stable order across calls and restarts."
  (let ((dir projectile-session-directory)
        (roots '()))
    (when (file-directory-p dir)
      (dolist (file (directory-files dir t "\\.eld\\'"))
        (let ((data (ignore-errors (projectile-session--read-file file))))
          ;; require a string root: a corrupt/hand-edited file with a
          ;; non-string `:root' would otherwise crash the `sort' below and
          ;; (via the startup handler's guard) silently disable all restore
          (when-let* ((root (plist-get data :root))
                      ((stringp root)))
            (push root roots)))))
    (sort roots #'string-lessp)))