Function: package-vc--read-package-name

package-vc--read-package-name is a byte-compiled function defined in package-vc.el.gz.

Signature

(package-vc--read-package-name PROMPT &optional ALLOW-URL INSTALLED)

Documentation

Query the user for a VC package and return a name with PROMPT.

If the optional argument ALLOW-URL is non-nil, the user is also allowed to specify a non-package name. If the optional argument INSTALLED is non-nil, the selection will be filtered down to VC packages that have already been installed.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package-vc.el.gz
(defun package-vc--read-package-name (prompt &optional allow-url installed)
  "Query the user for a VC package and return a name with PROMPT.
If the optional argument ALLOW-URL is non-nil, the user is also
allowed to specify a non-package name.  If the optional argument
INSTALLED is non-nil, the selection will be filtered down to
VC packages that have already been installed."
  (package-vc--archives-initialize)
  (completing-read prompt (if installed package-alist package-archive-contents)
                   (if installed
                       (lambda (pkg) (package-vc-p (cadr pkg)))
                     (lambda (pkg)
                       (or (package-vc--desc->spec (cadr pkg))
                           ;; If we have no explicit VC data, we can try a kind of
                           ;; heuristic and use the URL header, that might already be
                           ;; pointing towards a repository, and use that as a backup
                           (and-let* ((extras (package-desc-extras (cadr pkg)))
                                      (url (alist-get :url extras))
                                      ((package-vc--guess-backend url)))))))
                   (not allow-url)))