Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20.03] emacs: improve setup hook #86491

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 8 additions & 16 deletions pkgs/build-support/emacs/setup-hook.sh
@@ -1,23 +1,15 @@
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
if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" ]] ; then
addToEmacsLoadPath "$lispDir"
# 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-}"
fi
done
}
Expand Down