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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Works! BTW, could you please also show me some reference for this? Thanks.
These can also be created within .emacs.d with a slightly different naming convention: ~/.emacs.d/init_bash.sh

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.