2020-12-09 15:53:10 +00:00
|
|
|
#!@bash@
|
|
|
|
|
|
|
|
IFS=:
|
|
|
|
|
|
|
|
newLoadPath=()
|
2020-11-16 19:24:29 +00:00
|
|
|
newNativeLoadPath=()
|
2023-08-25 03:30:25 +01:00
|
|
|
addedNewLoadPath=
|
|
|
|
addedNewNativeLoadPath=
|
2020-12-09 15:53:10 +00:00
|
|
|
|
|
|
|
if [[ -n $EMACSLOADPATH ]]
|
|
|
|
then
|
|
|
|
while read -rd: entry
|
|
|
|
do
|
2023-08-25 03:30:25 +01:00
|
|
|
if [[ -z $entry && -z $addedNewLoadPath ]]
|
2020-12-09 15:53:10 +00:00
|
|
|
then
|
|
|
|
newLoadPath+=(@wrapperSiteLisp@)
|
2023-08-25 03:30:25 +01:00
|
|
|
addedNewLoadPath=1
|
2020-12-09 15:53:10 +00:00
|
|
|
fi
|
|
|
|
newLoadPath+=("$entry")
|
|
|
|
done <<< "$EMACSLOADPATH:"
|
|
|
|
else
|
|
|
|
newLoadPath+=(@wrapperSiteLisp@)
|
|
|
|
newLoadPath+=("")
|
|
|
|
fi
|
|
|
|
|
2023-08-25 03:50:05 +01:00
|
|
|
# NOTE: Even though we treat EMACSNATIVELOADPATH like EMACSLOADPATH in
|
|
|
|
# this wrapper, empty elements in EMACSNATIVELOADPATH have no special
|
|
|
|
# meaning for Emacs. Only non-empty elements in EMACSNATIVELOADPATH
|
|
|
|
# will be prepended to native-comp-eln-load-path.
|
|
|
|
# https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el?id=3685387e609753293c4518be75e77c659c3b2d8d#n599
|
2020-11-16 19:24:29 +00:00
|
|
|
if [[ -n $EMACSNATIVELOADPATH ]]
|
|
|
|
then
|
|
|
|
while read -rd: entry
|
|
|
|
do
|
2023-08-25 03:30:25 +01:00
|
|
|
if [[ -z $entry && -z $addedNewNativeLoadPath ]]
|
2020-11-16 19:24:29 +00:00
|
|
|
then
|
|
|
|
newNativeLoadPath+=(@wrapperSiteLispNative@)
|
2023-08-25 03:30:25 +01:00
|
|
|
addedNewNativeLoadPath=1
|
2020-11-16 19:24:29 +00:00
|
|
|
fi
|
|
|
|
newNativeLoadPath+=("$entry")
|
|
|
|
done <<< "$EMACSNATIVELOADPATH:"
|
|
|
|
else
|
|
|
|
newNativeLoadPath+=(@wrapperSiteLispNative@)
|
|
|
|
newNativeLoadPath+=("")
|
|
|
|
fi
|
|
|
|
|
2020-12-09 15:53:10 +00:00
|
|
|
export EMACSLOADPATH="${newLoadPath[*]}"
|
emacsWithPackages: don't tell sub-Emacs about pkgs
If I'm running an Emacs executable from emacsWithPackages as my main
programming environment, and I'm hacking on Emacs, or the Emacs
packaging in Nixpkgs, or whatever, I don't want the Emacs packages
from the wrapper to show up in the load path of that child Emacs. It
results in differing behaviour depending on whether the child Emacs is
run from Emacs or from, for example, an external terminal emulator,
which is very surprising.
To avoid this, pass another environment variable containing the
wrapper site-lisp path, and use that value to remove the corresponding
entry in EMACSLOADPATH, so it won't be propagated to child Emacsen.
2020-12-07 18:53:54 +00:00
|
|
|
export emacsWithPackages_siteLisp=@wrapperSiteLisp@
|
2020-12-09 15:53:10 +00:00
|
|
|
|
2020-11-16 19:24:29 +00:00
|
|
|
export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
|
|
|
|
export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
|
|
|
|
|
2024-12-02 16:04:15 +00:00
|
|
|
export emacsWithPackages_invocationDirectory=@wrapperInvocationDirectory@
|
|
|
|
export emacsWithPackages_invocationName=@wrapperInvocationName@
|
|
|
|
|
2022-07-12 02:22:20 +01:00
|
|
|
exec @prog@ "$@"
|