[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs in multiple profiles
From: |
George Clemmer |
Subject: |
Re: Emacs in multiple profiles |
Date: |
Thu, 17 Oct 2019 11:56:59 -0400 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Pierre Neidhardt <address@hidden> writes:
> Hi!
>
> I'm resurrecting this since I got bitten by this today.
>
> I'm currently writing a blog article on profiles and manifest, and I
> realized that Emacs is the only program so far that does not behave
> consistently with the rest of Guix.
Hi Pierre,
I think the default emacs behavior reflects tje concept of emacs and
emacs-guix as "uber-all": E.g., Installing them in the default profile
~/.guix-profile/ allows a power user to do anything.
But, if you want to work in separate, independent project profiles each
with their own manifest, profile, and custom configs, it isn't obvious
what to do. E.g., Where is the .emacs file? Which profile do you get
when you run a shell? How do you run a version of emacs or an emacs
package other than the one installed in the default ~/.guix-profile/?
Which .emacs.d/ gets used?
> When I source the etc/profile where I've installed my Emacs packages,
> I'd expect the appropriate environment variables to be set so that
> `guix-emacs-autoload-packages' knows where to load the packages from.
>
> I believe the solution to be simple:
>
> 1. Make Emacs packages set XDG_DATA_DIRS in etc/profile
> 2. guix-emacs.el: Remove guix-user-profile
> 3. guix-emacs.el: Set profiles to all the paths in XDG_DATA_DIRS in the
> guix-emacs-autoload-packages function.
>
> Thoughts?
FWIW, I can report on how I have happily used separate, independent
guix/emacs "project" configs for over a year. For my purposes I want to
start emacs in the context of the project (e.g. use the emacs version
and packages installed in the project's profile and the associated
configurations and user data) and, by default, stay in that context.
To automate this pattern of use across multiple projects, I have a
fairly baroque set of scripts and makefiles.
The gist is that I use separate ~/$GPM_ROOT project directories each
containing their own .guix-profile -> .guix-profile, .emacs,
.bashprofile, .bashrc, & .emacs.d/
The project "run" script includes ...
bash --rcfile $GPM_ROOT/.bash_profile -i -c "$carg"
... to start the project and $GPM_ROOT/.emacs sets
explicit-shell-file-name to point to this script so emacs shells "run"
in the project.
$GPM_ROOT/.bashprofile includes ...
vvv
export GPM_ROOT=/home/glc/gom
unset GUIX_ENVIRONMENT
export GUIX_PROFILE=/home/glc/gom/.guix-profile
eval $(guix package -p $GUIX_PROFILE \
-p /run/current-system/profile --search-paths=exact)
export PATH=/run/setuid-programs:$PATH
[...]
export PATH=$GPM_ROOT/.gpm/bin:$PATH
if [ -f /home/glc/gom/.bashrc ]; then . /home/glc/gom/.bashrc; fi
^^^
and $GPM_ROOT/.gpm/bin/emacs runs emacs this way ...
VVV
#!/bin/sh
$GPM_ROOT/.guix-profile/bin/emacs \
--no-site-file \
--eval='(let ((guix-env (concat (getenv "GPM_ROOT") "/.guix-profile")))
(when (and guix-env (require (quote guix-emacs) nil t))
(guix-emacs-autoload-packages guix-env)))' \
--no-init-file \
--eval='(setq user-emacs-directory (concat (getenv "GPM_ROOT")
"/.emacs.d/"))' \
--eval='(load (concat (getenv "GPM_ROOT") "/.emacs"))' \
--debug-init \
"$@"
^^^
HTH - George