Subject: Re: Emacs fails to start with "List contains a loop" error

From: Thiago Jung Bauermann <[email-masked]>
Date: Thu, 23 Jan 2025 00:07:46 -0300

Hello Liliana,

Liliana Marie Prikler <[email-masked]> writes:

> Am Montag, dem 20.01.2025 um 19:43 -0300 schrieb Thiago Jung Bauermann:
>>
>> The root cause of the problem is that I have duplicate path entries
>> in these environment variables:
>>
>> $ env | grep EMACS
>> EMACSNATIVELOADPATH=/home/sademeo/.guix-profile/lib/emacs/native-
>> site-lisp:/home/sademeo/.guix-profile/lib/emacs/native-site-lisp
>> EMACSLOADPATH=/home/sademeo/.guix-profile/share/emacs/site-
>> lisp:/home/sademeo/.guix-profile/share/emacs/site-lisp
>>
>> If I remove the duplicate entries, Emacs starts correctly again.
>>
>> I suppose this is a common problem (it's surprisingly hard to ensure
>> a given shell initialization snippet will run only once), and also
>> it's hardly a fatal or unrecoverable error. 
>
> You quite likely have redundant code in your shell init scripts.  Note
> that your Guix profile should already be sourced on Guix System without
> adding anything to them.

Yes, after I opened the bug I dug a bit and found that I had two
slightly different copies of guix.sh in /etc/profile.d/, one of which
forgotten there from some old experimentation. After I removed it, the
EMACS environment variables above were correct again.

>> IMHO it should warrant at most a warning message (if that), not a
>> complete abort of the program.
>>
>> With that in mind, I bisected Guix and arrived at this commit:
>>
>> e9b13294700de7082ee23aa6e1c17b4a8c8828ec is the first bad commit
>> commit e9b13294700de7082ee23aa6e1c17b4a8c8828ec
>> […]
>
> Try replacing nconc with append and see whether it fixes your issue.

Yes, it does fix it. Thanks!

> You can reproduce this more easily with
>
>   $ guix shell emacs-pgtk emacs-dash \
>          --with-input=emacs-minimal=emacs-pgtk -- \
>          sh -c 'source $GUIX_ENVIRONMENT/etc/profile && emacs'

Thank you for providing this command. Indeed it made checking the fix
easier.

--
Thiago