Subject: Re: bug#71789: 29.3; Handling of nested directories of ELPA packages

From: Philip Kaludercic <[email-masked]>
Date: Sun, 30 Jun 2024 10:47:06 +0000

Xiyue Deng <[email-masked]> writes:

> Philip Kaludercic <[email-masked]> writes:
>
>> Jeremy Bryant <[email-masked]> writes:
>>
>>> Xiyue Deng <[email-masked]> writes:
>>>
>>>> Hi,
>>>>
>>>> I'm opening a bug to follow up the discussion at [1].  Given an ELPA
>>>> package `elpafoo' that contains another directory `elpabar' that also
>>>> holds source files, e.g. like the structure below:
>>>>
>>>> ,----
>>>> | ~/.config/emacs/elpa/elpafoo/
>>>> | ~/.config/emacs/elpa/elpafoo/elpafoo.el
>>>> | ~/.config/emacs/elpa/elpafoo/elpabar
>>>> | ~/.config/emacs/elpa/elpafoo/elpabar/elpabar.el
>>>> `----
>>>>
>>>> When installing through package.el, both elpafoo.el and
>>>> elpabar/elpabar.el will be byte-compiled, but only the root source path
>>>> `~/.config/emacs/elpa/elpafoo' is added to `load-path', without any of
>>>> the nested directories.
>>>>
>>>> I wonder whether this is the intended behavior regarding `load-path'
>>>> handling.  If nested directories are added, it has the advantage to
>>>> allow more fine-grained source organization; as a downside, it may
>>>> unnecessarily add more unneeded stuff and processing overhead (as
>>>> Michael pointed out at [2]), and potentially break existing code,
>>>> e.g. auctex, which seems to vendor stuff in the `style/' directories but
>>>> not loaded so it's not causing any trouble yet.
>>>>
>>>> So I wonder what is the stance of the Emacs maintainer on this subject,
>>>> or whether this is documented anywhere.  Also one more step: whether
>>>> there is a recommended layout for source code organization for ELPA
>>>> packages.
>>
>> I think it is intentional, because the approach is simple but functional
>> enough in most instances.  If you need to load a sub-directory, you can
>> add an autoloaded `add-to-list' expression in elpafoo.el.
>>
>
> Thanks Jeremy and Philip!  I had a router issue a few days ago and
> didn't got a confirmation about this bug so I filed a similar bug at
> bug#71817, where Stefan offered a similar explanation there as well.

Right, I noticed that too late.  But good to have two independent
responses coincide in their suggestion.

> Also please feel free to merge this bug with bug#71817 to reduce
> duplications.  Thanks!

I should have merged the reports.

-- 
	Philip Kaludercic on peregrine