Search code examples
emacseshell

What setup file does eshell (elisp shell) read when it starts? How eshell sets its PATH?


With emacs/eshell, the "echo $PATH" shows different paths than that of $PATH environment variable.

And I also checked that eshell doesn't read .bashrc or .profile, and I think that's the reason why the path is different.

  • What setup file does eshell read when it starts?
  • How eshell sets its PATH?
  • How to make the eshell's PATH the same as the environment variable's PATH?

ADDED

As Jérôme Radix pointed out, the PATH depends on how I start the Aquamcs.

  • When I click the button to start Aquamacs, it has different PATH.
  • When I run 'aquamacs' from the command line, it has the same PATH.

Solution

    • What setup file does eshell read when it starts?

    No setup file is executed at startup. The following files are read to define the initial history and last directories :

    ~/.eshell/history
    ~/.eshell/lastdir
    
    • How eshell sets its PATH?

    In esh-util.el, line 240 :

    (defvar eshell-path-env (getenv "PATH")
      "Content of $PATH.
    It might be different from \(getenv \"PATH\"\), when
    `default-directory' points to a remote host.")
    
    • How to make the eshell's PATH the same as the environment variable's PATH?

    It is the same as the PATH variable of the emacs process. I imagine that you do a echo $PATH on a shell outside emacs to compare. If PATH are differents between emacs and your shell outside emacs it is because emacs and your shell does not execute the same startup scripts.