Subject: bug#62767: 29.0.90; [PATCH] *lisp/emacs-lisp/package.el: set variables after info package

From: lin Sun <[email-masked]>
Date: Tue, 30 May 2023 03:56:00 +0000

On Fri, May 26, 2023 at 9:37 AM Eli Zaretskii <[email-masked]> wrote:
>  But I don't think it's TRT to have users or
> Lisp programs outside of info.el manipulate Info-directory-list and
> mutate it.  Instead, I think we should have a package.el-specific
> directory list of Info files, say, package-info-directory-list, and we
> should arrange for info.el to look in those directories _before_ it
> looks in the directories mentioned by Info-directory-list.  Then
> there'll be no need to play with info-initialize and the variable we
> use to indicate info-initialize was already called, and (more
> importantly), no code outside of info.el will mess with
> Info-directory-list.  And package.el will add directories to this new
> variable.
>
> OK?
Totally understand your concern.
The proposed mechanism will request info.el to reserve a variable that
allows customer change outside of info.el, then info.el reads the
variable and proceeds the paths before the info.el major function. So
adding a new variable package-info-directory-list or using the current
Info-directory-list are nearly equal, except that the new name is for
package.el special.

> > > > +      (when-let ((info-dirs (butlast Info-directory-list)))
> > > > +        (pp `(defvar Info-directory-list '()) (current-buffer))
> > > > +        (pp `(setq Info-directory-list
> > > > +                   (delete-dups
> > > > +                    (append ',info-dirs Info-directory-list)))
> > > > +            (current-buffer)))
> > >
> > > Using 'append' here could cause duplicate directories in
> > > Info-directory-list.
> > The `delete-dups' will avoid that.
>
> Yes, but why not use add-to-list in the first place?
`add-to-list' will be a good choice here.
The code is following its previous code lines, almost same format,
paste as follow,
>      (pp `(defvar package-activated-list) (current-buffer))
>      (pp `(setq package-activated-list
>                 (delete-dups
>                  (append ',(mapcar #'package-desc-name package--quickstart-pkgs)