                      (version-to-list ver)
                    old-version)))
               ('elpa
-               (doom-refresh-packages)
                (let ((desc (cadr (assq name package-archive-contents))))
                  (when (package-desc-p desc)
                    (package-desc-version desc)))))))

(defun doom-refresh-packages (&optional force-p)
  "Refresh ELPA packages."
  (doom-initialize)
  (when (or force-p (getenv "DEBUG"))
    (doom-refresh-clear-cache))
  (unless (persistent-soft-fetch 'last-pkg-refresh "emacs")
    (condition-case ex
        (progn
          (package-refresh-contents)
          (persistent-soft-store 'last-pkg-refresh t "emacs" 900))
    ('error
     (doom-refresh-clear-cache)))))

;;;###autoload
(defun doom-refresh-clear-cache ()

           (message! (yellow "Aborted!")))

          (t
           (doom-refresh-packages doom-debug-mode)
           (dolist (pkg packages)
             (message! "Installing %s" (car pkg))
             (doom--condition-case!
