1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/applications/editors/emacs/build-support/emacs-funcs.sh
Lin Jian 4092c0d850
emacs: make trivialBuild know its elisp dependencies in another way
Previously, trivialBuild did not know how to find its elisp
dependencies.  This was[1] fixed[2] by basically rewriting part of
package-activate-all in bash.

I think it is better to call package-activate-all (or
package-initialize if Emacs is old) directly.  It reduces maintenance
burden a bit.  It also improves consistency since elpaBuild and
melpaBuild already do so.

This change provides almost the same functionality as before.  It only
breaks elisp packages with non-standard[^3] elisp dependencies.
However, I think those non-standard ones should be fixed instead.
As an example, mu4e used to be a non-standard one and was fixed[4].

This change does not cause more build failures in emacsPackages.

[1]: https://github.com/NixOS/nixpkgs/pull/82604
[2]: bf486f784d
[^3]: Non-standard elisp packages do not meet requirements of
package.el, the builtin package manager of Emacs.  Usually, they are
installed to $out/share/emacs/site-lisp/$pname-$version and/or miss a
$pname-pkg.el file.
[4]: https://github.com/NixOS/nixpkgs/pull/253438
2024-09-20 15:19:45 +08:00

24 lines
708 B
Bash

addToEmacsLoadPath() {
local lispDir="$1"
if [[ -d $lispDir && ${EMACSLOADPATH-} != *"$lispDir":* ]] ; then
# It turns out, that the trailing : is actually required
# see https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Search.html
export EMACSLOADPATH="$lispDir:${EMACSLOADPATH-}"
fi
}
addToEmacsNativeLoadPath() {
local nativeDir="$1"
if [[ -d $nativeDir && ${EMACSNATIVELOADPATH-} != *"$nativeDir":* ]]; then
export EMACSNATIVELOADPATH="$nativeDir:${EMACSNATIVELOADPATH-}"
fi
}
addEmacsVars () {
addToEmacsLoadPath "$1/share/emacs/site-lisp"
if [ -n "${addEmacsNativeLoadPath:-}" ]; then
addToEmacsNativeLoadPath "$1/share/emacs/native-lisp"
fi
}