Initial Commit
[packages] / xemacs-packages / eshell / README
1 The Emacs Shell: Eshell
2 ***********************
3
4    Eshell is a command shell implemented entirely in Emacs Lisp.  It
5 invokes no external processes beyond those requested by the user.  It
6 is intended to be a functional replacement for command shells such as
7 bash, zsh, rc, 4dos; since Emacs itself is capable of handling most of
8 the tasks accomplished by such tools.
9
10 What does Eshell offer you?
11 ===========================
12
13    Despite the sheer fact that running an Emacs shell can be fun, here
14 are a few of the unique features offered by Eshell:
15
16    * Integration with the Emacs Lisp programming environment
17
18    * A high degree of configurability
19
20    * The ability to have the same shell on every system Emacs has been
21      ported to. Since Eshell imposes no external requirements, and
22      relies upon only the Lisp functions exposed by Emacs, it is quite
23      operating system independent. Several of the common UNIX commands,
24      such as ls, mv, rm, ln, etc., have been implemented in Lisp in
25      order to provide a more consistent work environment.
26
27    For those who might be using an older version of Eshell, version 2.1
28 represents an entirely new, module-based architecture. It supports most
29 of the features offered by modern shells. Here is a brief list of some
30 of its more visible features:
31
32    * Command argument completion (tcsh, zsh)
33
34    * Input history management (bash)
35
36    * Intelligent output scrolling
37
38    * Psuedo-devices (such as "/dev/clip" for copying to the clipboard)
39
40    * Extended globbing (zsh)
41
42    * Argument and globbing predication (zsh)
43
44    * I/O redirection to buffers, files, symbols, processes, etc.
45
46    * Many niceties otherwise seen only in 4DOS
47
48    * Alias functions, both Lisp and Eshell-syntax
49
50    * Piping, sequenced commands, background jobs, etc...
51
52 Eshell is free software
53 =======================
54
55    Eshell is free software; you can redistribute it and/or modify it
56 under the terms of the GNU General Public License as published by the
57 Free Software Foundation; either version 2, or (at your option) any
58 later version.
59
60    This program is distributed in the hope that it will be useful, but
61 WITHOUT ANY WARRANTY; without even the implied warranty of
62 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
63 General Public License for more details.
64
65    You should have received a copy of the GNU General Public License
66 along with Eshell; see the file COPYING.  If not, write to the Free
67 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
68 02111-1307, USA.
69
70 How to begin
71 ============
72
73    To start using Eshell, add the following to your .emacs file:
74
75      (load "eshell-auto")
76
77    This will define all of the necessary autoloads.
78
79    Now type `M-x eshell'.  See the INSTALL file for full installation
80 instructions.
81
82 Philosophy
83 ==========
84
85    A shell is a layer which metaphorically surrounds the kernel, or
86 heart of an operating system.  This kernel can be seen as an engine of
87 pure functionality, waiting to serve, while the user programs take
88 advantage of that functionality to accomplish their purpose.
89
90    The shell's role is to make that functionality accessible to the
91 user in an unformed state.  Very roughly, it associates kernel
92 functionality with textual commands, allowing the user to interact with
93 the operating system via linguistic constructs.  Process invocation is
94 perhaps the most significant form this takes, using the kernel's `fork'
95 and `exec' functions.
96
97    Other programs also interact with the functionality of the kernel,
98 but these user applications typically offer a specific range of
99 functionality, and thus are not classed as "shells" proper.  (What they
100 lose in quiddity, they gain in rigidity).
101
102    Emacs is also a user application, but it does make the functionality
103 of the kernel accessible through an interpreted language--namely, Lisp.
104 For that reason, there is little preventing Emacs from serving the
105 same role as a modern shell.  It too can manipulate the kernel in an
106 unpredetermined way to cause system changes.  All it's missing is the
107 shell-ish linguistic model.
108
109    Enter Eshell.  Eshell translates "shell-like" syntax into Lisp in
110 order to exercise the kernel in the same manner as typical system
111 shells.  There is a fundamental difference here, however, although it
112 may seem subtle at first....
113
114    Shells like csh and Bourne shell were written several decades ago,
115 in different times, under more restrictive circumstances.  This
116 confined perspective shows itself in the paradigm used by nearly all
117 command-line shells since.  They are linear in conception, byte
118 stream-based, sequential, and confined to movement within a single host
119 machine.
120
121    Emacs, on the other hand, is more than just a limited translator
122 that can invoke subprocesses and redirect file handles.  It also
123 manages character buffers, windowing frames, network connections,
124 registers, bookmarks, processes, etc.  In other words, it's a very
125 multi-dimensional environment, within which eshell emulates a highly
126 linear methodology.
127
128    Taking a moment, let's look at how this could affect the future of a
129 shell allowed to develop in such a wider field of play:
130
131    * There is no reason why directory movement should be linear, and
132      confined to a single file-system.  Emacs, through w3 and ange-ftp,
133      has access to the entire Web.  Why not allow a user to cd to
134      multiple directories simultaneously, for example?  It might make
135      some tasks easier, such as diff'ing files separated by very long
136      pathnames.
137
138    * Data sources are available from anywhere Emacs can derive
139      information from: not just from files or the output of other
140      processes.
141
142    * Multiple shell invocations all share the same environment--even
143      the same process list!  It would be possible to have "process
144      views", so that one buffer is watching standard output, another
145      standard error, and another the result of standard output grep'd
146      through a regular expression...
147
148    * It is not necessary to "leave" the shell, losing all input and
149      output history, environment variables, directory stack, etc.
150      Emacs could save the contents of your eshell environment, and
151      restore all of it (or at least as much as possible) each time you
152      restart.  This could occur automatically, without requiring
153      complex initialization scripts.
154
155    * Typos occur all of the time; many of them are repeats of common
156      errors, such as `dri' for `dir'.  Since executing non-existent
157      programs is rarely the intention of the user, eshell could prompt
158      for the replacement string, and then record that in a database of
159      known misspellings. (Note: The typo at the beginning of this
160      paragraph wasn't discovered until two months after I wrote the
161      text; it was not intentional).
162
163    * Emacs' register and bookmarking facilities can be used for
164      remembering where you've been, and what you've seen--to varying
165      levels of persistence.  They could perhaps even be tied to
166      specific "moments" during eshell execution, which would include
167      the environment at that time, as well as other variables.
168      Although this would require functionality orthogonal to Emacs' own
169      bookmarking facilities, the interface used could be made to
170      operate very similarly.
171
172    This presents a brief idea of what the fuller dimensionality of an
173 Emacs shell could offer.  It's not just the language of a shell that
174 determines how it's used, but also the Weltanschauung underlying its
175 design--and which is felt behind even the smallest feature.  I would
176 hope the freedom provided by using Emacs as a parent environment will
177 invite rich ideas from others.  It certainly feels as though all I've
178 done so far is to tie down the horse, so to speak, so that he will run
179 at a man's pace.
180
181 Influences
182 ==========
183
184    The author of Eshell has been a long-time user of the following
185 shells, all of which contributed to Eshell's design:
186
187    * rc
188
189    * bash
190
191    * zsh
192
193    * sh
194
195    * 4nt
196
197    * csh
198