]> code.delx.au - gnu-emacs/commitdiff
* emacs-lisp/package.el: Reload archive-contents if priorities change
authorArtur Malabarba <bruce.connor.am@gmail.com>
Fri, 16 Oct 2015 22:54:38 +0000 (23:54 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Fri, 16 Oct 2015 22:55:26 +0000 (23:55 +0100)
(package--old-archive-priorities): New variable.
(package-read-all-archive-contents, package-menu--refresh): Use it
to decide when the `package-archive-contents' needs to be read
again.

lisp/emacs-lisp/package.el

index 89f2a1a011b9e541a6e18de8b3833c58f6789430..2dbcdf649408bb0fffd77c3d139c459b6c47e719 100644 (file)
@@ -1364,10 +1364,18 @@ If the archive version is too new, signal an error."
       (dolist (package contents)
         (package--add-to-archive-contents package archive)))))
 
+(defvar package--old-archive-priorities nil
+  "Store currently used `package-archive-priorities'.
+This is the value of `package-archive-priorities' last time
+`package-read-all-archive-contents' was called.  It can be used
+by arbitrary functions to decide whether it is necessary to call
+it again.")
+
 (defun package-read-all-archive-contents ()
   "Re-read `archive-contents', if it exists.
 If successful, set `package-archive-contents'."
   (setq package-archive-contents nil)
+  (setq package--old-archive-priorities package-archive-priorities)
   (dolist (archive package-archives)
     (package-read-archive-contents (car archive))))
 
@@ -2675,6 +2683,8 @@ KEYWORDS should be nil or a list of keywords."
             (push pkg info-list)))))
 
     ;; Available and disabled packages:
+    (unless (equal package--old-archive-priorities package-archive-priorities)
+      (package-read-all-archive-contents))
     (dolist (elt package-archive-contents)
       (let ((name (car elt)))
         ;; To be displayed it must be in PACKAGES;