about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/emacs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-04-27 21:04:56 +0000
committerAlyssa Ross <hi@alyssa.is>2020-04-27 21:04:56 +0000
commita4e6c7d26af697f4346cacb7ab18dcd7fcfc056e (patch)
tree47950e79183035018882419c4eff5047d1537b99 /nixpkgs/pkgs/build-support/emacs
parent5b00523fb58512232b819a301c4309f579c7f09c (diff)
parent22a3bf9fb9edad917fb6cd1066d58b5e426ee975 (diff)
downloadnixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.gz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.bz2
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.lz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.xz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.zst
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.zip
Merge commit '22a3bf9fb9edad917fb6cd1066d58b5e426ee975'
Diffstat (limited to 'nixpkgs/pkgs/build-support/emacs')
-rw-r--r--nixpkgs/pkgs/build-support/emacs/setup-hook.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/build-support/emacs/setup-hook.sh b/nixpkgs/pkgs/build-support/emacs/setup-hook.sh
index 8f074e0b406c..83e995631b3e 100644
--- a/nixpkgs/pkgs/build-support/emacs/setup-hook.sh
+++ b/nixpkgs/pkgs/build-support/emacs/setup-hook.sh
@@ -1,15 +1,23 @@
+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
+}
+
 addEmacsVars () {
+  addToEmacsLoadPath "$1/share/emacs/site-lisp"
+
+  # Add sub paths to the Emacs load path if it is a directory
+  # containing .el files. This is necessary to build some packages,
+  # e.g., using trivialBuild.
   for lispDir in \
-      "$1/share/emacs/site-lisp" \
       "$1/share/emacs/site-lisp/"* \
       "$1/share/emacs/site-lisp/elpa/"*; do
-    # Add the path to the Emacs load path if it is a directory
-    # containing .el files and it has not already been added to the
-    # load path.
-    if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" && ${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-}"
+    if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" ]] ; then
+      addToEmacsLoadPath "$lispDir"
     fi
   done
 }