summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndré Silva <123550+andresilva@users.noreply.github.com>2022-04-20 10:39:36 +0100
committerGitHub <noreply@github.com>2022-04-20 10:39:36 +0100
commit1c510040c72731e9b8261b39634c743bce9a998a (patch)
tree07d624d3afa152a0f59e4aada7f062ff7c1f7210
parenta7e62c21c1fbb36588e06dadd252f3fced6dbda2 (diff)
parent0f316e5553561774a795f6ec69949ab70bd93a8f (diff)
downloadnixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.tar
nixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.tar.gz
nixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.tar.bz2
nixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.tar.lz
nixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.tar.xz
nixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.tar.zst
nixpkgs-1c510040c72731e9b8261b39634c743bce9a998a.zip
Merge pull request #169316 from nagy/emacs-autoloads-fix
emacsWrapper: fix mishandling of empty package list
-rw-r--r--pkgs/build-support/emacs/wrapper.nix7
-rw-r--r--pkgs/build-support/emacs/wrapper.sh2
2 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix
index 207908fb606..2bf8eaf2d7a 100644
--- a/pkgs/build-support/emacs/wrapper.nix
+++ b/pkgs/build-support/emacs/wrapper.nix
@@ -144,6 +144,7 @@ runCommand
           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
@@ -196,12 +197,18 @@ 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
diff --git a/pkgs/build-support/emacs/wrapper.sh b/pkgs/build-support/emacs/wrapper.sh
index 6c5a5aee2a8..16da2a9f649 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@ -l cl-loaddefs -l nix-generated-autoload "$@"
+exec @prog@ @autoloadExpression@ "$@"