[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 10:54:52 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> - (while
> - (if (and (cdr old-pkgs)
> - (version-list-< version
> - (package-desc-version (cadr
> old-pkgs))))
> - (setq old-pkgs (cdr old-pkgs))
> - (push new-pkg-desc (cdr old-pkgs))
> - nil)))
> + (progn
> + ;; Prefer newer packages
> + (while
> + (if (and (cdr old-pkgs)
> + (version-list-< version
> + (package-desc-version (cadr
> old-pkgs))))
> + (setq old-pkgs (cdr old-pkgs))
> + (push new-pkg-desc (cdr old-pkgs))
> + nil))
> + ;; Prefer VC packages
> + (let* ((pkg-desc0 (cdr (assq name package-alist)))
> + (pkg-desc
> + (apply 'append
> + (cl-reduce
> + (lambda (p1 p2)
> + (if (package-vc-p p1)
> + (push p1 (cl-first p2))
> + (push p1 (cl-second p2)))
> + p2)
> + pkg-desc0
> + :initial-value (list nil nil)
> + :from-end t))))
> + (setf pkg-desc0 pkg-desc)
> + (setq new-pkg-desc (car pkg-desc)))))
Why 2 loops? The first loop is a kind of insertion sort, so what we want is
simply to replace the
(version-list-< version (package-desc-version (cadr old-pkgs)))
test with one which places the VC packages first (tho I'm not sure why
one would need that: presumably the version in the VC package will
already be higher).
[ BTW the speed of this code can be fairly important for people who don't use
`package-quickstart`. I don't know if the added cost of the
additional loop would be significant, but it's another reason to merge
the two loops, I think. ]
Stefan
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, (continued)
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Stefan Monnier, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Евгений Бойков, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Евгений Бойков, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Eli Zaretskii, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Евгений Бойков, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Eli Zaretskii, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Ruijie Yu, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Philip Kaludercic, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Eli Zaretskii, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path, Евгений Бойков, 2023/06/04
- bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path,
Stefan Monnier <=