2020-04-01 23:23:46 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-11-16 19:24:29 +00:00
|
|
|
addToEmacsNativeLoadPath() {
|
|
|
|
local nativeDir="$1"
|
|
|
|
if [[ -d $nativeDir && ${EMACSNATIVELOADPATH-} != *"$nativeDir":* ]]; then
|
|
|
|
export EMACSNATIVELOADPATH="$nativeDir:${EMACSNATIVELOADPATH-}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-02-09 00:29:48 +00:00
|
|
|
addEmacsVars () {
|
2020-04-01 23:23:46 +01:00
|
|
|
addToEmacsLoadPath "$1/share/emacs/site-lisp"
|
|
|
|
|
2020-11-16 19:24:29 +00:00
|
|
|
if [ -n "${addEmacsNativeLoadPath:-}" ]; then
|
|
|
|
addToEmacsNativeLoadPath "$1/share/emacs/native-lisp"
|
|
|
|
fi
|
|
|
|
|
2020-04-01 23:23:46 +01:00
|
|
|
# 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.
|
2020-03-14 18:28:24 +00:00
|
|
|
for lispDir in \
|
|
|
|
"$1/share/emacs/site-lisp/"* \
|
|
|
|
"$1/share/emacs/site-lisp/elpa/"*; do
|
2020-04-01 23:23:46 +01:00
|
|
|
if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" ]] ; then
|
|
|
|
addToEmacsLoadPath "$lispDir"
|
2020-03-14 18:28:24 +00:00
|
|
|
fi
|
|
|
|
done
|
2015-02-09 00:29:48 +00:00
|
|
|
}
|