From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Clemmer Subject: Re: Emacs in multiple profiles Date: Thu, 17 Oct 2019 11:56:59 -0400 Message-ID: References: <9c395fd0-9458-7894-af8b-9294d212c60b@fastmail.net> <878tajzu03.fsf@gmail.com> <87a7uyd7qy.fsf@gmail.com> <874ll51mq3.fsf@gmail.com> <87zi2t4jgh.fsf@gmail.com> <877ep4z44b.fsf@gmail.com> <87tv88ihzc.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33862) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL899-0005eh-SR for help-guix@gnu.org; Thu, 17 Oct 2019 11:57:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL898-0002Fw-Hl for help-guix@gnu.org; Thu, 17 Oct 2019 11:57:03 -0400 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:34051) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL898-0002Fi-DT for help-guix@gnu.org; Thu, 17 Oct 2019 11:57:02 -0400 Received: by mail-qt1-x82e.google.com with SMTP id 3so4349007qta.1 for ; Thu, 17 Oct 2019 08:57:02 -0700 (PDT) In-reply-to: <87tv88ihzc.fsf@ambrevar.xyz> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Pierre Neidhardt Cc: Alex Kost , help-guix@gnu.org Pierre Neidhardt 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