Commit | Line | Data |
---|---|---|
4009494e GM |
1 | \input texinfo @c -*-texinfo-*- |
2 | @c %**start of header | |
db78a8cb | 3 | @setfilename ../../info/eshell |
4009494e | 4 | @settitle Eshell: The Emacs Shell |
c7205e53 | 5 | @defindex cm |
4009494e GM |
6 | @synindex vr fn |
7 | @c %**end of header | |
8 | ||
9 | @copying | |
10 | This manual is for Eshell, the Emacs shell. | |
11 | ||
ab422c4d | 12 | Copyright @copyright{} 1999--2013 Free Software Foundation, Inc. |
4009494e GM |
13 | |
14 | @quotation | |
15 | Permission is granted to copy, distribute and/or modify this document | |
6a2c4aec | 16 | under the terms of the GNU Free Documentation License, Version 1.3 or |
4009494e | 17 | any later version published by the Free Software Foundation; with no |
debf4439 GM |
18 | Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', |
19 | and with the Back-Cover Texts as in (a) below. A copy of the license | |
20 | is included in the section entitled ``GNU Free Documentation License''. | |
4009494e | 21 | |
6f093307 | 22 | (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and |
6bf430d1 | 23 | modify this GNU manual.'' |
4009494e GM |
24 | @end quotation |
25 | @end copying | |
26 | ||
0c973505 | 27 | @dircategory Emacs misc features |
4009494e | 28 | @direntry |
62e034c2 | 29 | * Eshell: (eshell). A command shell implemented in Emacs Lisp. |
4009494e GM |
30 | @end direntry |
31 | ||
4009494e GM |
32 | @titlepage |
33 | @sp 4 | |
34 | @c The title is printed in a large font. | |
35 | @center @titlefont{User's Guide} | |
db671917 | 36 | @sp 1 |
4009494e | 37 | @center @titlefont{to} |
db671917 | 38 | @sp 1 |
4009494e GM |
39 | @center @titlefont{Eshell: The Emacs Shell} |
40 | @ignore | |
41 | @sp 2 | |
42 | @center release 2.4 | |
43 | @c -release- | |
44 | @end ignore | |
45 | @sp 3 | |
c7205e53 | 46 | @center John Wiegley & Aidan Gauland |
4009494e GM |
47 | @c -date- |
48 | ||
49 | @page | |
50 | @vskip 0pt plus 1filll | |
51 | @insertcopying | |
52 | @end titlepage | |
53 | ||
54 | @contents | |
55 | ||
56 | @c ================================================================ | |
57 | @c The real text starts here | |
58 | @c ================================================================ | |
59 | ||
60 | @ifnottex | |
563a450c | 61 | @node Top |
4009494e GM |
62 | @top Eshell |
63 | ||
53964682 | 64 | Eshell is a shell-like command interpreter |
4009494e GM |
65 | implemented in Emacs Lisp. It invokes no external processes except for |
66 | those requested by the user. It is intended to be a functional | |
67 | replacement for command shells such as @command{bash}, @command{zsh}, | |
68 | @command{rc}, or @command{4dos}; since Emacs itself is capable of | |
69 | handling the sort of tasks accomplished by those tools. | |
70 | @c This manual is updated to release 2.4 of Eshell. | |
5dc584b5 KB |
71 | |
72 | @insertcopying | |
4009494e GM |
73 | @end ifnottex |
74 | ||
75 | @menu | |
76 | * What is Eshell?:: A brief introduction to the Emacs Shell. | |
77 | * Command basics:: The basics of command usage. | |
78 | * Commands:: | |
c7205e53 | 79 | * Expansion:: |
4009494e | 80 | * Input/Output:: |
4009494e | 81 | * Extension modules:: |
4009494e GM |
82 | * Bugs and ideas:: Known problems, and future ideas. |
83 | * GNU Free Documentation License:: The license for this documentation. | |
84 | * Concept Index:: | |
85 | * Function and Variable Index:: | |
86 | * Key Index:: | |
c7205e53 | 87 | * Command Index:: |
4009494e GM |
88 | @end menu |
89 | ||
90 | @node What is Eshell? | |
91 | @chapter What is Eshell? | |
92 | @cindex what is Eshell? | |
93 | @cindex Eshell, what it is | |
94 | ||
95 | Eshell is a @dfn{command shell} written in Emacs Lisp. Everything it | |
44e97401 | 96 | does, it uses Emacs's facilities to do. This means that Eshell is as |
4009494e GM |
97 | portable as Emacs itself. It also means that cooperation with Lisp code |
98 | is natural and seamless. | |
99 | ||
100 | What is a command shell? To properly understand the role of a shell, | |
101 | it's necessary to visualize what a computer does for you. Basically, a | |
102 | computer is a tool; in order to use that tool, you must tell it what to | |
103 | do---or give it ``commands.'' These commands take many forms, such as | |
104 | clicking with a mouse on certain parts of the screen. But that is only | |
105 | one form of command input. | |
106 | ||
107 | By far the most versatile way to express what you want the computer to | |
108 | do is by using an abbreviated language called @dfn{script}. In | |
109 | script, instead of telling the computer, ``list my files, please'', | |
110 | one writes a standard abbreviated command word---@samp{ls}. Typing | |
111 | @samp{ls} in a command shell is a script way of telling the computer | |
112 | to list your files.@footnote{This is comparable to viewing the | |
113 | contents of a folder using a graphical display.} | |
114 | ||
115 | The real flexibility of this approach is apparent only when you realize | |
116 | that there are many, many different ways to list files. Perhaps you | |
117 | want them sorted by name, sorted by date, in reverse order, or grouped | |
118 | by type. Most graphical browsers have simple ways to express this. But | |
119 | what about showing only a few files, or only files that meet a certain | |
120 | criteria? In very complex and specific situations, the request becomes | |
121 | too difficult to express using a mouse or pointing device. It is just | |
122 | these kinds of requests that are easily solved using a command shell. | |
123 | ||
124 | For example, what if you want to list every Word file on your hard | |
125 | drive, larger than 100 kilobytes in size, and which hasn't been looked | |
126 | at in over six months? That is a good candidate list for deletion, when | |
127 | you go to clean up your hard drive. But have you ever tried asking your | |
128 | computer for such a list? There is no way to do it! At least, not | |
129 | without using a command shell. | |
130 | ||
131 | The role of a command shell is to give you more control over what your | |
132 | computer does for you. Not everyone needs this amount of control, and | |
133 | it does come at a cost: Learning the necessary script commands to | |
134 | express what you want done. A complicated query, such as the example | |
135 | above, takes time to learn. But if you find yourself using your | |
136 | computer frequently enough, it is more than worthwhile in the long run. | |
137 | Any tool you use often deserves the time spent learning to master it. | |
138 | @footnote{For the understandably curious, here is what that command | |
139 | looks like: But don't let it fool you; once you know what's going on, | |
140 | it's easier than it looks: @code{ls -lt **/*.doc(Lk+50aM+5)}.} | |
141 | ||
142 | @menu | |
143 | * Contributors to Eshell:: People who have helped out! | |
144 | @end menu | |
145 | ||
146 | @node Contributors to Eshell | |
147 | @section Contributors to Eshell | |
148 | @cindex contributors | |
149 | @cindex authors | |
150 | ||
151 | Contributions to Eshell are welcome. I have limited time to work on | |
152 | this project, but I will gladly add any code you contribute to me to | |
153 | this package. | |
154 | ||
155 | The following persons have made contributions to Eshell. | |
156 | ||
157 | @itemize @bullet | |
158 | @item | |
159 | Eli Zaretskii made it possible for Eshell to run without requiring | |
160 | asynchronous subprocess support. This is important for MS-DOS, which | |
161 | does not have such support.@refill | |
162 | ||
163 | @item | |
164 | Miles Bader contributed many fixes during the port to Emacs 21.@refill | |
165 | ||
166 | @item | |
167 | Stefan Monnier fixed the things which bothered him, which of course made | |
168 | things better for all.@refill | |
169 | ||
170 | @item | |
171 | Gerd Moellmann also helped to contribute bug fixes during the initial | |
172 | integration with Emacs 21.@refill | |
173 | ||
174 | @item | |
175 | Alex Schroeder contributed code for interactively querying the user | |
176 | before overwriting files.@refill | |
177 | ||
178 | @item | |
179 | Sudish Joseph helped with some XEmacs compatibility issues.@refill | |
180 | @end itemize | |
181 | ||
182 | Apart from these, a lot of people have sent suggestions, ideas, | |
183 | requests, bug reports and encouragement. Thanks a lot! Without you | |
184 | there would be no new releases of Eshell. | |
185 | ||
186 | @node Command basics | |
187 | @chapter Basic overview | |
188 | ||
189 | A command shell is a means of entering verbally-formed commands. This | |
190 | is really all that it does, and every feature described in this manual | |
191 | is a means to that end. Therefore, it's important to take firm hold on | |
192 | exactly what a command is, and how it fits in the overall picture of | |
193 | things. | |
194 | ||
195 | @menu | |
196 | * Commands verbs:: Commands always begin with a verb. | |
197 | * Command arguments:: Some verbs require arguments. | |
198 | @end menu | |
199 | ||
200 | @node Commands verbs | |
201 | @section Commands verbs | |
202 | ||
203 | Commands are expressed using @dfn{script}, a special shorthand language | |
204 | computers can understand with no trouble. Script is an extremely simple | |
205 | language; oddly enough, this is what makes it look so complicated! | |
206 | Whereas normal languages use a variety of embellishments, the form of a | |
207 | script command is always: | |
208 | ||
209 | @example | |
210 | @var{verb} [@var{arguments}] | |
211 | @end example | |
212 | ||
213 | The verb expresses what you want your computer to do. There are a fixed | |
214 | number of verbs, although this number is usually quite large. On the | |
215 | author's computer, it reaches almost 1400 in number. But of course, | |
216 | only a handful of these are really necessary. | |
217 | ||
218 | Sometimes, the verb is all that's written. A verb is always a single | |
219 | word, usually related to the task it performs. @command{reboot} is a | |
220 | good example. Entering that on GNU/Linux will reboot the | |
221 | computer---assuming you have sufficient privileges. | |
222 | ||
223 | Other verbs require more information. These are usually very capable | |
224 | verbs, and must be told specifically what to do. The extra information | |
225 | is given in the form of @dfn{arguments}. For example, the | |
226 | @command{echo} verb prints back whatever arguments you type. It | |
227 | requires these arguments to know what to echo. A proper use of | |
228 | @command{echo} looks like this: | |
229 | ||
230 | @example | |
231 | echo This is an example of using echo! | |
232 | @end example | |
233 | ||
234 | This script command causes the computer to echo back: ``This is an | |
235 | example of using echo!'' | |
236 | ||
237 | Although command verbs are always simple words, like @command{reboot} or | |
238 | @command{echo}, arguments may have a wide variety of forms. There are | |
239 | textual arguments, numerical arguments---even Lisp arguments. | |
240 | Distinguishing these different types of arguments requires special | |
241 | typing, for the computer to know exactly what you mean. | |
242 | ||
243 | @node Command arguments | |
244 | @section Command arguments | |
245 | ||
246 | Eshell recognizes several different kinds of command arguments: | |
247 | ||
248 | @enumerate | |
249 | @item Strings (also called textual arguments) | |
250 | @item Numbers (floating point or integer) | |
251 | @item Lisp lists | |
252 | @item Lisp symbols | |
253 | @item Emacs buffers | |
254 | @item Emacs process handles | |
255 | @end enumerate | |
256 | ||
257 | Most users need to worry only about the first two. The third, Lisp lists, | |
258 | occur very frequently, but almost always behind the scenes. | |
259 | ||
260 | Strings are the most common type of argument, and consist of nearly any | |
261 | character. Special characters---those used by Eshell | |
262 | specifically---must be preceded by a backslash (@samp{\}). When in doubt, it | |
263 | is safe to add backslashes anywhere and everywhere. | |
264 | ||
265 | Here is a more complicated @command{echo} example: | |
266 | ||
267 | @example | |
268 | echo A\ Multi-word\ Argument\ With\ A\ \$\ dollar | |
269 | @end example | |
270 | ||
271 | Beyond this, things get a bit more complicated. While not beyond the | |
272 | reach of someone wishing to learn, it is definitely beyond the scope of | |
273 | this manual to present it all in a simplistic manner. Get comfortable | |
274 | with Eshell as a basic command invocation tool, and learn more about the | |
275 | commands on your system; then come back when it all sits more familiarly | |
276 | on your mind. Have fun! | |
277 | ||
278 | @node Commands | |
279 | @chapter Commands | |
280 | ||
c7205e53 AG |
281 | In a command shell, everything is done by invoking commands. This |
282 | chapter covers command invocations in Eshell, including the command | |
283 | history and invoking commands in a script file. | |
284 | ||
4009494e GM |
285 | @menu |
286 | * Invocation:: | |
c7205e53 AG |
287 | * Arguments:: |
288 | * Variables:: | |
289 | * Built-ins:: | |
4009494e GM |
290 | * Aliases:: |
291 | * History:: | |
c7205e53 AG |
292 | * Completion:: |
293 | * for loop:: | |
4009494e | 294 | * Scripts:: |
4009494e GM |
295 | @end menu |
296 | ||
4009494e GM |
297 | @node Invocation |
298 | @section Invocation | |
4009494e GM |
299 | Unlike regular system shells, Eshell never invokes kernel functions |
300 | directly, such as @code{exec(3)}. Instead, it uses the Lisp functions | |
301 | available in the Emacs Lisp library. It does this by transforming the | |
c7205e53 AG |
302 | input line into a callable Lisp form.@footnote{To see the Lisp form that will be invoked, type: @samp{eshell-parse-command "echo hello"}} |
303 | ||
304 | The command can be either an Elisp function or an external command. | |
305 | Eshell looks first for an @ref{Aliases, alias} with the same name as the | |
306 | command, then a @ref{Built-ins, built-in command} or a function with the | |
307 | same name; if there is no match, it then tries to execute it as an | |
308 | external command. | |
309 | ||
310 | The semicolon (@code{;}) can be used to separate multiple command | |
311 | invocations on a single line. A command invocation followed by an | |
312 | ampersand (@code{&}) will be run in the background. Eshell has no job | |
313 | control, so you can not suspend or background the current process, or | |
314 | bring a background process into the foreground. That said, background | |
315 | processes invoked from Eshell can be controlled the same way as any | |
316 | other background process in Emacs. | |
4009494e | 317 | |
c7205e53 AG |
318 | @node Arguments |
319 | @section Arguments | |
320 | Command arguments are passed to the functions as either strings or | |
321 | numbers, depending on what the parser thinks they look like. If you | |
322 | need to use a function that takes some other data type, you will need to | |
323 | call it in an Elisp expression (which can also be used with | |
324 | @ref{Expansion, expansions}). As with other shells, you can | |
325 | escape special characters and spaces with the backslash (@code{\}) and | |
326 | the single (@code{''}) and double (@code{""}) quotes. | |
4009494e GM |
327 | |
328 | @node Built-ins | |
4009494e | 329 | |
c7205e53 | 330 | @section Built-in commands |
020335df MA |
331 | Several commands are built-in in Eshell. In order to call the |
332 | external variant of a built-in command @code{foo}, you could call | |
333 | @code{*foo}. Usually, this should not be necessary. You can check | |
334 | what will be applied by the @code{which} command: | |
335 | ||
336 | @example | |
337 | ~ $ which ls | |
338 | eshell/ls is a compiled Lisp function in `em-ls.el' | |
339 | ~ $ which *ls | |
340 | /bin/ls | |
341 | @end example | |
342 | ||
9841cb4f | 343 | If you want to discard a given built-in command, you could declare an |
dacbc44c | 344 | alias, @ref{Aliases}. Example: |
9841cb4f MA |
345 | |
346 | @example | |
347 | ~ $ which sudo | |
348 | eshell/sudo is a compiled Lisp function in `em-unix.el' | |
349 | ~ $ alias sudo '*sudo $*' | |
350 | ~ $ which sudo | |
351 | sudo is an alias, defined as "*sudo $*" | |
352 | @end example | |
353 | ||
c7205e53 AG |
354 | @vindex eshell-prefer-lisp-functions |
355 | If you would prefer to use the built-in commands instead of the external | |
356 | commands, set @var{eshell-prefer-lisp-functions} to @code{t}. | |
357 | ||
358 | Some of the built-in commands have different behaviour from their | |
359 | external counterparts, and some have no external counterpart. Most of | |
dacbc44c | 360 | these will print a usage message when given the @code{--help} option. |
4009494e GM |
361 | |
362 | @table @code | |
363 | ||
c7205e53 AG |
364 | @item addpath |
365 | @cmindex addpath | |
366 | Adds a given path or set of paths to the PATH environment variable, or, | |
367 | with no arguments, prints the current paths in this variable. | |
368 | ||
369 | @item alias | |
370 | @cmindex alias | |
371 | Define an alias (@pxref{Aliases}). This does not add it to the aliases | |
372 | file. | |
373 | ||
374 | @item date | |
375 | @cmindex date | |
376 | Similar to, but slightly different from, the GNU Coreutils | |
377 | @command{date} command. | |
378 | ||
379 | @item define | |
380 | @cmindex define | |
381 | Define a varalias. @xref{Variable Aliases, , , elisp}. | |
382 | ||
383 | @item diff | |
384 | @cmindex diff | |
385 | Use Emacs's internal @code{diff} (not to be confused with | |
386 | @code{ediff}). @xref{Comparing Files, , , elisp}. | |
387 | ||
388 | @item grep | |
389 | @cmindex grep | |
390 | @itemx agrep | |
391 | @cmindex agrep | |
392 | @itemx egrep | |
393 | @cmindex egrep | |
394 | @itemx fgrep | |
395 | @cmindex fgrep | |
396 | @itemx glimpse | |
397 | @cmindex glimpse | |
398 | The @command{grep} commands are compatible with GNU @command{grep}, but | |
399 | use Emacs's internal @code{grep} instead. | |
400 | ||
401 | @item info | |
402 | @cmindex info | |
403 | Same as the external @command{info} command, but uses Emacs's internal | |
404 | Info reader. | |
405 | ||
406 | @item jobs | |
407 | @cmindex jobs | |
408 | List subprocesses of the Emacs process, if any, using the function | |
409 | @code{list-processes}. | |
410 | ||
411 | @item kill | |
412 | @cmindex kill | |
413 | Kill processes. Takes a PID or a process object and an optional | |
414 | signal specifier. | |
415 | ||
416 | @item listify | |
417 | @cmindex listify | |
418 | Eshell version of @code{list}. Allows you to create a list using Eshell | |
419 | syntax, rather than Elisp syntax. For example, @samp{listify foo bar} | |
420 | and @code{("foo" "bar")} both evaluate to @code{("foo" "bar")}. | |
421 | ||
422 | @item locate | |
423 | @cmindex locate | |
424 | Alias to Emacs's @code{locate} function, which simply runs the external | |
425 | @command{locate} command and parses the results. @xref{Dired and `find', , , elisp}. | |
426 | ||
427 | @item make | |
428 | @cmindex make | |
429 | Run @command{make} through @code{compile}. @xref{Running Compilations under Emacs, , , elisp}. | |
430 | ||
431 | @item occur | |
432 | @cmindex occur | |
433 | Alias to Emacs's @code{occur}. @xref{Other Search-and-Loop Commands, , , elisp}. | |
434 | ||
435 | @item printnl | |
436 | @cmindex printnl | |
437 | Print the arguments separated by newlines. | |
4009494e | 438 | |
4009494e | 439 | @item cd |
c7205e53 | 440 | @cmindex cd |
4009494e | 441 | This command changes the current working directory. Usually, it is |
c7205e53 AG |
442 | invoked as @samp{cd foo} where @file{foo} is the new working directory. |
443 | But @command{cd} knows about a few special arguments: | |
4009494e GM |
444 | |
445 | When it receives no argument at all, it changes to the home directory. | |
446 | ||
447 | Giving the command @samp{cd -} changes back to the previous working | |
448 | directory (this is the same as @samp{cd $-}). | |
449 | ||
450 | The command @samp{cd =} shows the directory stack. Each line is | |
451 | numbered. | |
452 | ||
c7205e53 AG |
453 | With @samp{cd =foo}, Eshell searches the directory stack for a directory |
454 | matching the regular expression @samp{foo} and changes to that | |
455 | directory. | |
4009494e GM |
456 | |
457 | With @samp{cd -42}, you can access the directory stack by number. | |
458 | ||
c7205e53 AG |
459 | @item su |
460 | @cmindex su | |
461 | @itemx sudo | |
462 | @cmindex sudo | |
463 | Uses TRAMP's @command{su} or @command{sudo} method to run a command via | |
464 | @command{su} or @command{sudo}. | |
465 | ||
466 | @end table | |
467 | ||
468 | @section Built-in variables | |
4009494e GM |
469 | Eshell knows a few built-in variables: |
470 | ||
471 | @table @code | |
472 | ||
473 | @item $+ | |
474 | @vindex $+ | |
475 | This variable always contains the current working directory. | |
476 | ||
477 | @item $- | |
478 | @vindex $- | |
479 | This variable always contains the previous working directory (the | |
480 | current working directory from before the last @code{cd} command). | |
481 | ||
020335df MA |
482 | @item $_ |
483 | @vindex $_ | |
484 | It refers to the last argument of the last command. | |
485 | ||
486 | @item $$ | |
487 | @vindex $$ | |
488 | This is the result of the last command. In case of an external | |
489 | command, it is @code{t} or @code{nil}. | |
490 | ||
491 | @item $? | |
492 | @vindex $? | |
493 | This variable contains the exit code of the last command (0 or 1 for | |
494 | Lisp functions, based on successful completion). | |
495 | ||
4009494e GM |
496 | @end table |
497 | ||
c7205e53 AG |
498 | @node Variables |
499 | @section Variables | |
500 | Since Eshell is just an Emacs REPL@footnote{Read-Eval-Print Loop}, it | |
501 | does not have its own scope, and simply stores variables the same you | |
502 | would in an Elisp program. Eshell provides a command version of | |
503 | @code{setq} for convenience. | |
4009494e | 504 | |
c7205e53 AG |
505 | @node Aliases |
506 | @section Aliases | |
4009494e | 507 | |
c7205e53 AG |
508 | Aliases are commands that expand to a longer input line. For example, |
509 | @command{ll} is a common alias for @code{ls -l}, and would be defined | |
510 | with the command invocation @samp{alias ll ls -l}; with this defined, | |
511 | running @samp{ll foo} in Eshell will actually run @samp{ls -l foo}. | |
512 | Aliases defined (or deleted) by the @command{alias} command are | |
513 | automatically written to the file named by @var{eshell-aliases-file}, | |
514 | which you can also edit directly (although you will have to manually | |
515 | reload it). | |
4009494e | 516 | |
c7205e53 AG |
517 | @node History |
518 | @section History | |
519 | @cmindex history | |
020335df MA |
520 | The @samp{history} command shows all commands kept in the history ring |
521 | as numbered list. If the history ring contains | |
522 | @code{eshell-history-size} commands, those numbers change after every | |
523 | command invocation, therefore the @samp{history} command shall be | |
524 | applied before using the expansion mechanism with history numbers. | |
525 | ||
526 | The n-th entry of the history ring can be applied with the @samp{!n} | |
527 | command. If @code{n} is negative, the entry is counted from the end | |
528 | of the history ring. | |
529 | ||
530 | @samp{!foo} expands to the last command beginning with @code{foo}, and | |
531 | @samp{!?foo} to the last command containing @code{foo}. The n-th | |
532 | argument of the last command beginning with @code{foo} is accessible | |
533 | by @code{!foo:n}. | |
534 | ||
c7205e53 AG |
535 | The history ring is loaded from a file at the start of every session, |
536 | and written back to the file at the end of every session. The file path | |
537 | is specified in @var{eshell-history-file-name}. Unlike other shells, | |
538 | such as Bash, Eshell can not be configured to keep a history ring of a | |
539 | different size than that of the history file. | |
540 | ||
541 | Since the default buffer navigation and searching key-bindings are | |
542 | still present in the Eshell buffer, the commands for history | |
543 | navigation and searching are bound to different keys: | |
544 | ||
545 | @table @kbd | |
546 | @item M-r | |
547 | @itemx M-s | |
548 | History I-search. | |
549 | ||
550 | @item M-p | |
551 | @itemx M-n | |
552 | Previous and next history line. If there is anything on the input | |
553 | line when you run these commands, they will instead jump to the | |
554 | precious or next line that begins with that string. | |
555 | @end table | |
556 | ||
557 | @node Completion | |
558 | @section Completion | |
559 | Eshell uses the pcomplete package for programmable completion, similar | |
560 | to that of other command shells. Argument completion differs depending | |
561 | on the preceding command: for example, possible completions for | |
562 | @command{rmdir} are only directories, while @command{rm} completions can | |
563 | be directories @emph{and} files. Eshell provides predefined completions | |
564 | for the built-in functions and some common external commands, and you | |
565 | can define your own for any command. | |
566 | ||
567 | Eshell completion also works for lisp forms and glob patterns. If the | |
568 | point is on a lisp form, then @key{TAB} will behave similarly to completion | |
569 | in @code{elisp-mode} and @code{lisp-interaction-mode}. For glob | |
570 | patterns, If there are few enough possible completions of the patterns, | |
571 | they will be cycled when @key{TAB} is pressed, otherwise it will be removed | |
572 | from the input line and the possible completions will be listed. | |
573 | ||
574 | If you want to see the entire list of possible completions when it's | |
575 | below the cycling threshold, press @kbd{M-?}. | |
576 | ||
577 | @subsection pcomplete | |
578 | Pcomplete, short for programmable completion, is the completion | |
579 | library originally written for Eshell, but usable for command | |
580 | completion@footnote{Command completion as opposed to code completion, | |
581 | which is a beyond the scope of pcomplete.} in other modes. | |
582 | ||
583 | Completions are defined as functions (with @code{defun}) named | |
584 | @code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the | |
585 | command for which this function provides completions; you can also name | |
586 | the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions | |
587 | for a specific major mode. | |
588 | ||
589 | @node for loop | |
590 | @section @code{for} loop | |
591 | Because Eshell commands can not (easily) be combined with lisp forms, | |
592 | Eshell provides a command-oriented @command{for}-loop for convenience. | |
593 | The syntax is as follows: | |
020335df MA |
594 | |
595 | @example | |
c7205e53 | 596 | @code{for VAR in TOKENS @{ command invocation(s) @}} |
020335df MA |
597 | @end example |
598 | ||
c7205e53 AG |
599 | where @samp{TOKENS} is a space-separated sequence of values of |
600 | @var{VAR} for each iteration. This can even be the output of a | |
601 | command if @samp{TOKENS} is replaced with @samp{@{ command invocation @}}. | |
4009494e | 602 | |
c7205e53 AG |
603 | @node Scripts |
604 | @section Scripts | |
605 | @cmindex source | |
606 | @fnindex eshell-source-file | |
607 | You can run Eshell scripts much like scripts for other shells; the main | |
608 | difference is that since Eshell is not a system command, you have to run | |
609 | it from within Emacs. An Eshell script is simply a file containing a | |
610 | sequence of commands, as with almost any other shell script. Scripts | |
611 | are invoked from Eshell with @command{source}, or from anywhere in Emacs | |
612 | with @code{eshell-source-file}. | |
613 | ||
614 | @cmindex . | |
615 | If you wish to load a script into your @emph{current} environment, | |
616 | rather than in a subshell, use the @code{.} command. | |
617 | ||
618 | @node Expansion | |
619 | @chapter Expansion | |
620 | Expansion in a command shell is somewhat like macro expansion in macro | |
621 | parsers (such as @command{cpp} and @command{m4}), but in a command | |
622 | shell, they are less often used for constants, and usually for using | |
623 | variables and string manipulation.@footnote{Eshell has no | |
624 | string-manipulation expansions because the Elisp library already | |
625 | provides many functions for this.} For example, @code{$var} on a line | |
626 | expands to the value of the variable @code{var} when the line is | |
627 | executed. Expansions are usually passed as arguments, but may also be | |
65e7ca35 | 628 | used as commands.@footnote{E.g., entering just @samp{$var} at the prompt |
c7205e53 | 629 | is equivalent to entering the value of @code{var} at the prompt.} |
4009494e GM |
630 | |
631 | @menu | |
c7205e53 | 632 | * Dollars Expansion:: |
4009494e | 633 | * Globbing:: |
4009494e GM |
634 | @end menu |
635 | ||
c7205e53 AG |
636 | @node Dollars Expansion |
637 | @section Dollars Expansion | |
638 | Eshell has different @code{$} expansion syntax from other shells. There | |
639 | are some similarities, but don't let these lull you into a false sense | |
640 | of familiarity. | |
4009494e | 641 | |
c7205e53 | 642 | @table @code |
4009494e | 643 | |
c7205e53 AG |
644 | @item $var |
645 | Expands to the value bound to @code{var}. This is the main way to use | |
646 | variables in command invocations. | |
4009494e | 647 | |
c7205e53 AG |
648 | @item $#var |
649 | Expands to the length of the value bound to @code{var}. Raises an error | |
650 | if the value is not a sequence (@pxref{Sequences Arrays and Vectors, Sequences, , elisp}). | |
4009494e | 651 | |
c7205e53 AG |
652 | @item $(lisp) |
653 | Expands to the result of evaluating the S-expression @code{(lisp)}. On | |
654 | its own, this is identical to just @code{(lisp)}, but with the @code{$}, | |
655 | it can be used in a string, such as @samp{/some/path/$(lisp).txt}. | |
4009494e | 656 | |
c7205e53 AG |
657 | @item $@{command@} |
658 | Returns the output of @command{command}, which can be any valid Eshell | |
659 | command invocation, and may even contain expansions. | |
4009494e | 660 | |
c7205e53 AG |
661 | @item $var[i] |
662 | Expands to the @code{i}th element of the value bound to @code{var}. If | |
663 | the value is a string, it will be split at whitespace to make it a list. | |
664 | Again, raises an error if the value is not a sequence. | |
665 | ||
666 | @item $var[: i] | |
667 | As above, but now splitting occurs at the colon character. | |
4009494e | 668 | |
c7205e53 AG |
669 | @item $var[: i j] |
670 | As above, but instead of returning just a string, it now returns a list | |
671 | of two strings. If the result is being interpolated into a larger | |
672 | string, this list will be flattened into one big string, with each | |
673 | element separated by a space. | |
4009494e | 674 | |
c7205e53 AG |
675 | @item $var["\\\\" i] |
676 | Separate on backslash characters. Actually, the first argument -- if it | |
677 | doesn't have the form of a number, or a plain variable name -- can be | |
678 | any regular expression. So to split on numbers, use @samp{$var["[0-9]+" 10 20]}. | |
4009494e | 679 | |
c7205e53 AG |
680 | @item $var[hello] |
681 | Calls @code{assoc} on @code{var} with @code{"hello"}, expecting it to be | |
682 | an alist (@pxref{Association List Type, Association Lists, , elisp}). | |
683 | ||
684 | @item $#var[hello] | |
685 | Returns the length of the cdr of the element of @code{var} who car is equal | |
686 | to @code{"hello"}. | |
687 | ||
688 | @end table | |
689 | ||
690 | @node Globbing | |
691 | @section Globbing | |
692 | Eshell's globbing syntax is very similar to that of Zsh. Users coming | |
693 | from Bash can still use Bash-style globbing, as there are no | |
694 | incompatibilities. Most globbing is pattern-based expansion, but there | |
695 | is also predicate-based expansion. See @ref{Filename Generation, , , zsh} | |
696 | for full syntax. To customize the syntax and behaviour of globbing in | |
697 | Eshell see the Customize@footnote{@xref{Customization Settings, Customize, , elisp}.} | |
698 | groups ``eshell-glob'' and ``eshell-pred''. | |
699 | ||
700 | @node Input/Output | |
701 | @chapter Input/Output | |
702 | Since Eshell does not communicate with a terminal like most command | |
703 | shells, IO is a little different. If you try to run programs from | |
704 | within Eshell that are not line-oriented, such as programs that use | |
705 | ncurses, you will just get garbage output, since the Eshell buffer is | |
706 | not a terminal emulator. Eshell solves this problem by running | |
707 | specified commands in Emacs's terminal emulator; to let Eshell know | |
708 | which commands need to be run in a terminal, add them to the list | |
709 | @var{eshell-visual-commands}. | |
710 | ||
711 | Redirection is mostly the same in Eshell as it is in other command | |
6a0fda53 AG |
712 | shells. The output redirection operators @code{>} and @code{>>} as |
713 | well as pipes are supported, but there is not yet any support for | |
714 | input redirection. Output can also be redirected to buffers, using | |
715 | the @code{>>>} redirection operator, and Elisp functions, using | |
c7205e53 AG |
716 | virtual devices. |
717 | ||
6a0fda53 AG |
718 | The buffer redirection operator, @code{>>>}, expects a buffer object |
719 | on the right-hand side, into which it inserts the output of the | |
720 | left-hand side. e.g., @samp{echo hello >>> #<buffer *scratch*>} | |
721 | inserts the string @code{"hello"} into the @code{*scratch*} buffer. | |
722 | ||
c7205e53 AG |
723 | @var{eshell-virtual-targets} is a list of mappings of virtual device |
724 | names to functions. Eshell comes with two virtual devices: | |
725 | @file{/dev/kill}, which sends the text to the kill ring, and | |
726 | @file{/dev/clip}, which sends text to the clipboard. | |
727 | ||
728 | You can, of course, define your own virtual targets. They are defined | |
729 | by adding a list of the form @code{("/dev/name" function mode)} to | |
730 | @var{eshell-virtual-targets}. The first element is the device name; | |
731 | @code{function} may be either a lambda or a function name. If | |
732 | @code{mode} is nil, then the function is the output function; if it is | |
733 | non-nil, then the function is passed the redirection mode as a | |
6a0fda53 AG |
734 | symbol--@code{overwrite} for @code{>}, @code{append} for @code{>>}, or |
735 | @code{insert} for @code{>>>}--and the function is expected to return | |
736 | the output function. | |
c7205e53 AG |
737 | |
738 | The output function is called once on each line of output until | |
739 | @code{nil} is passed, indicating end of output. | |
4009494e GM |
740 | |
741 | @node Extension modules | |
742 | @chapter Extension modules | |
c7205e53 AG |
743 | Eshell provides a facility for defining extension modules so that they |
744 | can be disabled and enabled without having to unload and reload them, | |
745 | and to provide a common parent Customize group for the | |
746 | modules.@footnote{ERC provides a similar module facility.} An Eshell | |
747 | module is defined the same as any other library but one requirement: the | |
748 | module must define a Customize@footnote{@xref{Customization Settings, Customize, , elisp}.} | |
749 | group using @code{eshell-defgroup} (in place of @code{defgroup}) with | |
750 | @code{eshell-module} as the parent group.@footnote{If the module has | |
751 | no user-customizable options, then there is no need to define it as an | |
752 | Eshell module.} You also need to load the following as shown: | |
753 | ||
754 | @example | |
755 | (eval-when-compile | |
756 | (require 'cl) | |
757 | (require 'esh-mode) | |
758 | (require 'eshell)) | |
759 | ||
760 | (require 'esh-util) | |
761 | @end example | |
4009494e GM |
762 | |
763 | @menu | |
764 | * Writing a module:: | |
765 | * Module testing:: | |
766 | * Directory handling:: | |
767 | * Key rebinding:: | |
768 | * Smart scrolling:: | |
769 | * Terminal emulation:: | |
4009494e GM |
770 | @end menu |
771 | ||
772 | @node Writing a module | |
773 | @section Writing a module | |
774 | ||
775 | @node Module testing | |
776 | @section Module testing | |
777 | ||
778 | @node Directory handling | |
779 | @section Directory handling | |
780 | ||
781 | @node Key rebinding | |
782 | @section Key rebinding | |
783 | ||
784 | @node Smart scrolling | |
785 | @section Smart scrolling | |
786 | ||
787 | @node Terminal emulation | |
788 | @section Terminal emulation | |
789 | ||
4009494e GM |
790 | @node Bugs and ideas |
791 | @chapter Bugs and ideas | |
792 | @cindex reporting bugs and ideas | |
793 | @cindex bugs, how to report them | |
794 | @cindex author, how to reach | |
795 | @cindex email to the author | |
796 | @cindex FAQ | |
797 | @cindex problems, list of common | |
c7205e53 AG |
798 | @cindex known bugs |
799 | @cindex bugs, known | |
4009494e GM |
800 | |
801 | If you find a bug or misfeature, don't hesitate to let me know! Send | |
802 | email to @email{johnw@@gnu.org}. Feature requests should also be sent | |
803 | there. I prefer discussing one thing at a time. If you find several | |
804 | unrelated bugs, please report them separately. | |
805 | ||
806 | If you have ideas for improvements, or if you have written some | |
807 | extensions to this package, I would like to hear from you. I hope you | |
808 | find this package useful! | |
809 | ||
c7205e53 | 810 | Below is a complete list of known problems with Eshell version 2.4.2, |
4009494e GM |
811 | which is the version included with Emacs 22. |
812 | ||
813 | @table @asis | |
814 | @item Documentation incomplete | |
815 | ||
816 | @item Differentiate between aliases and functions | |
817 | ||
c7205e53 | 818 | Allow for a Bash-compatible syntax, such as: |
4009494e GM |
819 | |
820 | @example | |
821 | alias arg=blah | |
822 | function arg () @{ blah $* @} | |
823 | @end example | |
824 | ||
825 | @item @samp{for i in 1 2 3 @{ grep -q a b && *echo has it @} | wc -l} outputs result after prompt | |
826 | ||
827 | In fact, piping to a process from a looping construct doesn't work in | |
828 | general. If I change the call to @code{eshell-copy-handles} in | |
829 | @code{eshell-rewrite-for-command} to use @code{eshell-protect}, it seems | |
830 | to work, but the output occurs after the prompt is displayed. The whole | |
831 | structured command thing is too complicated at present. | |
832 | ||
833 | @item Error with @command{bc} in @code{eshell-test} | |
834 | ||
835 | On some XEmacs system, the subprocess interaction test fails | |
836 | inexplicably, although @command{bc} works fine at the command prompt. | |
837 | ||
838 | @item Eshell does not delete @file{*Help*} buffers in XEmacs 21.1.8+ | |
839 | ||
840 | In XEmacs 21.1.8, the @file{*Help*} buffer has been renamed such that | |
841 | multiple instances of the @file{*Help*} buffer can exist. | |
842 | ||
843 | @item Pcomplete sometimes gets stuck | |
844 | ||
845 | You press @key{TAB}, but no completions appear, even though the | |
846 | directory has matching files. This behavior is rare. | |
847 | ||
848 | @item @samp{grep python $<rpm -qa>} doesn't work, but using @samp{*grep} does | |
849 | ||
850 | This happens because the @code{grep} Lisp function returns immediately, | |
851 | and then the asynchronous @command{grep} process expects to examine the | |
852 | temporary file, which has since been deleted. | |
853 | ||
854 | @item Problem with C-r repeating text | |
855 | ||
856 | If the text @emph{before point} reads "./run", and you type @kbd{C-r r u | |
857 | n}, it will repeat the line for every character typed. | |
858 | ||
859 | @item Backspace doesn't scroll back after continuing (in smart mode) | |
860 | ||
861 | Hitting space during a process invocation, such as @command{make}, will | |
862 | cause it to track the bottom of the output; but backspace no longer | |
863 | scrolls back. | |
864 | ||
865 | @item It's not possible to fully @code{unload-feature} Eshell | |
866 | ||
867 | @item Menu support was removed, but never put back | |
868 | ||
869 | @item Using C-p and C-n with rebind gets into a locked state | |
870 | ||
fa463103 | 871 | This happened a few times in Emacs 21, but has been irreproducible |
4009494e GM |
872 | since. |
873 | ||
874 | @item If an interactive process is currently running, @kbd{M-!} doesn't work | |
875 | ||
876 | @item Use a timer instead of @code{sleep-for} when killing child processes | |
877 | ||
878 | @item Piping to a Lisp function is not supported | |
879 | ||
880 | Make it so that the Lisp command on the right of the pipe is repeatedly | |
881 | called with the input strings as arguments. This will require changing | |
882 | @code{eshell-do-pipeline} to handle non-process targets. | |
883 | ||
884 | @item Input redirection is not supported | |
885 | ||
886 | See the above entry. | |
887 | ||
888 | @item Problem running @command{less} without arguments on Windows | |
889 | ||
890 | The result in the Eshell buffer is: | |
891 | ||
892 | @example | |
893 | Spawning child process: invalid argument | |
894 | @end example | |
895 | ||
896 | Also a new @command{less} buffer was created with nothing in it@dots{} | |
897 | (presumably this holds the output of @command{less}). | |
898 | ||
899 | If @command{less.exe} is invoked from the Eshell command line, the | |
900 | expected output is written to the buffer. | |
901 | ||
902 | Note that this happens on NT-Emacs 20.6.1 on Windows 2000. The term.el | |
903 | package and the supplied shell both use the @command{cmdproxy} program | |
904 | for running shells. | |
905 | ||
906 | @item Implement @samp{-r}, @samp{-n} and @samp{-s} switches for @command{cp} | |
907 | ||
908 | @item Make @kbd{M-5 M-x eshell} switch to ``*eshell<5>*'', creating if need be | |
909 | ||
910 | @item @samp{mv @var{dir} @var{file}.tar} does not remove directories | |
911 | ||
912 | This is because the tar option --remove-files doesn't do so. Should it | |
913 | be Eshell's job? | |
914 | ||
915 | @item Bind @code{standard-output} and @code{standard-error} | |
916 | ||
917 | This would be so that if a Lisp function calls @code{print}, everything | |
918 | will happen as it should (albeit slowly). | |
919 | ||
920 | @item When an extension module fails to load, @samp{cd /} gives a Lisp error | |
921 | ||
922 | @item If a globbing pattern returns one match, should it be a list? | |
923 | ||
924 | @item Make sure syntax table is correct in Eshell mode | |
925 | ||
926 | So that @kbd{M-DEL} acts in a predictable manner, etc. | |
927 | ||
928 | @item Allow all Eshell buffers to share the same history and list-dir | |
929 | ||
930 | @item There is a problem with script commands that output to @file{/dev/null} | |
931 | ||
932 | If a script file, somewhere in the middle, uses @samp{> /dev/null}, | |
933 | output from all subsequent commands is swallowed. | |
934 | ||
935 | @item Split up parsing of text after @samp{$} in @file{esh-var.el} | |
936 | ||
937 | Make it similar to the way that @file{esh-arg.el} is structured. | |
938 | Then add parsing of @samp{$[?\n]}. | |
939 | ||
940 | @item After pressing @kbd{M-RET}, redisplay before running the next command | |
941 | ||
942 | @item Argument predicates and modifiers should work anywhere in a path | |
943 | ||
944 | @example | |
945 | /usr/local/src/editors/vim $ vi **/CVS(/)/Root(.) | |
946 | Invalid regexp: "Unmatched ( or \\(" | |
947 | @end example | |
948 | ||
949 | With @command{zsh}, the glob above expands to all files named | |
950 | @file{Root} in directories named @file{CVS}. | |
951 | ||
952 | @item Typing @samp{echo $@{locate locate@}/bin<TAB>} results in a Lisp error | |
953 | ||
954 | Perhaps it should interpolate all permutations, and make that the | |
955 | globbing result, since otherwise hitting return here will result in | |
956 | ``(list of filenames)/bin'', which is never valuable. Thus, one could | |
957 | @command{cat} only C backup files by using @samp{ls $@{identity *.c@}~}. | |
958 | In that case, having an alias command name @command{glob} for | |
959 | @command{identity} would be useful. | |
960 | ||
961 | @item Once symbolic mode is supported for @command{umask}, implement @command{chmod} in Lisp | |
962 | ||
963 | @item Create @code{eshell-expand-file-name} | |
964 | ||
965 | This would use a data table to transform things such as @samp{~+}, | |
966 | @samp{...}, etc. | |
967 | ||
968 | @item Abstract @file{em-smart.el} into @file{smart-scroll.el} | |
969 | ||
970 | It only really needs: to be hooked onto the output filter and the | |
971 | pre-command hook, and to have the input-end and input-start markers. | |
972 | And to know whether the last output group was ``successful.'' | |
973 | ||
974 | @item Allow for fully persisting the state of Eshell | |
975 | ||
976 | This would include: variables, history, buffer, input, dir stack, etc. | |
977 | ||
978 | @item Implement D as an argument predicate | |
979 | ||
980 | It means that files beginning with a dot should be included in the | |
981 | glob match. | |
982 | ||
983 | @item A comma in a predicate list should mean OR | |
984 | ||
985 | At the moment, this is not supported. | |
986 | ||
987 | @item Error if a glob doesn't expand due to a predicate | |
988 | ||
989 | An error should be generated only if @code{eshell-error-if-no-glob} is | |
990 | non-@code{nil}. | |
991 | ||
992 | @item @samp{(+ RET SPC TAB} does not cause @code{indent-according-to-mode} to occur | |
993 | ||
994 | @item Create @code{eshell-auto-accumulate-list} | |
995 | ||
996 | This is a list of commands for which, if the user presses @kbd{RET}, the | |
997 | text is staged as the next Eshell command, rather than being sent to the | |
998 | current interactive process. | |
999 | ||
1000 | @item Display file and line number if an error occurs in a script | |
1001 | ||
1002 | @item @command{wait} doesn't work with process ids at the moment | |
1003 | ||
1004 | @item Enable the direct-to-process input code in @file{em-term.el} | |
1005 | ||
1006 | @item Problem with repeating @samp{echo $@{find /tmp@}} | |
1007 | ||
1008 | With smart display active, if @kbd{RET} is held down, after a while it | |
1009 | can't keep up anymore and starts outputting blank lines. It only | |
1010 | happens if an asynchronous process is involved@dots{} | |
1011 | ||
1012 | I think the problem is that @code{eshell-send-input} is resetting the | |
1013 | input target location, so that if the asynchronous process is not done | |
1014 | by the time the next @kbd{RET} is received, the input processor thinks | |
1015 | that the input is meant for the process; which, when smart display is | |
1016 | enabled, will be the text of the last command line! That is a bug in | |
1017 | itself. | |
1018 | ||
1019 | In holding down @kbd{RET} while an asynchronous process is running, | |
1020 | there will be a point in between termination of the process, and the | |
1021 | running of @code{eshell-post-command-hook}, which would cause | |
1022 | @code{eshell-send-input} to call @code{eshell-copy-old-input}, and then | |
1023 | process that text as a command to be run after the process. Perhaps | |
1024 | there should be a way of killing pending input between the death of the | |
1025 | process, and the @code{post-command-hook}. | |
1026 | ||
1027 | @item Allow for a more aggressive smart display mode | |
1028 | ||
1029 | Perhaps toggled by a command, that makes each output block a smart | |
1030 | display block. | |
1031 | ||
1032 | @item Create more meta variables | |
1033 | ||
1034 | @table @samp | |
1035 | @item $! | |
1036 | The reason for the failure of the last disk command, or the text of the | |
1037 | last Lisp error. | |
1038 | ||
1039 | @item $= | |
1040 | A special associate array, which can take references of the form | |
1041 | @samp{$=[REGEXP]}. It indexes into the directory ring. | |
1042 | @end table | |
1043 | ||
1044 | @item Eshell scripts can't execute in the background | |
1045 | ||
1df7defd | 1046 | @item Support zsh's ``Parameter Expansion'' syntax, i.e., @samp{$@{@var{name}:-@var{val}@}} |
4009494e GM |
1047 | |
1048 | @item Write an @command{info} alias that can take arguments | |
1049 | ||
1050 | So that the user can enter @samp{info chmod}, for example. | |
1051 | ||
1052 | @item Create a mode @code{eshell-browse} | |
1053 | ||
1054 | It would treat the Eshell buffer as a outline. Collapsing the outline | |
1055 | hides all of the output text. Collapsing again would show only the | |
1056 | first command run in each directory | |
1057 | ||
1058 | @item Allow other revisions of a file to be referenced using @samp{file@{rev@}} | |
1059 | ||
1060 | This would be expanded by @code{eshell-expand-file-name} (see above). | |
1061 | ||
1062 | @item Print ``You have new mail'' when the ``Mail'' icon is turned on | |
1063 | ||
1064 | @item Implement @kbd{M-|} for Eshell | |
1065 | ||
1066 | @item Implement input redirection | |
1067 | ||
1068 | If it's a Lisp function, input redirection implies @command{xargs} (in a | |
1069 | way@dots{}). If input redirection is added, also update the | |
1070 | @code{file-name-quote-list}, and the delimiter list. | |
1071 | ||
1072 | @item Allow @samp{#<@var{word} @var{arg}>} as a generic syntax | |
1073 | ||
1074 | With the handling of @emph{word} specified by an | |
1075 | @code{eshell-special-alist}. | |
1076 | ||
0c7efc08 | 1077 | @item In @code{eshell-eval-using-options}, allow a @code{:complete} tag |
4009494e GM |
1078 | |
1079 | It would be used to provide completion rules for that command. Then the | |
1080 | macro will automagically define the completion function. | |
1081 | ||
1082 | @item For @code{eshell-command-on-region}, apply redirections to the result | |
1083 | ||
1084 | So that @samp{+ > 'blah} would cause the result of the @code{+} (using | |
1085 | input from the current region) to be inserting into the symbol | |
1086 | @code{blah}. | |
1087 | ||
1088 | If an external command is being invoked, the input is sent as standard | |
1089 | input, as if a @samp{cat <region> |} had been invoked. | |
1090 | ||
1091 | If a Lisp command, or an alias, is invoked, then if the line has no | |
1092 | newline characters, it is divided by whitespace and passed as arguments | |
1093 | to the Lisp function. Otherwise, it is divided at the newline | |
1094 | characters. Thus, invoking @code{+} on a series of numbers will add | |
1095 | them; @code{min} would display the smallest figure, etc. | |
1096 | ||
1097 | @item Write @code{eshell-script-mode} as a minor mode | |
1098 | ||
1099 | It would provide syntax, abbrev, highlighting and indenting support like | |
1100 | @code{emacs-lisp-mode} and @code{shell-mode}. | |
1101 | ||
c7205e53 | 1102 | @item In the history mechanism, finish the Bash-style support |
4009494e GM |
1103 | |
1104 | This means @samp{!n}, @samp{!#}, @samp{!:%}, and @samp{!:1-} as separate | |
1105 | from @samp{!:1*}. | |
1106 | ||
1107 | @item Support the -n command line option for @command{history} | |
1108 | ||
1109 | @item Implement @command{fc} in Lisp | |
1110 | ||
1111 | @item Specifying a frame as a redirection target should imply the currently active window's buffer | |
1112 | ||
1113 | @item Implement @samp{>@var{func-or-func-list}} | |
1114 | ||
1115 | This would allow for an ``output translators'', that take a function to | |
1116 | modify output with, and a target. Devise a syntax that works well with | |
1117 | pipes, and can accommodate multiple functions (i.e., @samp{>'(upcase | |
1118 | regexp-quote)} or @samp{>'upcase}). | |
1119 | ||
1120 | @item Allow Eshell to read/write to/from standard input and output | |
1121 | ||
1122 | This would be optional, rather than always using the Eshell buffer. | |
1123 | This would allow it to be run from the command line (perhaps). | |
1124 | ||
1125 | @item Write a @command{help} command | |
1126 | ||
1127 | It would call subcommands with @option{--help}, or @option{-h} or | |
1128 | @option{/?}, as appropriate. | |
1129 | ||
1130 | @item Implement @command{stty} in Lisp | |
1131 | ||
1df7defd | 1132 | @item Support @command{rc}'s matching operator, e.g., @samp{~ (@var{list}) @var{regexp}} |
4009494e GM |
1133 | |
1134 | @item Implement @command{bg} and @command{fg} as editors of @code{eshell-process-list} | |
1135 | ||
1136 | Using @command{bg} on a process that is already in the background does | |
1137 | nothing. Specifying redirection targets replaces (or adds) to the list | |
1138 | current being used. | |
1139 | ||
1140 | @item Have @command{jobs} print only the processes for the current shell | |
1141 | ||
1142 | @item How can Eshell learn if a background process has requested input? | |
1143 | ||
1144 | @item Support @samp{2>&1} and @samp{>&} and @samp{2>} and @samp{|&} | |
1145 | ||
1146 | The syntax table for parsing these should be customizable, such that the | |
1147 | user could change it to use rc syntax: @samp{>[2=1]}. | |
1148 | ||
1149 | @item Allow @samp{$_[-1]}, which would indicate the last element of the array | |
1150 | ||
1151 | @item Make @samp{$x[*]} equal to listing out the full contents of @samp{x} | |
1152 | ||
1153 | Return them as a list, so that @samp{$_[*]} is all the arguments of the | |
1154 | last command. | |
1155 | ||
1156 | @item Copy ANSI code handling from @file{term.el} into @file{em-term.el} | |
1157 | ||
1158 | Make it possible for the user to send char-by-char to the underlying | |
1159 | process. Ultimately, I should be able to move away from using term.el | |
1160 | altogether, since everything but the ANSI code handling is already part | |
1161 | of Eshell. Then, things would work correctly on MS-Windows as well | |
1162 | (which doesn't have @file{/bin/sh}, although @file{term.el} tries to use | |
1163 | it). | |
1164 | ||
1165 | @item Make the shell spawning commands be visual | |
1166 | ||
1167 | That is, make (@command{su}, @command{bash}, @command{telnet}, | |
65e7ca35 | 1168 | @command{rlogin}, @command{rsh}, etc.)@: be part of |
4009494e GM |
1169 | @code{eshell-visual-commands}. The only exception is if the shell is |
1170 | being used to invoke a single command. Then, the behavior should be | |
1171 | based on what that command is. | |
1172 | ||
1173 | @item Create a smart viewing command named @command{open} | |
1174 | ||
1175 | This would search for some way to open its argument (similar to opening | |
1176 | a file in the Windows Explorer). | |
1177 | ||
1178 | @item Alias @command{read} to be the same as @command{open}, only read-only | |
1179 | ||
1180 | @item Write a @command{tail} command which uses @code{view-file} | |
1181 | ||
1182 | It would move point to the end of the buffer, and then turns on | |
1183 | auto-revert mode in that buffer at frequent intervals---and a | |
1184 | @command{head} alias which assumes an upper limit of | |
1185 | @code{eshell-maximum-line-length} characters per line. | |
1186 | ||
1187 | @item Make @command{dgrep} load @code{dired}, mark everything, then invoke @code{dired-do-search} | |
1188 | ||
1189 | @item Write mesh.c | |
1190 | ||
1191 | This would run Emacs with the appropriate arguments to invoke Eshell | |
1192 | only. That way, it could be listed as a login shell. | |
1193 | ||
1194 | @item Use an intangible @code{PS2} string for multi-line input prompts | |
1195 | ||
1196 | @item Auto-detect when a command is visual, by checking @code{TERMCAP} usage | |
1197 | ||
1198 | @item The first keypress after @kbd{M-x watson} triggers `eshell-send-input' | |
1199 | ||
1200 | @item Make @kbd{/} electric | |
1201 | ||
1202 | So that it automatically expands and corrects pathnames. Or make | |
1203 | pathname completion for Pcomplete auto-expand @samp{/u/i/std<TAB>} to | |
1204 | @samp{/usr/include/std<TAB>}. | |
1205 | ||
1206 | @item Write the @command{pushd} stack to disk along with @code{last-dir-ring} | |
1207 | ||
1208 | @item Add options to @code{eshell/cat} which would allow it to sort and uniq | |
1209 | ||
1210 | @item Implement @command{wc} in Lisp | |
1211 | ||
1212 | Add support for counting sentences, paragraphs, pages, etc. | |
1213 | ||
1214 | @item Once piping is added, implement @command{sort} and @command{uniq} in Lisp | |
1215 | ||
1216 | @item Implement @command{touch} in Lisp | |
1217 | ||
1218 | @item Implement @command{comm} in Lisp | |
1219 | ||
1220 | @item Implement an @command{epatch} command in Lisp | |
1221 | ||
1222 | This would call @code{ediff-patch-file}, or @code{ediff-patch-buffer}, | |
1223 | depending on its argument. | |
1224 | ||
1225 | @item Have an option such that @samp{ls -l} generates a dired buffer | |
1226 | ||
1227 | @item Write a version of @command{xargs} based on command rewriting | |
1228 | ||
1229 | That is, @samp{find X | xargs Y} would be indicated using @samp{Y | |
1230 | $@{find X@}}. Maybe @code{eshell-do-pipelines} could be changed to | |
1231 | perform this on-thy-fly rewriting. | |
1232 | ||
1233 | @item Write an alias for @command{less} that brings up a @code{view-mode} buffer | |
1234 | ||
1235 | Such that the user can press @key{SPC} and @key{DEL}, and then @key{q} | |
1236 | to return to Eshell. It would be equivalent to: | |
1237 | @samp{X > #<buffer Y>; view-buffer #<buffer Y>}. | |
1238 | ||
1239 | @item Make @code{eshell-mode} as much a full citizen as @code{shell-mode} | |
1240 | ||
1241 | Everywhere in Emacs where @code{shell-mode} is specially noticed, add | |
1242 | @code{eshell-mode} there. | |
1243 | ||
1244 | @item Permit the umask to be selectively set on a @command{cp} target | |
1245 | ||
1246 | @item Problem using @kbd{M-x eshell} after using @code{eshell-command} | |
1247 | ||
1248 | If the first thing that I do after entering Emacs is to run | |
1249 | @code{eshell-command} and invoke @command{ls}, and then use @kbd{M-x | |
1250 | eshell}, it doesn't display anything. | |
1251 | ||
1252 | @item @kbd{M-RET} during a long command (using smart display) doesn't work | |
1253 | ||
1254 | Since it keeps the cursor up where the command was invoked. | |
1255 | ||
1256 | @end table | |
1257 | ||
1258 | @node GNU Free Documentation License | |
1259 | @appendix GNU Free Documentation License | |
1260 | @include doclicense.texi | |
1261 | ||
1262 | @node Concept Index | |
1263 | @unnumbered Concept Index | |
1264 | ||
1265 | @printindex cp | |
1266 | ||
1267 | @node Function and Variable Index | |
1268 | @unnumbered Function and Variable Index | |
1269 | ||
1270 | @printindex fn | |
1271 | ||
c7205e53 AG |
1272 | @node Command Index |
1273 | @unnumbered Command Index | |
1274 | ||
1275 | @printindex cm | |
1276 | ||
4009494e GM |
1277 | @node Key Index |
1278 | @unnumbered Key Index | |
1279 | ||
1280 | @printindex ky | |
1281 | @bye |