Function: package-vc-checkout

package-vc-checkout is an autoloaded, interactive and byte-compiled function defined in package-vc.el.gz.

Signature

(package-vc-checkout PKG-DESC DIRECTORY &optional REV)

Documentation

Clone the sources for PKG-DESC into DIRECTORY and visit that directory.

Unlike package-vc-install, this does not yet set up the package for use with Emacs; use package-vc-install-from-checkout for setting the package up after this function finishes. Optional argument REV means to clone a specific version of the package; it defaults to the last version available from the package's repository. If REV has the special value
:last-release (interactively, the prefix argument), that stands
for the last released version of the package.

View in manual

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package-vc.el.gz
;;;###autoload
(defun package-vc-checkout (pkg-desc directory &optional rev)
  "Clone the sources for PKG-DESC into DIRECTORY and visit that directory.
Unlike `package-vc-install', this does not yet set up the package
for use with Emacs; use `package-vc-install-from-checkout' for
setting the package up after this function finishes.  Optional
argument REV means to clone a specific version of the package; it
defaults to the last version available from the package's
repository.  If REV has the special value
`:last-release' (interactively, the prefix argument), that stands
for the last released version of the package."
  (interactive
   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
     (list (cadr (assoc name package-archive-contents #'string=))
           (read-directory-name "Clone into new or empty directory: " nil nil
                                (lambda (dir) (or (not (file-exists-p dir))
                                             (directory-empty-p dir))))
           (and current-prefix-arg :last-release))))
  (package-vc--archives-initialize)
  (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                      (and-let* ((extras (package-desc-extras pkg-desc))
                                 (url (alist-get :url extras))
                                 (backend (vc-guess-url-backend url)))
                        (list :vc-backend backend :url url))
                      (user-error "Package `%s' has no VC data"
                                  (package-desc-name pkg-desc)))))
    (package-vc--clone pkg-desc pkg-spec directory rev)
    (find-file directory)))