10

I run Emacs in the daemon mode as a user's systemd unit. However it won't read my environment variables. How to make it import my .bashrc first?
I have multiple paths added in there and want to be able to use them in Emacs (but I don't want to maintain both .bashrc and .emacs by adding them to exec-path).

2
  • Can you please tell use more about what you want to achieve?
    – Nsukami _
    Nov 29, 2015 at 21:47
  • @Nsukami_, I've updated the question
    – catemperor
    Nov 29, 2015 at 21:57

2 Answers 2

10

You're probably looking for the package exec-path-from-shell. Once it's installed, put this in your .emacs:

(exec-path-from-shell-initialize)

for emacs to read .bashrc on startup. That way you won't have to maintain paths in two places.

2
  • This does not seem to work when I put it in my init.el file. Is the .emacs file a requirement? (That would make it hard to VCS my ~/.emacs.d Jun 15, 2016 at 21:56
  • Did you first install the package exec-path-from-shell?
    – Emacs User
    Jun 15, 2016 at 22:10
0

When I wanted to put Emacs' socket into my encrypted $HOME, I had to put the definition TMPDIR="$HOME/tmp;export TMPDIR" in my $HOME/.profile file, so an early shell would see the definition and pass it in Emacs' ENVIRONMENT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.