emacsWrapper: fix mishandling of empty package list
The native compiler of emacs does not handle empty files well. This arose in https://github.com/NixOS/nixpkgs/pull/168954 .
This commit is contained in:
parent
2511bad8aa
commit
0f316e5553
|
@ -144,6 +144,7 @@ runCommand
|
||||||
find $pkg -name "*-autoloads.el" \
|
find $pkg -name "*-autoloads.el" \
|
||||||
-exec echo \(load \"{}\" \'noerror \'nomessage\) \; >> $siteAutoloads
|
-exec echo \(load \"{}\" \'noerror \'nomessage\) \; >> $siteAutoloads
|
||||||
done
|
done
|
||||||
|
echo "(provide 'nix-generated-autoload)" >> $siteAutoloads
|
||||||
|
|
||||||
siteStart="$out/share/emacs/site-lisp/site-start.el"
|
siteStart="$out/share/emacs/site-lisp/site-start.el"
|
||||||
siteStartByteCompiled="$siteStart"c
|
siteStartByteCompiled="$siteStart"c
|
||||||
|
@ -196,12 +197,18 @@ runCommand
|
||||||
# Wrap emacs and friends so they find our site-start.el before the original.
|
# Wrap emacs and friends so they find our site-start.el before the original.
|
||||||
for prog in $emacs/bin/*; do # */
|
for prog in $emacs/bin/*; do # */
|
||||||
local progname=$(basename "$prog")
|
local progname=$(basename "$prog")
|
||||||
|
local autoloadExpression=""
|
||||||
rm -f "$out/bin/$progname"
|
rm -f "$out/bin/$progname"
|
||||||
|
if [[ $progname == emacs ]]; then
|
||||||
|
# progs other than "emacs" do not understand the `-l` switches
|
||||||
|
autoloadExpression="-l cl-loaddefs -l nix-generated-autoload"
|
||||||
|
fi
|
||||||
|
|
||||||
substitute ${./wrapper.sh} $out/bin/$progname \
|
substitute ${./wrapper.sh} $out/bin/$progname \
|
||||||
--subst-var-by bash ${emacs.stdenv.shell} \
|
--subst-var-by bash ${emacs.stdenv.shell} \
|
||||||
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
|
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
|
||||||
--subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp:" \
|
--subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp:" \
|
||||||
|
--subst-var autoloadExpression \
|
||||||
--subst-var prog
|
--subst-var prog
|
||||||
chmod +x $out/bin/$progname
|
chmod +x $out/bin/$progname
|
||||||
done
|
done
|
||||||
|
|
|
@ -44,4 +44,4 @@ export emacsWithPackages_siteLisp=@wrapperSiteLisp@
|
||||||
export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
|
export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
|
||||||
export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
|
export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
|
||||||
|
|
||||||
exec @prog@ -l cl-loaddefs -l nix-generated-autoload "$@"
|
exec @prog@ @autoloadExpression@ "$@"
|
||||||
|
|
Loading…
Reference in a new issue