1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-30 09:31:01 +00:00

Merge pull request #106486 from alyssais/emacsWithPackages

emacsWithPackages: EMACSLOADPATH correctness fixes
This commit is contained in:
adisbladis 2020-12-11 00:08:59 +01:00 committed by GitHub
commit 09e349206d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 4 deletions

View file

@ -22,6 +22,17 @@ least specific (the system profile)"
(nix--profile-paths)))))
(setq load-path (append paths load-path)))
;;; Remove wrapper site-lisp from EMACSLOADPATH so it's not propagated
;;; to any other Emacsen that might be started as subprocesses.
(let ((wrapper-site-lisp (getenv "emacsWithPackages_siteLisp"))
(env-load-path (getenv "EMACSLOADPATH")))
(when wrapper-site-lisp
(setenv "emacsWithPackages_siteLisp" nil))
(when (and wrapper-site-lisp env-load-path)
(let* ((env-list (split-string env-load-path ":"))
(new-env-list (delete wrapper-site-lisp env-list)))
(setenv "EMACSLOADPATH" (when new-env-list
(mapconcat 'identity new-env-list ":"))))))
;;; Make `woman' find the man pages
(defvar woman-manpath)

View file

@ -155,8 +155,12 @@ runCommand
for prog in $emacs/bin/*; do # */
local progname=$(basename "$prog")
rm -f "$out/bin/$progname"
makeWrapper "$prog" "$out/bin/$progname" \
--suffix EMACSLOADPATH ":" "$deps/share/emacs/site-lisp:"
substitute ${./wrapper.sh} $out/bin/$progname \
--subst-var-by bash ${emacs.stdenv.shell} \
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
--subst-var prog
chmod +x $out/bin/$progname
done
# Wrap MacOS app
@ -168,8 +172,12 @@ runCommand
$emacs/Applications/Emacs.app/Contents/PkgInfo \
$emacs/Applications/Emacs.app/Contents/Resources \
$out/Applications/Emacs.app/Contents
makeWrapper $emacs/Applications/Emacs.app/Contents/MacOS/Emacs $out/Applications/Emacs.app/Contents/MacOS/Emacs \
--suffix EMACSLOADPATH ":" "$deps/share/emacs/site-lisp:"
substitute ${./wrapper.sh} $out/Applications/Emacs.app/Contents/MacOS/Emacs \
--subst-var-by bash ${emacs.stdenv.shell} \
--subst-var-by wrapperSiteLisp "$emacs/Applications/Emacs.app/Contents/MacOS/Emacs" \
--subst-var prog
chmod +x $out/bin/$progname
fi
mkdir -p $out/share

View file

@ -0,0 +1,27 @@
#!@bash@
IFS=:
newLoadPath=()
added=
if [[ -n $EMACSLOADPATH ]]
then
while read -rd: entry
do
if [[ -z $entry && -z $added ]]
then
newLoadPath+=(@wrapperSiteLisp@)
added=1
fi
newLoadPath+=("$entry")
done <<< "$EMACSLOADPATH:"
else
newLoadPath+=(@wrapperSiteLisp@)
newLoadPath+=("")
fi
export EMACSLOADPATH="${newLoadPath[*]}"
export emacsWithPackages_siteLisp=@wrapperSiteLisp@
exec @prog@ "$@"