Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Emacs 's shell mode source my profile file?

I have defined some aliases and function snippets int some of my profile files, say, ~/.zprofile. But Emacs never reads them. There is already a topic about it. However, it's not enough:

  1. It cannot source completely .zshrc and would emit errors for compinit and the like.
  2. Seems this approach only works for environment VARIABLES.

So in shell-mode or run command in Emacs(Alt-!) the effect is still different with that in terminal(emulators).

So is there any way to deal with the problem? Thanks.

like image 357
Hongxu Chen Avatar asked Apr 19 '13 15:04

Hongxu Chen


1 Answers

You can create a file ~/.emacs_zsh (or .emacs_bash, emacs_sh, ...) that shell-mode will use on startup. My .emacs_bash is simply:

. ~/.profile

Just be sure to put a newline at the end of the sourcing line or it won't get executed.

like image 171
Burton Samograd Avatar answered Oct 19 '22 02:10

Burton Samograd