--- /usr/portage/app-editors/emacs/emacs-26.3-r1.ebuild 2019-12-18 11:39:31.000000000 +0100 +++ emacs-26.3-r2.ebuild 2020-01-02 11:34:19.691638156 +0100 @@ -1,4 +1,4 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -282,8 +282,11 @@ if use systemd; then insinto /usr/lib/systemd/user + # Modify ExecStart so that /etc/profile.env is sourced prior + # starting emacs to make the user environment available to the + # emacs daemon process. See bug #704412. sed -e "/^##/d" \ - -e "/^ExecStart/s,emacs,${EPREFIX}/usr/bin/${EMACS_SUFFIX}," \ + -e "s:^ExecStart=.*:ExecStart=/bin/sh -c \"source ${EPREFIX}/etc/profile.env; exec ${EPREFIX}/usr/bin/${EMACS_SUFFIX} --fg-daemon\":" \ -e "/^ExecStop/s,emacsclient,${EPREFIX}/usr/bin/&-${EMACS_SUFFIX}," \ etc/emacs.service | newins - ${EMACS_SUFFIX}.service assert