anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / editors / emacs / build-support / wrapper.sh
blob44762bd4582b0b06ad416ee6a216c3e891b23f9c
1 #!@bash@
3 IFS=:
5 newLoadPath=()
6 newNativeLoadPath=()
7 addedNewLoadPath=
8 addedNewNativeLoadPath=
10 if [[ -n $EMACSLOADPATH ]]
11 then
12 while read -rd: entry
14 if [[ -z $entry && -z $addedNewLoadPath ]]
15 then
16 newLoadPath+=(@wrapperSiteLisp@)
17 addedNewLoadPath=1
19 newLoadPath+=("$entry")
20 done <<< "$EMACSLOADPATH:"
21 else
22 newLoadPath+=(@wrapperSiteLisp@)
23 newLoadPath+=("")
26 # NOTE: Even though we treat EMACSNATIVELOADPATH like EMACSLOADPATH in
27 # this wrapper, empty elements in EMACSNATIVELOADPATH have no special
28 # meaning for Emacs. Only non-empty elements in EMACSNATIVELOADPATH
29 # will be prepended to native-comp-eln-load-path.
30 # https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el?id=3685387e609753293c4518be75e77c659c3b2d8d#n599
31 if [[ -n $EMACSNATIVELOADPATH ]]
32 then
33 while read -rd: entry
35 if [[ -z $entry && -z $addedNewNativeLoadPath ]]
36 then
37 newNativeLoadPath+=(@wrapperSiteLispNative@)
38 addedNewNativeLoadPath=1
40 newNativeLoadPath+=("$entry")
41 done <<< "$EMACSNATIVELOADPATH:"
42 else
43 newNativeLoadPath+=(@wrapperSiteLispNative@)
44 newNativeLoadPath+=("")
47 export EMACSLOADPATH="${newLoadPath[*]}"
48 export emacsWithPackages_siteLisp=@wrapperSiteLisp@
50 export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
51 export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
53 exec @prog@ "$@"