Skip to content


Subversion checkout URL

You can clone with
Download ZIP
100644 147 lines (120 sloc) 7.519 kB
ee6b6a4 @jwiegley Added some proper documentation files.
jwiegley authored
1 Welcome to the Emacs Shell
3 [Note: This README is also available in Japanese; see README.ja]
5 Eshell is a command shell implemented entirely in Emacs Lisp. It invokes no
6 external processes beyond those requested by the user. It is intended to be a
7 functional replacement for command shells such as bash, zsh, rc, 4dos; since
8 Emacs itself is capable of handling most of the tasks accomplished by such
9 tools.
11 Despite the sheer fact that running an Emacs shell can be fun, here are a few
12 of the unique features offered by Eshell. More are documented in greater
13 detail under EshellFeatures.
15 # Integration with the Emacs Lisp programming environment
17 The ability to have the same shell on every system Emacs has been ported
18 to. Since Eshell imposes no external requirements, and relies upon only the
19 Lisp functions exposed by Emacs, it is quite operating system
20 independent. Several of the common UNIX commands, such as ls, mv, rm, ln,
21 etc., have been implemented in Lisp in order to provide a more consistent work
22 environment.
24 For those who might be using an older version of Eshell, version 2.1
25 represents an entirely new, module-based architecture. It supports most of the
26 features offered by modern shells. Here is a brief list of some of its more
27 visible features:
29 - Command argument completion (tcsh, zsh)
30 - Input history management (bash)
31 - Intelligent output scrolling
32 - Psuedo-devices (such as "/dev/clip" for copying to the clipboard)
33 - Extended globbing (zsh)
34 - Argument and globbing predication (zsh)
35 - I/O redirection to buffers, files, symbols, processes, etc.
36 - Many niceties otherwise seen only in 4DOS
37 - Alias functions, both Lisp and Eshell-syntax
38 - Piping, sequenced commands, background jobs, etc...
40 Eshell was designed to run on Emacs 20.4 or higher, and XEmacs 21.1 or
41 higher. It was tested on GNU/Linux, Windows NT 4.0, and Windows 2000.
43 If you try to run Eshell on other versions of Emacs, here are some common
44 problems you may run into, and how to overcome them:
46 Emacs 20.3: Pcomplete fails to byte compile. Instead of typing "make install"
47 in the Pcomplete directory, type: "make pcmpl-auto.el install_el". Then, copy
48 the file "pcmpl-auto.el" into the directory that pcomplete was just installed
49 into. Why this is failing is a mystery to me. It appears that byte-compiling
50 pcomplete from a running Emacs session works just fine.
52 To start using Eshell, add the following to your .emacs file:
54 (load "eshell-auto")
56 This will define all of the necessary autoloads.
58 Now type `M-x eshell`. See the INSTALL file for full installation
59 instructions.
61 # Philosophy
63 A shell is a layer which metaphorically surrounds the kernel, or heart of an
64 operating system. This kernel can be seen as an engine of pure functionality,
65 waiting to serve, while the user programs take advantage of that functionality
66 to accomplish their purpose.
68 The shell's role is to make that functionality accessible to the user in an
69 unformed state. Very roughly, it associates kernel functionality with textual
70 commands, allowing the user to interact with the operating system via
71 linguistic constructs. Process invocation is perhaps the most significant form
72 this takes, using the kernel's fork and exec functions.
74 Other programs also interact with the functionality of the kernel, but these
75 user applications typically offer a specific range of functionality, and thus
76 are not classed as "shells" proper. (What they lose in quiddity, they gain in
77 rigidity).
79 Emacs is also a user application, but it does make the functionality of the
80 kernel accessible through an interpreted language -- namely, Lisp. For that
81 reason, there is little preventing Emacs from serving the same role as a
82 modern shell. It too can manipulate the kernel in an unpredetermined way to
83 cause system changes. All it's missing is the shell-ish linguistic model.
85 Enter Eshell. Eshell translates "shell-like" syntax into Lisp in order to
86 exercise the kernel in the same manner as typical system shells. There is a
87 fundamental difference here, however, although it may seem subtle at first...
89 Shells like csh and Bourne shell were written several decades ago, in
90 different times, under more restrictive circumstances. This confined
91 perspective shows itself in the paradigm used by nearly all command-line
92 shells since. They are linear in conception, byte stream-based, sequential,
93 and confined to movement within a single host machine.
95 Emacs, on the other hand, is more than just a limited translator that can
96 invoke subprocesses and redirect file handles. It also manages character
97 buffers, windowing frames, network connections, registers, bookmarks,
98 processes, etc. In other words, it's a very multi-dimensional environment,
99 within which eshell emulates a highly linear methodology.
101 Taking a moment, let's look at how this could affect the future of a shell
102 allowed to develop in such a wider field of play:
104 There is no reason why directory movement should be linear, and confined to a
105 single file-system. Emacs, through w3 and ange-ftp, has access to the entire
106 Web. Why not allow a user to cd to multiple directories simultaneously, for
107 example? It might make some tasks easier, such as diff'ing files separated by
108 very long pathnames. Data sources are available from anywhere Emacs can
109 derive information from: not just from files or the output of other processes.
110 Multiple shell invocations all share the same environment -- even the same
111 process list! It would be possible to have "process views", so that one buffer
112 is watching standard output, another standard error, and another the result of
113 standard output grep'd through a regular expression... It is not necessary to
114 "leave" the shell, losing all input and output history, environment variables,
115 directory stack, etc. Emacs could save the contents of your eshell
116 environment, and restore all of it (or at least as much as possible) each time
117 you restart. This could occur automatically, without requiring complex
118 initialization scripts. Typos occur all of the time; many of them are repeats
119 of common errors, such as dri for dir. Since executing non-existent programs
120 is rarely the intention of the user, eshell could prompt for the replacement
121 string, and then record that in a database of known misspellings. (Note: The
122 typo at the beginning of this paragraph wasn't discovered until two months
123 after I wrote the text; it was not intentional). Emacs' register and
124 bookmarking facilities can be used for remembering where you've been, and what
125 you've seen -- to varying levels of persistence. They could perhaps even be
126 tied to specific "moments" during eshell execution, which would include the
127 environment at that time, as well as other variables. Although this would
128 require functionality orthogonal to Emacs' own bookmarking facilities, the
129 interface used could be made to operate very similarly. This presents a brief
130 idea of what the fuller dimensionality of an Emacs shell could offer. It's not
131 just the language of a shell that determines how it's used, but also the
132 Weltanschauung underlying its design -- and which is felt behind even the
133 smallest feature. I would hope the freedom provided by using Emacs as a parent
134 environment will invite rich ideas from others. It certainly feels as though
135 all I've done so far is to tie down the horse, so to speak, so that he will
136 run at a man's pace.
138 The author of Eshell has been a long-time user of the following shells, all of
139 which contributed to Eshell's design:
141 - rc
142 - bash
143 - zsh
144 - sh
145 - 4nt
146 - csh
Something went wrong with that request. Please try again.