[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Distributing packages with native emacs modules
From: |
Stefan Monnier |
Subject: |
Re: Distributing packages with native emacs modules |
Date: |
Thu, 01 Oct 2020 09:19:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> I'm trying to figure out how to distribute a package which has some C++ code
> implementing an emacs module. I'm currently not 100% clear on all that:
> 1) It seems the package repo's only do byte compilation of el files?
Yes and no: it's not the package's repository which does it, but the
`package.el` code in the Emacs program used to install the package
(i.e. it applies to all packages installed with `package.el`, whether
they come from a repository or not).
> 2) Are there examples or packages doing compilation of modules?
A few, yes. E.g. the `emacs-tree-sitter` package.
Actually, IIUC the `ada-mode` package in GNU ELPA also kind of does
that, except I believe it uses a separate executable rather than
a module. [ I believe the same applies to `pdf-tools`. ]
> 3) It would be possible to wrap the compilation of the package in an
> "(eval-when-compile" but that would be quite laborious.
That's the route I recommend, tho a good option is to do it more lazily
(i.e. not when the package is byte-compiled but when it's first loaded),
and an even better one is to do it both ways.
> 4) The other option is to ship the code to the user and tell him/her
> to run the compilation
> if the binary module isn't there yet (possible providing an elisp
> function to do that).
I think you'll want a function/command for that in any case
(i.e. whether or not you run that function from
`eval-when-compile`), yes.
Stefan