summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-10-16 23:54:38 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-10-16 23:55:26 +0100
commit8868b834022379f81268b387363cd6a3ff1214b4 (patch)
tree6b5cc40f733ded591cc891e8f8397dc92e033a53 /lisp/emacs-lisp
parent55ba8c022b493b494bea257e4f523758154e0fdd (diff)
downloademacs-8868b834022379f81268b387363cd6a3ff1214b4.tar.gz
emacs-8868b834022379f81268b387363cd6a3ff1214b4.tar.bz2
emacs-8868b834022379f81268b387363cd6a3ff1214b4.zip
* emacs-lisp/package.el: Reload archive-contents if priorities change
(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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 89f2a1a011b..2dbcdf64940 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -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;