Merge pull request #181174 from ttuegel/emacs-wrapper-package-el
emacsWithPackages: Rely on package.el for autoloads
This commit is contained in:
commit
8619d75795
2 changed files with 3 additions and 16 deletions
|
@ -135,16 +135,10 @@ runCommand
|
|||
''}
|
||||
}
|
||||
|
||||
siteAutoloads="$out/share/emacs/site-lisp/nix-generated-autoload.el"
|
||||
touch $siteAutoloads
|
||||
|
||||
# Iterate over the array of inputs (avoiding nix's own interpolation)
|
||||
for pkg in "''${requires[@]}"; do
|
||||
linkEmacsPackage $pkg
|
||||
find $pkg -name "*-autoloads.el" \
|
||||
-exec echo \(load \"{}\" \'noerror \'nomessage\) \; >> $siteAutoloads
|
||||
done
|
||||
echo "(provide 'nix-generated-autoload)" >> $siteAutoloads
|
||||
|
||||
siteStart="$out/share/emacs/site-lisp/site-start.el"
|
||||
siteStartByteCompiled="$siteStart"c
|
||||
|
@ -180,12 +174,12 @@ runCommand
|
|||
> "$subdirs"
|
||||
|
||||
# Byte-compiling improves start-up time only slightly, but costs nothing.
|
||||
$emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs" "$siteAutoloads"
|
||||
$emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs"
|
||||
|
||||
${optionalString nativeComp ''
|
||||
$emacs/bin/emacs --batch \
|
||||
--eval "(add-to-list 'native-comp-eln-load-path \"$out/share/emacs/native-lisp/\")" \
|
||||
-f batch-native-compile "$siteStart" "$subdirs" "$siteAutoloads"
|
||||
-f batch-native-compile "$siteStart" "$subdirs"
|
||||
''}
|
||||
'';
|
||||
|
||||
|
@ -197,18 +191,12 @@ runCommand
|
|||
# Wrap emacs and friends so they find our site-start.el before the original.
|
||||
for prog in $emacs/bin/*; do # */
|
||||
local progname=$(basename "$prog")
|
||||
local autoloadExpression=""
|
||||
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 \
|
||||
--subst-var-by bash ${emacs.stdenv.shell} \
|
||||
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
|
||||
--subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp:" \
|
||||
--subst-var autoloadExpression \
|
||||
--subst-var prog
|
||||
chmod +x $out/bin/$progname
|
||||
done
|
||||
|
@ -228,7 +216,6 @@ runCommand
|
|||
--subst-var-by bash ${emacs.stdenv.shell} \
|
||||
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
|
||||
--subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp:" \
|
||||
--subst-var-by autoloadExpression "-l cl-loaddefs -l nix-generated-autoload" \
|
||||
--subst-var-by prog "$emacs/Applications/Emacs.app/Contents/MacOS/Emacs"
|
||||
chmod +x $out/Applications/Emacs.app/Contents/MacOS/Emacs
|
||||
fi
|
||||
|
|
|
@ -44,4 +44,4 @@ export emacsWithPackages_siteLisp=@wrapperSiteLisp@
|
|||
export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
|
||||
export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
|
||||
|
||||
exec @prog@ @autoloadExpression@ "$@"
|
||||
exec @prog@ "$@"
|
||||
|
|
Loading…
Reference in a new issue