                                   (ignored 'any)
                                   (sort t)
                                   changed
-                                  backend)
+                                  backend
+                                  deps)
   "Retrieves a list of primary packages (i.e. non-dependencies). Each element is
 a cons cell, whose car is the package symbol and whose cdr is the quelpa recipe
 (if any).

   :from-end t))

;;;###autoload
(defun doom-get-depending-on (name)
  "Return a list of packages that depend on the package named NAME."
  (cl-check-type name symbol)
  (when (package-built-in-p name)
    (error "Can't get the dependency tree for built-in packages"))
  (if-let* ((desc (cadr (assq name package-alist))))
      (mapcar #'package-desc-name (package--used-elsewhere-p desc nil t))
    (error "Couldn't find %s, is it installed?" name)))

;;;###autoload
(defun doom-get-dependencies-for (name &optional only)
  "Return a list of dependencies for a package."
  (cl-check-type name symbol)
  (when (package-built-in-p name)
    (error "Can't get the dependency tree for built-in packages"))
  (package--get-deps name only))

;;;###autoload
(defun doom-get-outdated-packages (&optional include-frozen-p)

  :pinned BOOL|ARCHIVE
    Only return packages that are pinned (t), not pinned (nil) or pinned to a
    specific archive (stringp)
  :deps BOOL
    Includes the package's dependencies (t).

The resulting list is sorted unless :sort nil is passed to this function.

Warning: this function is expensive, as it re-evaluates your all packages.el
files."
  (doom-initialize-packages)
  (cl-remove-duplicates
   (cl-loop with packages = (append (mapcar #'list doom-core-packages)
                                    doom-packages)
            for (sym . plist)
            in (if sort
                   (cl-sort (copy-sequence packages) #'string-lessp :key #'car)
                 packages)
            if (and (or (not backend)
                        (eq (doom-package-backend sym t) backend))
                    (or (eq ignored 'any)
                        (let* ((form (plist-get plist :ignore))
                               (value (eval form)))
                          (if ignored value (not value))))
                    (or (eq disabled 'any)
                        (if disabled
                            (plist-get plist :disable)
                          (not (plist-get plist :disable))))
                    (or (eq installed 'any)
                        (if installed
                            (doom-package-installed-p sym)
                          (not (doom-package-installed-p sym))))
                    (or (eq private 'any)
                        (if private
                            (plist-get plist :private)
                          (not (plist-get plist :private))))
                    (or (eq pinned 'any)
                        (cond ((eq pinned 't)
                               (plist-get plist :pin))
                              ((null pinned)
                               (not (plist-get plist :pin)))
                              ((equal (plist-get plist :pin) pinned)))))
            collect (cons sym plist)
            and if (and deps (not (package-built-in-p sym)))
            nconc
            (cl-loop for pkg in (doom-get-dependencies-for sym 'recursive 'noerror)
                     if (or (eq installed 'any)
                            (if installed
                                (doom-package-installed-p pkg)
                              (not (doom-package-installed-p pkg))))
                     collect (cons pkg (cdr (assq pkg doom-packages)))))
   :key #'car))

;;;###autoload
(defun doom-get-package-alist ()
