Unverified Commit fb87d500 authored by Philip Kaludercic's avatar Philip Kaludercic
Browse files

* package.el (package--get-activatable-pkg): Prefer source packages

parent f5bb6b01
......@@ -898,14 +898,22 @@ correspond to previously loaded files (those returned by
(defun package--get-activatable-pkg (pkg-name)
;; Is "activatable" a word?
(let ((pkg-descs (cdr (assq pkg-name package-alist))))
(let ((pkg-descs (sort (cdr (assq pkg-name package-alist))
(lambda (p1 p2)
(let ((v1 (package-desc-version p1))
(v2 (package-desc-version p2)))
;; Prefer source packages.
(eq (package-desc-kind p1) 'vc)
(not (eq (package-desc-kind p2) 'vc))
;; Prefer builtin packages.
(package-disabled-p p1 v1)
(not (package-disabled-p p2 v2))))))))
;; Check if PACKAGE is available in `package-alist'.
(when pkg-descs
(let ((available-version (package-desc-version (car pkg-descs))))
(or (package-disabled-p pkg-name available-version)
;; Prefer a builtin package.
(package-built-in-p pkg-name available-version))))
(package-disabled-p pkg-name available-version)))
(setq pkg-descs (cdr pkg-descs)))
(car pkg-descs)))
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