Sort didn't exist before fb87d500
- (let ((pkg-descs (cdr (assq pkg-name package-alist))))
+ (let ((pkg-descs (sort (cdr (assq pkg-name package-alist))
We can fix incorrect sorting
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ba0e3618f28..228d77b54e7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -916,17 +916,18 @@ correspond to previously loaded files."
(defun package--get-activatable-pkg (pkg-name)
;; Is "activatable" a word?
- (let ((pkg-descs (sort (cdr (assq pkg-name package-alist))
- (lambda (p1 p2)
- (let ((v1 (package-desc-version p1))
- (v2 (package-desc-version p2)))
- (or
- ;; Prefer VC packages.
- (package-vc-p p1)
- (package-vc-p p2)
- ;; Prefer builtin packages.
- (package-disabled-p p1 v1)
- (not (package-disabled-p p2 v2))))))))
+ (let ((pkg-descs
+ ;; Prefer VC packages
+ (apply 'append
+ (cl-reduce
+ (lambda (p1 p2)
+ (if (package-vc-p p1)
+ (push p1 (cl-first p2))
+ (push p1 (cl-second p2)))
+ p2)
+ (cdr (assq pkg-name package-alist))
+ :initial-value (list nil nil)
+ :from-end t))))
;; Check if PACKAGE is available in `package-alist'.
(while
(when pkg-descs
or just revert fb87d500