Function: package-menu--list-to-prompt

package-menu--list-to-prompt is a byte-compiled function defined in package.el.gz.

Signature

(package-menu--list-to-prompt PACKAGES &optional INCLUDE-DEPENDENCIES)

Documentation

Return a string listing PACKAGES that's usable in a prompt.

PACKAGES is a list of package-desc objects. Formats the returned string to be usable in a minibuffer prompt (see package-menu--prompt-transaction-p).

If INCLUDE-DEPENDENCIES, also include the number of uninstalled dependencies.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package-menu--list-to-prompt (packages &optional include-dependencies)
  "Return a string listing PACKAGES that's usable in a prompt.
PACKAGES is a list of `package-desc' objects.
Formats the returned string to be usable in a minibuffer
prompt (see `package-menu--prompt-transaction-p').

If INCLUDE-DEPENDENCIES, also include the number of uninstalled
dependencies."
  ;; The case where `package' is empty is handled in
  ;; `package-menu--prompt-transaction-p' below.
  (format "%d (%s)%s"
          (length packages)
          (mapconcat #'package-desc-full-name packages " ")
          (let ((deps
                 (seq-remove
                  #'package-installed-p
                  (delete-dups
                   (apply
                    #'nconc
                    (mapcar (lambda (package)
                              (package--dependencies
                               (package-desc-name package)))
                            packages))))))
            (if (and include-dependencies deps)
                (if (length= deps 1)
                    (format " plus 1 dependency")
                  (format " plus %d dependencies" (length deps)))
              ""))))