Commit 34c75359 authored by Artur Malabarba's avatar Artur Malabarba
Browse files

emacs-lisp/package.el: Move the compatibility-table building logic.

parent 61b4c22c
2015-02-14 Artur Malabarba <bruce.connor.am@gmail.com>
* emacs-lisp/package.el (package-read-all-archive-contents): Don't
build the compatibility table.
(package-refresh-contents, package-initialize): Do build the
compatibility table.
(package--build-compatibility-table): New function.
2015-02-14 Stefan Monnier <monnier@iro.umontreal.ca>
 
* emacs-lisp/cl-preloaded.el (cl-struct-define): Register as children
......
......@@ -1144,10 +1144,7 @@ Will throw an error if the archive version is too new."
If successful, set `package-archive-contents'."
(setq package-archive-contents nil)
(dolist (archive package-archives)
(package-read-archive-contents (car archive)))
;; Build compat table.
(setq package--compatibility-table (make-hash-table :test 'eq))
(package--mapc #'package--add-to-compatibility-table))
(package-read-archive-contents (car archive))))
(defun package-read-archive-contents (archive)
"Re-read archive contents for ARCHIVE.
......@@ -1691,6 +1688,12 @@ similar to an entry in `package-alist'. Save the cached copy to
(epg-import-keys-from-file context file)
(message "Importing %s...done" (file-name-nondirectory file))))
(defun package--build-compatibility-table ()
"Build `package--compatibility-table' with `package--mapc'."
;; Build compat table.
(setq package--compatibility-table (make-hash-table :test 'eq))
(package--mapc #'package--add-to-compatibility-table))
;;;###autoload
(defun package-refresh-contents ()
"Download the ELPA archive description if needed.
......@@ -1713,7 +1716,8 @@ makes them available for download."
(package--download-one-archive archive "archive-contents")
(error (message "Failed to download `%s' archive."
(car archive)))))
(package-read-all-archive-contents))
(package-read-all-archive-contents)
(package--build-compatibility-table))
(defun package--find-non-dependencies ()
"Return a list of installed packages which are not dependencies.
......@@ -1742,7 +1746,10 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
(unless no-activate
(dolist (elt package-alist)
(package-activate (car elt))))
(setq package--initialized t))
(setq package--initialized t)
;; This uses `package--mapc' so it must be called after
;; `package--initialized' is t.
(package--build-compatibility-table))
(defun package--add-to-compatibility-table (pkg)
"If PKG is compatible (without dependencies), add to the compatibility table.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment