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

From: Eli Zaretskii <[email-masked]>
Date: Wed, 24 May 2023 14:32:41 +0300

> From: lin Sun <[email-masked]>
> Date: Wed, 24 May 2023 02:53:08 +0000
> 
> > I am experimenting with a different approach to avoid the loading of
> > the entire info.el file using package.el.
> > Instead, I am adding the directories to the `Info-directory-list',
> > which will be utilized by other functions responsible for loading the
> > specific info files.
> > Please help review the patch I attached. Thanks.

Could you please describe how this makes sure Info-directory-list will
be set to a correct value, in the various scenarios that are relevant?

In particular, Info-directory-list is not the right variable to tweak
here, as it is computed by info.el.  I think we need a separate
variable.

> -      (let ((info-dirs (butlast Info-directory-list)))
> -        (when info-dirs
> -          (pp `(progn (require 'info)
> -                      (info-initialize)
> -                      (setq Info-directory-list
> -                            (append ',info-dirs Info-directory-list)))
> -              (current-buffer))))
> +      (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.

> +(defvar Info--initialized nil
> +  "Non-nil if `info-initialize' has been run.")

There's no need to capitalize the first letter of the name of an
internal variable.  We capitalize 'I' in "Info" so that it would be
easier to type info.el commands with completion (other commands that
begin with 'i' use lower-case 'i').  This is not a factor for internal
variables.