bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63757: 29.0.91 order of package paths changed: random old versions o


From: Stefan Monnier
Subject: bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path
Date: Sun, 04 Jun 2023 11:47:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> I'd need to see the actual patch, but right now I'm inclined to leave
> this problem unsolved in Emacs 29.  It only happens for people who
> don't uninstall older versions of packages they install, and that's
> not the workflow we support in Emacs 29.  The offending code was with
> us since Aug 2022, so replacing it with something at the last moment
> needs a very good reason.

Actually, here's the patch that I'd suggest.
It reverts the code to its Jan 2021 state, which, in my book, makes it
safe enough.

The current sort predicate is quite severely broken, so "no sort" can't
be worse (especially since the list is supposed to be sorted already).
Also it re-instates the "prefer a builtin package" which was lost along
the way.


        Stefan


diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 8f266186d5e..7d5946fbfa9 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -924,22 +924,14 @@ package-activate-1
 
 (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 (cdr (assq pkg-name package-alist))))
     ;; Check if PACKAGE is available in `package-alist'.
     (while
         (when pkg-descs
           (let ((available-version (package-desc-version (car pkg-descs))))
-            (package-disabled-p pkg-name available-version)))
+            (or (package-disabled-p pkg-name available-version)
+                ;; Prefer a builtin package.
+                (package-built-in-p pkg-name available-version))))
       (setq pkg-descs (cdr pkg-descs)))
     (car pkg-descs)))
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]