mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
Merge pull request #106486 from alyssais/emacsWithPackages
emacsWithPackages: EMACSLOADPATH correctness fixes
This commit is contained in:
commit
09e349206d
@ -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)
|
||||
|
@ -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
|
||||
|
27
pkgs/build-support/emacs/wrapper.sh
Normal file
27
pkgs/build-support/emacs/wrapper.sh
Normal 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@ "$@"
|
Loading…
Reference in New Issue
Block a user