Subject: bug#44726: 28.0.50; [feature/native-comp] Provide a mechanism to populate comp-eln-load-path from the environment

From: Tad <[email-masked]>
Date: Thu, 19 Nov 2020 14:50:39 -0800

On Thu, Nov 19, 2020 at 11:52 AM Andrea Corallo <[email-masked]> wrote:

> Last question, what is specific need to filter out empty strings after
> splitting?

NixOS has code which appends an extra path separator[1], which looks
like:

    # It turns out, that the trailing : is actually required
    # see https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Search.html
    export EMACSLOADPATH="$lispDir:${EMACSLOADPATH-}"

The link to the Emacs manual leads to a section containing the text:

    An empty element in the value of the environment variable, whether
    trailing (as in the above example), leading, or embedded, is
    replaced by the default value of load-path as determined by the
    standard initialization procedure. If there are no such empty
    elements, then EMACSLOADPATH specifies the entire load-path. You
    must include either an empty element, or the explicit path to the
    directory containing the standard Lisp files, else Emacs will not
    function. (Another way to modify load-path is to use the -L
    command-line option when starting Emacs; see below.)

As the code I posted above simply prepends the value of this variable to
`comp-eln-load-path', which is already initialized with appropriate
default values, I didn't believe the special handling of empty path
entries was warranted in site-start.el. It would be consistent for
`comp' to implement the behavior as is done for `EMACSLOADPATH',
however.

[1] https://github.com/NixOS/nixpkgs/blob/bf486f784ddd969c03243dba4c93d0e8e861173e/pkgs/build-support/emacs/setup-hook.sh#L4-L6