From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: Re: Emacs in multiple profiles Date: Sat, 19 Oct 2019 15:35:18 -0400 Message-ID: <878spgo7ex.fsf@gmail.com> 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; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:45894) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLuVW-00040L-DT for help-guix@gnu.org; Sat, 19 Oct 2019 15:35:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLuVV-0004yE-9W for help-guix@gnu.org; Sat, 19 Oct 2019 15:35:22 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:45712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLuVV-0004xs-3Z for help-guix@gnu.org; Sat, 19 Oct 2019 15:35:21 -0400 Received: by mail-qt1-x843.google.com with SMTP id c21so14268131qtj.12 for ; Sat, 19 Oct 2019 12:35:21 -0700 (PDT) In-Reply-To: <87tv88ihzc.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Wed, 16 Oct 2019 21:54:31 +0200") 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 , myglc2@gmail.com, help-guix@gnu.org Hi Pierre, 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. > > 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? Maybe it is just my ignorance about XDG_DATA_DIRS, but, wouldn't it be more natural to use Emacs native mean of finding packages, akin to Python's PYTHONPATH? Emacs has the EMACSLOADPATH for this; per the Emacs manual: =E2=80=98EMACSLOADPATH=E2=80=99 A colon-separated list of directories(1) to search for Emacs Lisp files. If set, it modifies the usual initial value of the =E2=80=98load-path=E2=80=99 variable (*note Lisp Libraries::). An emp= ty element stands for the default value of =E2=80=98load-path=E2=80=99; e.g., usi= ng =E2=80=98EMACSLOADPATH=3D"/tmp:"=E2=80=99 adds =E2=80=98/tmp=E2=80=99 = to the front of the default =E2=80=98load-path=E2=80=99. To specify an empty element in the middl= e of the list, use 2 colons in a row, as in =E2=80=98EMACSLOADPATH=3D"/tmp::/fo= o"=E2=80=99. The neat thing about this is that we can use the native Guix mechanism of 'search-paths', defined on the Emacs package, that would take care of collecting all the Emacs Lisp packages used in a profile. I had a working branch implementing this a long time ago; I could try reviving it if you have an interested in it. The one thing I didn't like about it was I had to use a loose regexp in the path to accomodate with the somewhat loose directory under which the libraries can be installed (share/emacs/site-lisp vs share/emacs/site-lisp/guix.d/package-name-version). But it was working well, and allowed declaring a profile with emacs and the wanted libraries, and having just these available within the profile. Maxim