Subject: [bug#38015] Emacs in multiple profiles

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 18 Nov 2019 14:50:32 +0900

Hello Chris,

Chris Marusich <[email-masked]> writes:

[...]

I've skipped your previous questions, as I believe they were well
answered by Pierre (thank you, Pierre!).

>> Subject: [PATCH 2/3] build-system: emacs: Simplify the SET-EMACS-LOAD-PATH
>>  phase.
>>
>> +(define* (add-source-to-load-path #:key dummy #:allow-other-keys)
>> +  "Augment the EMACSLOADPATH environment variable with the source directory."
>>    (let* ((source-directory (getcwd))
>> -         (input-elisp-directories (input-directories->el-directories
>> -                                   (inputs->directories inputs)))
>> -         (emacs-load-path-value
>> -          (string-join
>> -           (append input-elisp-directories (list source-directory))
>> -           ":" 'suffix)))
>> +         (emacs-load-path-value (string-append (getenv "EMACSLOADPATH") ":"
>> +                                               source-directory)))
>>      (setenv "EMACSLOADPATH" emacs-load-path-value)
>> -    (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
>> -            emacs-load-path-value)))
>> +    (format #t "source directory ~s appended to the `EMACSLOADPATH' \
>> +environment variable\n" source-directory)))
>
> It looks like the change is as follows: previously, we added multiple
> directories, including the source-directory, to the load path; after
> this change, we append just the source-directory to the EMACSLOADPATH.
> Can you remind me why we don't need to add the other elisp directories
> to the EMACSLOADPATH, too?  It seems to work, so I'm probably just
> missing something obvious.

The magic is in the set-paths phase that is inherited from the
gnu-build-system.  It uses the search path specification now specified in
the Emacs package to set the EMACSLOADPATH environment variable itself.

When building Elisp packages, it is useful to add the current source
directory to that environment variable, so that 'require' directives are
able to find the package's own modules (say, when running its test
suite).

>> Subject: [PATCH 3/3] gnu: emacs: Adapt the autoloads auxiliary code to use
>>  EMACSLOADPATH.
>
> As far as I can tell, this looks good to me, too.
>
> Finally: do you anticipate that this will cause any user-visible or
> backwards-incompatible changes that we should mention in the Guix
> channel's news file (and in the Guix NEWS file)?

Thanks for the review!  I can't anticipate any user-visible changes
except the current (incorrect) behavior.

This change is now live on master, with commit
47b3b4c2aa49e21f4cc32c97ff7bbbd069bb849c.  Thanks for testing :-).

Maxim