Search code examples
emacsdiredeshell

Eshell - is there something like open-eshell-here?


In the Windows Explorer there is a function 'command-prompt-here' that opens a command prompt for the actual directory.

Is there something similar for eshell, that enables me to open an eshell from dired in the actual directory? When I look at a file, can I open an eshell for the directory that holds that file? Would it be possible to reuse an already open eshell, that is, show that eshell with a new prompt that reflects the actual directory, instead of opening a new instance?

Would be nice to avoid all those 'cd ../../../dir1/dir2'.


Solution

  • I think you can easily create such a thing:

    (defun my-eshell ()
      (interactive)
      (eshell "new")) ; "new" ensures that a new eshell is created
    

    And call my-eshell instead of eshell. A disadvantage of the above is that it always opens a new eshell even if there is already some opened with the correct directory.