Hi Pierre, Pierre Neidhardt <m...@ambrevar.xyz> 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: ‘EMACSLOADPATH’ A colon-separated list of directories(1) to search for Emacs Lisp files. If set, it modifies the usual initial value of the ‘load-path’ variable (*note Lisp Libraries::). An empty element stands for the default value of ‘load-path’; e.g., using ‘EMACSLOADPATH="/tmp:"’ adds ‘/tmp’ to the front of the default ‘load-path’. To specify an empty element in the middle of the list, use 2 colons in a row, as in ‘EMACSLOADPATH="/tmp::/foo"’. 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