about summary refs log tree commit diff
path: root/pkgs/build-support/emacs
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2022-07-11 20:22:20 -0500
committerThomas Tuegel <ttuegel@mailbox.org>2022-07-11 20:22:20 -0500
commit017fa2d7a0f3873fbb621bde5dae81b7a33ab4d4 (patch)
tree09e8b8a516f47bf565a948a90b9f883b5128cb5a /pkgs/build-support/emacs
parentd632b9657c7dd5c994e5cdf0bc71cb016f63efa1 (diff)
emacsWithPackages: Rely on package.el for autoloads
The builtin `package.el` functionality is necessary and sufficient to handle
autoloads in the Emacs wrapper.
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r--pkgs/build-support/emacs/wrapper.nix17
-rw-r--r--pkgs/build-support/emacs/wrapper.sh2
2 files changed, 3 insertions, 16 deletions
diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix
index d61f6967c4b81..edbe3ed971734 100644
--- a/pkgs/build-support/emacs/wrapper.nix
+++ b/pkgs/build-support/emacs/wrapper.nix
@@ -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
diff --git a/pkgs/build-support/emacs/wrapper.sh b/pkgs/build-support/emacs/wrapper.sh
index 16da2a9f64954..e8eecb8c86966 100644
--- a/pkgs/build-support/emacs/wrapper.sh
+++ b/pkgs/build-support/emacs/wrapper.sh
@@ -44,4 +44,4 @@ export emacsWithPackages_siteLisp=@wrapperSiteLisp@
 export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
 export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
 
-exec @prog@ @autoloadExpression@ "$@"
+exec @prog@ "$@"