Function: projectile-session-restore
projectile-session-restore is an autoloaded, interactive and
byte-compiled function defined in projectile.el.
Signature
(projectile-session-restore &optional PROJECT)
Documentation
Restore PROJECT's saved session into the selected frame.
PROJECT defaults to the current project's root. Buffers are recreated first, then the saved window layout is put back; windows whose buffer can't be recreated fall back to a placeholder. Return non-nil when a session was restored.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;;###autoload
(defun projectile-session-restore (&optional project)
"Restore PROJECT's saved session into the selected frame.
PROJECT defaults to the current project's root. Buffers are recreated
first, then the saved window layout is put back; windows whose buffer
can't be recreated fall back to a placeholder. Return non-nil when a
session was restored."
(interactive)
(let* ((root (or project (projectile-project-root)))
(data (and root (projectile-session--read root))))
(cond
(data
(let ((recreated nil))
(dolist (saved (plist-get data :buffers))
(when (ignore-errors (buffer-live-p (projectile-session--recreate-buffer saved)))
(setq recreated t)))
(cond
(recreated
(let ((state (plist-get data :window-state)))
(when state
;; A hand-edited or corrupt :window-state that still passes the
;; version check shouldn't abort the whole restore - fall through
;; to the recreated buffers instead, matching the buffer-recreation
;; guard above and the file-read robustness elsewhere here.
(condition-case err
(window-state-put (projectile-session--sanitize-window-state state)
(frame-root-window) 'safe)
(error
(message "projectile-session: could not restore window layout: %S" err)))))
t)
;; Nothing could be recreated (every saved file is gone, say);
;; return nil so `restore-on-switch' falls back to populating the
;; tab instead of leaving the user in an all-placeholder frame.
(t
(when (called-interactively-p 'any)
(message "No buffers could be restored for %s" (or root "current project")))
nil))))
((called-interactively-p 'any)
(user-error "No saved session for %s" (or root "current project"))))))