guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proof of Concept: Import Emacs' use-packaged packages into Guix' man


From: Mekeor Melire
Subject: Re: Proof of Concept: Import Emacs' use-packaged packages into Guix' manifest.scm
Date: Tue, 20 Dec 2022 09:16:47 +0000

2022-12-18 09:11 liliana.prikler@gmail.com:

I think we should be able to build an Emacs service in Guix Home that can manage init.el. As a workaround, use-package should also have a :when clause, so you can use :when (featurep 'some-package-autoloads) if you're unsure whether 'some-package is actually installed. This makes your init file a little more resilient and is particularly useful with pure shells.

=guix home import= for init.el is a great idea! (See below for use-cases.)

And yes, =:when (featurep 'some-package-autoloads)= is a workaround that makes init.el files loadable even if respective packages are not available. But the submitted code aims to enable you to install needed emacs-packages so that such a restricting workaround is not needed.

Given the caveats, I would rather like to see an Emacs Lisp based script that mocks use-package and generates a manifest by evaluting init.el. This should give you more correct results. It's not a bad idea per se, but as-is, I think it would better be maintained in your own channel before upstreaming.

Problem is that in cases where needed packages are not installed and the user did not add =:when (featurep 'foo)= everywhere, it's possible that evaluating init.el will fail because of some package not being available. Thus, IMHO, we can't rely on Emacs to evaluate the init.el. But we could use Emacs to expand the (use-package) macros inside init.el. But I doubt that it's worth it. I rather think it's easier to use Guile to parse invocations of =require= and =use-package=.

For upstreaming, I see two potential paths. The first one would be integration to `guix home import', which Andrew Tropin (CC'd) could probably tell you more on. The second would be integration into `guix package' as a callable function/command line argument, but IMHO that's less likely to pass.

All in all, I think there are three use-cases:

- If you want Guix Home to handle the installation of emacs- packages, there should be =guix home import= to automatically install those packages, as resulting from early- and init.el files.

- If you simply want to install all emacs- packages once per CLI, there should be =guix package --install-from-elisp-file=~/.emacs.d/init.el= and similar CLI-arguments or -commands, such as --install-from-elisp-expression, --install-from-elisp-init-files. There could also be --fit-to-elisp- variants which not only install packages, but also remove redundant, unused emacs-* packages.

- If you want to use a manifest.scm for your Guix user-profile and import appropriate emacs- therein, there should be Guile modules and functions which allow to do so, as the submitted code does. Those modules could also be used with =guix package -e=.

And in all three cases, your early- and init.el files might load packages via =require= or =use-package= at least.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]