Subject: EMACSLOADPATH not set when using Guix System + Guix Home + SLIM + Mate

From: Maxime Devos <[email-masked]>
Date: Wed, 20 Jul 2022 12:45:14 +0200

Hi,

(the SLIM + Mate might be irrelevant, untested)

I am using Guix System and Guix Home. In Guix Home, I've added the 
"emacs" and "emacs-magit" packages (and some others):

> (home-environment
>   (packages
>     (specifications->packages
>       (list "git" "irssi" "evolution" "openssh" "gnupg" "htop"
>             "bash" "coreutils" "bash-completion"
>             "emacs" "emacs-magit" "emacs-paredit"
>             "icedove" "gnunet" "seahorse" #;"icedove-wayland")))
>   (services
>     (list (service
>             home-bash-service-type
>             (home-bash-configuration
>               (aliases
>                 '(("grep" . "grep --color=auto")
>                   ("ll" . "ls -l")
>                   ("ls" . "ls -p --color=auto")))
>               (bashrc
>                 (list (local-file ".bashrc" "bashrc")))
>               (bash-profile
>                 (list (local-file
>                         ".bash_profile"
>                         "bash_profile"))))))))

For completeness, here is the .bash_profile and .bashrc (unmodified from 
base installation, except for removing a redundant alias):

> # Honor per-interactive-shell startup file
> if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

and

> # Bash initialization for interactive non-login shells and
> # for remote shells (info "(bash) Bash Startup Files").
>
> # Export 'SHELL' to child processes.  Programs such as 'screen'
> # honor it and otherwise use /bin/sh.
> export SHELL
>
> if [[ $- != *i* ]]
> then
>     # We are being invoked from a non-interactive shell.  If this
>     # is an SSH session (as in "ssh host command"), source
>     # /etc/profile so we get PATH and other essential variables.
>     [[ -n "$SSH_CLIENT" ]] && source /etc/profile
>
>     # Don't do anything else.
>     return
> fi
>
> # Source the system-wide file.
> source /etc/bashrc
>
> # Adjust the prompt depending on whether we're in 'guix environment'.
> if [ -n "$GUIX_ENVIRONMENT" ]
> then
>     PS1='\u@\h \w [env]\$ '
> else
>     PS1='\u@\h \w\$ '
> fi

After a "guix home reconfigure" and after a few reboots, I tried out 
emacs-magit, but there was no match for the "M-x magit-status".  It 
turned out that $EMACSLOADPATH was unset. However, it is set in 
~/.guix-home/profile/etc/profile:

> # Source this file to define all the relevant environment variables in 
> Bash
> # for this profile.  You may want to define the 'GUIX_PROFILE' environment
> # variable to point to the "visible" name of the profile, like this:
> #
> #  GUIX_PROFILE=/path/to/profile ; \
> #  source /path/to/profile/etc/profile
> #
> # When GUIX_PROFILE is undefined, the various environment variables refer
> # to this specific profile generation.
>
> export 
> PATH="${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry8dxdm98ipk7d-profile}/bin:${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry>
> export 
> GIT_EXEC_PATH="${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry8dxdm98ipk7d-profile}/libexec/git-core"
> export 
> BASH_LOADABLES_PATH="${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry8dxdm98ipk7d-profile}/lib/bash${BASH_LOADABLES_PATH:+:}$BA>
> export 
> INFOPATH="${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry8dxdm98ipk7d-profile}/share/info${INFOPATH:+:}$INFOPATH"
> export 
> EMACSLOADPATH="${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry8dxdm98ipk7d-profile}/share/emacs/site-lisp${EMACSLOADPATH:+:}$E>
> export 
> XDG_DATA_DIRS="${GUIX_PROFILE:-/gnu/store/ll0p9k6yp5070svjhwry8dxdm98ipk7d-profile}/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"

(nevermind the >, that's just me not making the terminal wide enough 
before copying)

Weirdly, EMACSLOADPATH is not set (tested in a terminal), but PATH, 
GIT_EXEC_PATH, BASH_LOADABLES_PATH, INFOPATH and XDG_DATA_DIRS are set.  
Also, inside a login shell (bash --login) (started inside the graphical 
environment), EMACSLOADPATH is not set.

Also, if I do "source ~/.guix-home/setup-environment", then 
$EMACSLOADPATH" is set.

TBI ...

Greetings,
Maxime.