[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62767: 29.0.90; [PATCH] *lisp/emacs-lisp/package.el: set variables a
From: |
Eli Zaretskii |
Subject: |
bug#62767: 29.0.90; [PATCH] *lisp/emacs-lisp/package.el: set variables after info package |
Date: |
Fri, 26 May 2023 12:37:37 +0300 |
> From: lin Sun <sunlin7@yahoo.com>
> Date: Thu, 25 May 2023 00:46:58 +0000
> Cc: 62767@debbugs.gnu.org
>
> On Wed, May 24, 2023 at 11:32 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > ...
> > 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.
> In the original function `info-initialize', it will rely on the value
> `Info-directory-list' to indicate function initialization and parse
> the "INFOPATH" or get system info dirs as the initialized value.
>
> The bug comes for: package.el will add several paths into
> `Info-directory-list', that maybe lead function `info-initialize'
> return without parsing the "INFOPATH" or getting the system info dires
> as initial value.
>
> So package.el required the entire `info.el` and called function
> `info-initialize' to initialize the value first (by parsing the
> "INFOPATH" or get system info dir), then the package.el modify the
> `Info-directory-list'.
>
> The patch will allow users to set the `Info-directory-list' before
> calling function `info-initialize'; when info.el use the
> `Info-directory-list' variable to read plain *.info file, will call
> function `info-initialize' to add system info dirs.
>
> Two functions `Info-insert-dir' and `Info-find-file', will use
> (get/read) the value of `Info-directory-list' to read the plain *.info
> files.
> In the patch file, both functions will call the function
> `info-initialize' at their entry to ensure the `Info-directory-list'
> is initialized with the "INFOPATH" env string.
> Users will just insert/remove dirs from/to `Info-directory-list', but
> won't use the list to read/get plain *.info files.
> So users can define the `Info-directory-list' and modify its value on
> their elisp files.
I understand that part. 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?
> > > + (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?