Creating PATH variables and other environment variables in emacs

Working with emacs on OSX can be troubling several times.

I am exchanging using the Terminal.app application and the emace shell, both of which use bash, and both seem to work, however I have a problem that the environment is not configured the same in both.

I am running a clean install of OSX Lion and emacs 24 from emacs and would like the environment variables in emacs shell to do the same thing as in Terminal.app under osx. How to fix it?

+6
source share
3 answers

Just install the awesome little exec-path-from-shell package and you're done! It will automatically set your emacs exec-path to the same as PATH in the zsh/bash configuration.

It will also allow you to copy the values ​​of other shell variables as follows:

 (exec-path-from-shell-copy-env "PYTHONPATH") 
+12
source

If environment variables are set to ~ / .bash_profile, create the ~ / .emacs_bash file and put the following into it:

 . ~/.bash_profile 

Do not forget the new line at the end of this line or it will not be executed.

~ / .emacs_bash is loaded by emacs when bash starts from it, for example, when using the Mx shell or shell, so you can use it to set any environment variables that you want to use.

+2
source

Open Emacs.app from Terminal.app (instead of Finder):

 $ emacs 

This works for me using Emacs from Homebrew with Cocoa ( brew install emacs --with-cocoa ). It launches Emacs.app in the Cocoa GUI window (use emacs -nw to backup to the terminal interface). All of the environment variables that I set in my bash environment seemed to be set in Emacs.

I have not tried this with Emacsformacosx. I personally prefer Emacs from Homebrew since I heard that Emacsformacosx is not compiled with some extensions that I use, such as TLS and Imagemagick ... you can compile Emacs with these extensions using brew install emacs --with-XXX .

0
source

Source: https://habr.com/ru/post/945516/


All Articles