Hi list, where can I find information on how package.el handles packages that are listed twice in the buffer that `M-x list-packages' creates? The file package.el is very big and I find its code hard to follow, so any hints like "read the commments in the places foo and bar" would help a lot... Here is an example (to make this question more interesting)... "afternoon-theme" is one of these packages, and if I define these two functions (defun my-p1 () (interactive) (setq my-p1 (tabulated-list-get-id))) (defun my-p2 () (interactive) (setq my-p2 (tabulated-list-get-id))) and I run `M-x my-p1' on the line with the first "afternoon-theme" and `M-x my-p2' on the second, then I can inspect the variables my-p1 and my-p2 with: (describe-variable 'my-p1) (describe-variable 'my-p2) One of them has these entries, :version (0 1) :archive "nongnu" and the other has these: :version (20140104 1859) :archive "melpa" and if I run this, (setq my-ps (cl-loop for (name pdesc) in package-archive-contents if (eq name 'afternoon-theme) collect (list name pdesc))) (describe-variable 'my-ps) I see only one entry in package-archive-contents - the one in MELPA... Thanks in advance, Eduardo Ochs http://angg.twu.net/#eev http://angg.twu.net/eepitch.html
Eduardo Ochs [2022-11-24 20:43:00] wrote: > where can I find information on how package.el handles packages that > are listed twice in the buffer that `M-x list-packages' creates? Hmm... in `package.el`? More seriously, I don't think it's clearly documented there, so better ask more precise questions. > and I run `M-x my-p1' on the line with the first "afternoon-theme" and > `M-x my-p2' on the second, then I can inspect the variables my-p1 and > my-p2 with: > > (describe-variable 'my-p1) > (describe-variable 'my-p2) > > One of them has these entries, > > :version (0 1) > :archive "nongnu" > > and the other has these: > > :version (20140104 1859) > :archive "melpa" > > and if I run this, > > (setq my-ps > (cl-loop for (name pdesc) in package-archive-contents > if (eq name 'afternoon-theme) > collect (list name pdesc))) > > (describe-variable 'my-ps) > > I see only one entry in package-archive-contents - the one in MELPA... As the docstring of `package-archive-contents` describes, there should be only one entry for `afternoon-theme` but that entry should contain two `package-desc` objects: one for Melpa and one for NonGNU. Stefan
On Fri, 25 Nov 2022 at 00:05, Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote: > > More seriously, I don't think it's clearly documented there, so better > ask more precise questions. > > (...) > > As the docstring of `package-archive-contents` describes, there should > be only one entry for `afternoon-theme` but that entry should contain > two `package-desc` objects: one for Melpa and one for NonGNU. Ah, I missed that! Note that the current docstring doesn't mention that one of the entries is for nongnu and the other one is for melpa: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/emacs-lisp/package.el#n1513 (defvar package-archive-contents nil "Cache of the contents of all archives in `package-archives'. This is an alist mapping package names (symbols) to non-empty lists of `package-desc' structures.") Anyway, if I change the cl-loop in my previous e-mail to this, (setq my-ps (cl-loop for (name . pdescs) in package-archive-contents if (> (length pdescs) 1) collect (cons name pdescs))) it produces a list of the packages with duplicate entries, and I can use that to compare the two entries. Next question: is there a way to determine which of the entries - nongnu or melpa - corresponds to a version that is more recent? Thanks in advance! =) Eduardo Ochs http://angg.twu.net/#eev
> Note that the current docstring doesn't mention that one of the entries > is for nongnu and the other one is for melpa: That's because the contents depends on the archives you have activated and which one of those archives offers the specific package. It could also be the case that an archive offers several versions of the same package (tho this case hasn't been tested, AFAIK). > Next question: is there a way to determine which of the entries - > nongnu or melpa - corresponds to a version that is more recent? The official way is to compare the versions with `version<=`, but since Melpa uses an incompatible versioning scheme, this will often not give you the answer you're looking for when comparing Melpa and (Non)GNU ELPA versions :-( That's a longstanding problem with Melpa versions (which does not affect Melpa-stable), but one that's not easy to fix without introducing regressions for existing Melpa users :-( Stefan