Function: ghostel-desktop-restore-buffer

ghostel-desktop-restore-buffer is an autoloaded and natively compiled function defined in ghostel-desktop.el.

Signature

(ghostel-desktop-restore-buffer FILE-NAME BUFFER-NAME MISC)

Documentation

Restore a ghostel terminal named BUFFER-NAME from desktop data MISC.

MISC is (DIRECTORY IDENTITY) as saved by ghostel-desktop-save-buffer. Reuse a live buffer matching IDENTITY, else start a fresh shell in DIRECTORY under BUFFER-NAME -- skipping remote directories and command identities, with a message. Return the buffer, or nil when skipping.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-desktop.el
;;;###autoload
(defun ghostel-desktop-restore-buffer (_file-name buffer-name misc)
  "Restore a ghostel terminal named BUFFER-NAME from desktop data MISC.
MISC is (DIRECTORY IDENTITY) as saved by `ghostel-desktop-save-buffer'.
Reuse a live buffer matching IDENTITY, else start a fresh shell in DIRECTORY
under BUFFER-NAME -- skipping remote directories and command identities,
with a message.  Return the buffer, or nil when skipping."
  (pcase-let ((`(,dir ,identity) misc))
    ;; Desktop files are external data; treat a non-alist identity as absent.
    (unless (consp identity) (setq identity nil))
    (if (not (stringp dir))
        (progn
          (message "Desktop: no directory recorded for ghostel buffer %s"
                   buffer-name)
          nil)
      (let ((buf (or (ghostel-desktop--reuse identity buffer-name)
                     (ghostel-desktop--spawn dir identity buffer-name))))
        (when buf
          (ghostel-desktop--shield-replay buf))
        buf))))