9

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.

Community
  • 1
  • 1
Hongxu Chen
  • 5,240
  • 2
  • 45
  • 85

1 Answers1

18

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.

Burton Samograd
  • 3,652
  • 19
  • 21