Function: package-vc-install-from-checkout

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

Signature

(package-vc-install-from-checkout DIR NAME)

Documentation

Set up the package NAME in DIR by linking it into the ELPA directory.

Interactively, prompt the user for DIR, which should be a directory under version control, typically one created by package-vc-checkout. If invoked interactively with a prefix argument, prompt the user for the NAME of the package to set up. Otherwise infer the package name from the base name of DIR.

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-install-from-checkout (dir name)
  "Set up the package NAME in DIR by linking it into the ELPA directory.
Interactively, prompt the user for DIR, which should be a directory
under version control, typically one created by `package-vc-checkout'.
If invoked interactively with a prefix argument, prompt the user
for the NAME of the package to set up.  Otherwise infer the package
name from the base name of DIR."
  (interactive (let ((dir (read-directory-name "Directory: ")))
                 (list dir
                       (if current-prefix-arg
                           (read-string "Package name: ")
                         (file-name-base (directory-file-name dir))))))
  (unless (vc-responsible-backend dir)
    (user-error "Directory %S is not under version control" dir))
  (package-vc--archives-initialize)
  (let* ((name (or name (file-name-base (directory-file-name dir))))
         (pkg-dir (expand-file-name name package-user-dir)))
    (when (file-exists-p pkg-dir)
      (if (yes-or-no-p (format "Overwrite previous checkout for package `%s'?" name))
          (package--delete-directory pkg-dir)
        (error "There already exists a checkout for %s" name)))
    (make-symbolic-link (expand-file-name dir) pkg-dir)
    (package-vc--unpack-1
     (package-desc-create
      :name (intern name)
      :dir pkg-dir
      :kind 'vc)
     (file-name-as-directory pkg-dir))))