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 &optional NAME)

Documentation

Install the package NAME from its source directory DIR.

NAME defaults to the base name of DIR. 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.

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 &optional name)
  "Install the package NAME from its source directory DIR.
NAME defaults to the base name of DIR.
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."
  (interactive (let* ((dir (read-directory-name "Directory: "))
                      (base (file-name-base (directory-file-name dir))))
                 (list dir (and current-prefix-arg
                                (read-string
                                 (format-prompt "Package name" base)
                                 nil nil base)))))
  (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))))