1

Two little questions with regards to the configuration of Eshell. I looked at the customization options and even the source code, but to no avail. Maybe I should have taken a better look.

  1. When I start Emacs and open Eshell, the directory is '~/.emacs.d/elpa' instead of my home directory '~/’, what I would expect. I have no idea, where this configuration comes from, and did not find a way to change it.

  2. I changed $PATH in my .bashrc and I customized the Emacs variable 'exec-path' to my needs. However, the first change is not reflected by Eshell, it does not know about it, while bash does. How does Eshell get this information, and how comes it differs from bash in its knowledge about changes in this variable?

Thanks for any hints

Thorsten

PS

I found a similar question [here] (http://stackoverflow.com/questions/3621755/what-setup-file-does-eshell-elisp-shell-read-when-it-starts-how-eshell-sets-i). The answer to point 2. is that eshell does not read .bashrc, therefore $PATH must be set in a file that is read earlier in the start-up process. On my Ubuntu system

/etc/environment

seems to be the file that is read by Emacs on start-up to set $PATH.

Thorsten
  • 3,451
  • 3
  • 20
  • 25

2 Answers2

2

eshell seems to start in the current working directory, which for you (right after Emacs started) is "~/.emacs.d/elpa". You can change it manually with "M-x cd", but that shouldn't be necessary. If you edit some file and start eshell from its buffer, eshell will start in the same directory as the file.

But if you really want to start every eshell session in your home directory, you can make a hook call "cd" before eshell starts.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
chrm
  • 1,258
  • 1
  • 11
  • 16
  • Thanks, that answers the first part of the question. I think the second part is related - it seems Emacs starts up early and gets the $PATH value before my .bashrc is evaluated. But even if I kill eshell and start a new one,$PATH in eshell doesn't reflect my changes in .bashrc, while a new bash shell does know about that changes. – Thorsten Nov 08 '11 at 14:06
0

As already mentioned for Q1: eshell starts up in the directory of the current buffer when eshell is started. If I recall correctly (which is NOT a given), on macOS for a short period of time, when emacs was started by the Finder (i.e. double clicking the icon), the current buffer for *scratch* was root /. Now, when it is started by the finder, the current buffer for *scratch* is my home directory.

For Q2: the variable that you want to set is eshell-path-env. This is a colon separated list of paths.

I'm already using .dir-locals.el to set directory specific variables so I plan to do it that way but I'm sure there are start up hooks that you can use.

Remember that eshell is not bash, zsh, csh, etc. It is not ever going to read their rc files nor does it read /etc/environment, etc. Unlike comint-mode derivatives, it is not a subprocess of emacs but is wholly contained within emacs.

I found Mastering Eshell to be extremely helpful.

pedz
  • 2,271
  • 1
  • 17
  • 20