1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-01 20:06:00 +00:00

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

This commit is contained in:
Artur Malabarba 2015-02-14 11:13:29 -02:00
parent 61b4c22c6e
commit 34c7535912
2 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,11 @@
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

View File

@ -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.