Subject: Re: bug#17403: 24.4.50; package-alist doc-string error

From: Noam Postavsky <[email-masked]>
Date: Sun, 14 Jul 2019 10:26:36 -0400

Stefan Kangas <[email-masked]> writes:

> Richard Kim <[email-masked]> writes:
>
>> I believe the doc-string for package-alist is incorrect.
>> Each element is (PKG DESCS) rather than (PKG . DESCS), i.e.,
>> each item is (list PKG DESCS) rather than (cons PKG DESCS).
>> To fix this, the patch shown below can be applied.
>
> You are correct.  There is indeed a difference between what the
> documentation says and what the code does.  According to the code,
> package-alist is *not* an alist, but a list of lists. (This goes back
> to at least 2013 AFAICT.)
>
> Yet it has the suffix "-alist".

The only structural requirement for "alist"ness is to be a list of
conses.  As long as none of the lists are empty, a list of lists is (or
can be viewed as) an alist.  I don't think there is a bug here, just a
misunderstanding of dot notation.

>> My assertion is confirmed by the following code from package.el:
>> 
>>     (defun package-process-define-package (exp origin)
>>        ...
>>             ;; If there's no old package, just add this to `package-alist'.
>>             (push (list name new-pkg-desc) package-alist)

Note that this is equivalent to this:

    (push (cons name (list new-pkg-desc)) package-alist)