Eshell - a Shell Implemented in Emacs Lisp

Eshell is a command line shell much like bash or zsh. But instead of being implemented in C running in a Linux/UNIX operating system,, it is implemented in Emacs Lisp and running in the Emacs environment.

You might reasonably ask "Why would I want this?", which was also my first thought when I heard about Eshell. My answers to this question is:

Eshell is distributed along with Emacs version 22, and as far as I know it has been since version 21. You start the shell by typing "M-x eshell".

Integrated with Emacs

I mentioned above that Eshell integrates well with the rest of Emacs. I did not just mean that it runs inside Emacs, Eshell is integrated with Emacs in a way that enables you to access everything defined in Elisp from the shells command line.

Running compilers

One use of this integration is to call the Elisp function "compile" from the shell instead of starting a build in an external shell. This is how it is done: When the current directory of your shell is set correctly you can start make or another build system by entering the following on the Eshell command line

compile make

This will result in Emacs creating a new *compilation* buffer and put all the output from the build there. If Emacs is set up to parse errors/warnings from your compiler, the compiler messages are highlighted and you can click them to be taken to the offending lines in your source code. Instead of clicking on the highlighted messages, you can press 'return' while the point is above them. This is a lot more convenient than compiling in an external shell, finding the error messages and then finding the offending lines manually.

Using grep

Another example of this integration is the use of the grep command. When grep is run and its output is not redirected anywhere, the output will appear in a new *grep* buffer. The matches shown in the *grep* buffer can be clicked, which will open the matched file in a new buffer with the point placed at the match.

A Refuge for UNIX/Linux Users

I much prefer to use unix-like systems over Windows. But just as many others with the same preference, I have to use Windows at work.

Of course this causes some frustration, some of which is related to missing

I searched for an xterm-like replacement for the cmd.exe window for quite some time without finding anything really useful. The best candidate was using the xterm program from cygwin, but I find its integration with the Windows world lacking. I felt somewhat stupid when I stumbled upon Eshell in Emacs which I had been using on Windows all the time. It solves both of the problems mentioned above, and I can recommend it to all unix-users caught in Windows.

Nice Touches

Command Line History

Like all reasonably modern command line shells Eshell has a command line history for issuing old command lines again. But the way it is implemented in Eshell has a feature I haven't seen anywhere else. If you type the first letters of an old line before pressing the "arrow up" key, Eshell will only show the lines starting with these letters. This can save you a lot of browsing through former command lines.

Looking at output

When you run a program which generates a lot of output in a shell, you will often need to scroll back and look at this output looking for important information. When using Eshell, remember that the shell input/output is in an Emacs buffer with all the usual Emacs features. Especially the "isearch-backward" command - normally bound to C-r - is useful for finding specific strings in the output of a command. About Emacs Free Software Projects Linux

Valid XHTML 1.0 Strict