diff options
author | Robert Helgesson <robert@rycee.net> | 2020-04-02 00:23:46 +0200 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-04-02 23:04:08 +0200 |
commit | bf486f784ddd969c03243dba4c93d0e8e861173e (patch) | |
tree | a05033b0197ca922703fc03c30e42a3c3afe0689 /pkgs/build-support/emacs | |
parent | fa0bd3f902a66ca52d7e44cacdbe8837fda06527 (diff) |
emacs: fix setup-hook
This change fixes byte compilation of, e.g., Helm without breaking builds using, e.g., `trivialBuild`. See https://github.com/NixOS/nixpkgs/pull/82604#issuecomment-607201755
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r-- | pkgs/build-support/emacs/setup-hook.sh | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pkgs/build-support/emacs/setup-hook.sh b/pkgs/build-support/emacs/setup-hook.sh index 8f074e0b406c6..83e995631b3e6 100644 --- a/pkgs/build-support/emacs/setup-hook.sh +++ b/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 } |