Search code examples
windows-7-x64eshellemacs24

How do I get eshell working correctly in emacs?


For some reason, when I type in commands I'm used to on linux, it works perfectly, as it does in bash... But in eshell, it doesn't work.

I've narrowed the problem to a trivial and small sample, as follows:

$ du
c:/Program: command not found
$ which bash
c:/Program Files (x86)/Git/bin/bash.exe

How do I get this working? (du is whatever it is by default... It's implemented in elisp, I haven't made any unusual changes there, that is, it's a compiled lisp function in `em-unix.el')

I would've expected something along the lines of "You have used 1.3 GiB of disk space", rather than that command not found error.


Solution

  • It doesn't use bash.exe, but it can use du.exe, when present.

    On my system:

    c: gutov $ which bash.exe
    which: no bash.exe in ...
    c: gutov $ which du.exe
    h:/Apps/System/gnuwin32/bin/du.exe
    

    From your error message I can tell that it calls some command and fails because it doesn't properly quote the path to executable (which contains spaces). Maybe you should do M-x report-emacs-bug.

    Overall, I recommend:

    1) Uninstall Git and reinstall it selecting the second option when asked about your PATH environment ("Run Git from the Windows Command Prompt"). This will remove the unix tools packaged with it from PATH.

    2) Install in some directory without spaces and add to PATH unix tools from GnuWin32 project, or from Eli Zaretski's ports. The latter contains fewer packages overall, but it has a much faster find, for example. You can mix them.

    Alternatively, maybe you can get away with just reinstalling Git into directory without spaces.