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
This commit is contained in:
parent
fa0bd3f902
commit
bf486f784d
|
@ -1,16 +1,24 @@
|
||||||
addEmacsVars () {
|
addToEmacsLoadPath() {
|
||||||
for lispDir in \
|
local lispDir="$1"
|
||||||
"$1/share/emacs/site-lisp" \
|
if [[ -d $lispDir && ${EMACSLOADPATH-} != *"$lispDir":* ]] ; then
|
||||||
"$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
|
# It turns out, that the trailing : is actually required
|
||||||
# see https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Search.html
|
# see https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Search.html
|
||||||
export EMACSLOADPATH="$lispDir:${EMACSLOADPATH-}"
|
export EMACSLOADPATH="$lispDir:${EMACSLOADPATH-}"
|
||||||
fi
|
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/elpa/"*; do
|
||||||
|
if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" ]] ; then
|
||||||
|
addToEmacsLoadPath "$lispDir"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user