Merge from emacs-23 branch, up to 2010-05-20T22:16:19Z!juri@jurta.org.
[bpt/emacs.git] / doc / misc / eshell.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename ../../info/eshell
4 @settitle Eshell: The Emacs Shell
5 @synindex vr fn
6 @c %**end of header
7
8 @copying
9 This manual is for Eshell, the Emacs shell.
10
11 Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
12 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
13
14 @quotation
15 Permission is granted to copy, distribute and/or modify this document
16 under the terms of the GNU Free Documentation License, Version 1.3 or
17 any later version published by the Free Software Foundation; with no
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''.
21
22 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
23 modify this GNU manual. Buying copies from the FSF supports it in
24 developing GNU and promoting software freedom.''
25 @end quotation
26 @end copying
27
28 @dircategory Emacs
29 @direntry
30 * Eshell: (eshell). A command shell implemented in Emacs Lisp.
31 @end direntry
32
33 @titlepage
34 @sp 4
35 @c The title is printed in a large font.
36 @center @titlefont{User's Guide}
37 @sp
38 @center @titlefont{to}
39 @sp
40 @center @titlefont{Eshell: The Emacs Shell}
41 @ignore
42 @sp 2
43 @center release 2.4
44 @c -release-
45 @end ignore
46 @sp 3
47 @center John Wiegley
48 @c -date-
49
50 @page
51 @vskip 0pt plus 1filll
52 @insertcopying
53 @end titlepage
54
55 @contents
56
57 @c ================================================================
58 @c The real text starts here
59 @c ================================================================
60
61 @ifnottex
62 @node Top, What is Eshell?, (dir), (dir)
63 @top Eshell
64
65 Eshell is a shell-like command interpretor
66 implemented in Emacs Lisp. It invokes no external processes except for
67 those requested by the user. It is intended to be a functional
68 replacement for command shells such as @command{bash}, @command{zsh},
69 @command{rc}, or @command{4dos}; since Emacs itself is capable of
70 handling the sort of tasks accomplished by those tools.
71 @c This manual is updated to release 2.4 of Eshell.
72
73 @insertcopying
74 @end ifnottex
75
76 @menu
77 * What is Eshell?:: A brief introduction to the Emacs Shell.
78 * Command basics:: The basics of command usage.
79 * Commands::
80 * Arguments::
81 * Input/Output::
82 * Process control::
83 * Extension modules::
84 * Extras and Goodies::
85 * Bugs and ideas:: Known problems, and future ideas.
86 * GNU Free Documentation License:: The license for this documentation.
87 * Concept Index::
88 * Function and Variable Index::
89 * Key Index::
90 @end menu
91
92 @node What is Eshell?
93 @chapter What is Eshell?
94 @cindex what is Eshell?
95 @cindex Eshell, what it is
96
97 Eshell is a @dfn{command shell} written in Emacs Lisp. Everything it
98 does, it uses Emacs' facilities to do. This means that Eshell is as
99 portable as Emacs itself. It also means that cooperation with Lisp code
100 is natural and seamless.
101
102 What is a command shell? To properly understand the role of a shell,
103 it's necessary to visualize what a computer does for you. Basically, a
104 computer is a tool; in order to use that tool, you must tell it what to
105 do---or give it ``commands.'' These commands take many forms, such as
106 clicking with a mouse on certain parts of the screen. But that is only
107 one form of command input.
108
109 By far the most versatile way to express what you want the computer to
110 do is by using an abbreviated language called @dfn{script}. In
111 script, instead of telling the computer, ``list my files, please'',
112 one writes a standard abbreviated command word---@samp{ls}. Typing
113 @samp{ls} in a command shell is a script way of telling the computer
114 to list your files.@footnote{This is comparable to viewing the
115 contents of a folder using a graphical display.}
116
117 The real flexibility of this approach is apparent only when you realize
118 that there are many, many different ways to list files. Perhaps you
119 want them sorted by name, sorted by date, in reverse order, or grouped
120 by type. Most graphical browsers have simple ways to express this. But
121 what about showing only a few files, or only files that meet a certain
122 criteria? In very complex and specific situations, the request becomes
123 too difficult to express using a mouse or pointing device. It is just
124 these kinds of requests that are easily solved using a command shell.
125
126 For example, what if you want to list every Word file on your hard
127 drive, larger than 100 kilobytes in size, and which hasn't been looked
128 at in over six months? That is a good candidate list for deletion, when
129 you go to clean up your hard drive. But have you ever tried asking your
130 computer for such a list? There is no way to do it! At least, not
131 without using a command shell.
132
133 The role of a command shell is to give you more control over what your
134 computer does for you. Not everyone needs this amount of control, and
135 it does come at a cost: Learning the necessary script commands to
136 express what you want done. A complicated query, such as the example
137 above, takes time to learn. But if you find yourself using your
138 computer frequently enough, it is more than worthwhile in the long run.
139 Any tool you use often deserves the time spent learning to master it.
140 @footnote{For the understandably curious, here is what that command
141 looks like: But don't let it fool you; once you know what's going on,
142 it's easier than it looks: @code{ls -lt **/*.doc(Lk+50aM+5)}.}
143
144 @menu
145 * Contributors to Eshell:: People who have helped out!
146 @end menu
147
148 @node Contributors to Eshell
149 @section Contributors to Eshell
150 @cindex contributors
151 @cindex authors
152
153 Contributions to Eshell are welcome. I have limited time to work on
154 this project, but I will gladly add any code you contribute to me to
155 this package.
156
157 The following persons have made contributions to Eshell.
158
159 @itemize @bullet
160 @item
161 Eli Zaretskii made it possible for Eshell to run without requiring
162 asynchronous subprocess support. This is important for MS-DOS, which
163 does not have such support.@refill
164
165 @item
166 Miles Bader contributed many fixes during the port to Emacs 21.@refill
167
168 @item
169 Stefan Monnier fixed the things which bothered him, which of course made
170 things better for all.@refill
171
172 @item
173 Gerd Moellmann also helped to contribute bug fixes during the initial
174 integration with Emacs 21.@refill
175
176 @item
177 Alex Schroeder contributed code for interactively querying the user
178 before overwriting files.@refill
179
180 @item
181 Sudish Joseph helped with some XEmacs compatibility issues.@refill
182 @end itemize
183
184 Apart from these, a lot of people have sent suggestions, ideas,
185 requests, bug reports and encouragement. Thanks a lot! Without you
186 there would be no new releases of Eshell.
187
188 @node Command basics
189 @chapter Basic overview
190
191 A command shell is a means of entering verbally-formed commands. This
192 is really all that it does, and every feature described in this manual
193 is a means to that end. Therefore, it's important to take firm hold on
194 exactly what a command is, and how it fits in the overall picture of
195 things.
196
197 @menu
198 * Commands verbs:: Commands always begin with a verb.
199 * Command arguments:: Some verbs require arguments.
200 @end menu
201
202 @node Commands verbs
203 @section Commands verbs
204
205 Commands are expressed using @dfn{script}, a special shorthand language
206 computers can understand with no trouble. Script is an extremely simple
207 language; oddly enough, this is what makes it look so complicated!
208 Whereas normal languages use a variety of embellishments, the form of a
209 script command is always:
210
211 @example
212 @var{verb} [@var{arguments}]
213 @end example
214
215 The verb expresses what you want your computer to do. There are a fixed
216 number of verbs, although this number is usually quite large. On the
217 author's computer, it reaches almost 1400 in number. But of course,
218 only a handful of these are really necessary.
219
220 Sometimes, the verb is all that's written. A verb is always a single
221 word, usually related to the task it performs. @command{reboot} is a
222 good example. Entering that on GNU/Linux will reboot the
223 computer---assuming you have sufficient privileges.
224
225 Other verbs require more information. These are usually very capable
226 verbs, and must be told specifically what to do. The extra information
227 is given in the form of @dfn{arguments}. For example, the
228 @command{echo} verb prints back whatever arguments you type. It
229 requires these arguments to know what to echo. A proper use of
230 @command{echo} looks like this:
231
232 @example
233 echo This is an example of using echo!
234 @end example
235
236 This script command causes the computer to echo back: ``This is an
237 example of using echo!''
238
239 Although command verbs are always simple words, like @command{reboot} or
240 @command{echo}, arguments may have a wide variety of forms. There are
241 textual arguments, numerical arguments---even Lisp arguments.
242 Distinguishing these different types of arguments requires special
243 typing, for the computer to know exactly what you mean.
244
245 @node Command arguments
246 @section Command arguments
247
248 Eshell recognizes several different kinds of command arguments:
249
250 @enumerate
251 @item Strings (also called textual arguments)
252 @item Numbers (floating point or integer)
253 @item Lisp lists
254 @item Lisp symbols
255 @item Emacs buffers
256 @item Emacs process handles
257 @end enumerate
258
259 Most users need to worry only about the first two. The third, Lisp lists,
260 occur very frequently, but almost always behind the scenes.
261
262 Strings are the most common type of argument, and consist of nearly any
263 character. Special characters---those used by Eshell
264 specifically---must be preceded by a backslash (@samp{\}). When in doubt, it
265 is safe to add backslashes anywhere and everywhere.
266
267 Here is a more complicated @command{echo} example:
268
269 @example
270 echo A\ Multi-word\ Argument\ With\ A\ \$\ dollar
271 @end example
272
273 Beyond this, things get a bit more complicated. While not beyond the
274 reach of someone wishing to learn, it is definitely beyond the scope of
275 this manual to present it all in a simplistic manner. Get comfortable
276 with Eshell as a basic command invocation tool, and learn more about the
277 commands on your system; then come back when it all sits more familiarly
278 on your mind. Have fun!
279
280 @node Commands
281 @chapter Commands
282
283 @menu
284 * Invocation::
285 * Completion::
286 * Aliases::
287 * History::
288 * Scripts::
289 * Built-ins::
290 @end menu
291
292 Essentially, a command shell is all about invoking commands---and
293 everything that entails. So understanding how Eshell invokes commands
294 is the key to comprehending how it all works.
295
296 @node Invocation
297 @section Invocation
298
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
302 command you specify into a callable Lisp form.@footnote{To see the Lisp
303 form that will be invoked, type: @samp{eshell-parse-command "echo
304 hello"}}
305
306 This transformation, from the string of text typed at the command
307 prompt, to the ultimate invocation of either a Lisp function or external
308 command, follows these steps:
309
310 @enumerate
311 @item Parse the command string into separate arguments.
312 @item
313 @end enumerate
314
315 @node Completion
316 @section Completion
317
318 @node Aliases
319 @section Aliases
320
321 @node History
322 @section History
323
324 Eshell knows a few built-in variables:
325
326 @table @code
327
328 @item $+
329 @vindex $+
330 This variable always contains the current working directory.
331
332 @item $-
333 @vindex $-
334 This variable always contains the previous working directory (the
335 current working directory from before the last @code{cd} command).
336
337 @item $_
338 @vindex $_
339 It refers to the last argument of the last command.
340
341 @item $$
342 @vindex $$
343 This is the result of the last command. In case of an external
344 command, it is @code{t} or @code{nil}.
345
346 @item $?
347 @vindex $?
348 This variable contains the exit code of the last command (0 or 1 for
349 Lisp functions, based on successful completion).
350
351 @end table
352
353 @node Scripts
354 @section Scripts
355
356
357 @node Built-ins
358 @section Built-in commands
359
360 Several commands are built-in in Eshell. In order to call the
361 external variant of a built-in command @code{foo}, you could call
362 @code{*foo}. Usually, this should not be necessary. You can check
363 what will be applied by the @code{which} command:
364
365 @example
366 ~ $ which ls
367 eshell/ls is a compiled Lisp function in `em-ls.el'
368 ~ $ which *ls
369 /bin/ls
370 @end example
371
372 If you want to discard a given built-in command, you could declare an
373 alias, @ref{Aliases}. Eample:
374
375 @example
376 ~ $ which sudo
377 eshell/sudo is a compiled Lisp function in `em-unix.el'
378 ~ $ alias sudo '*sudo $*'
379 ~ $ which sudo
380 sudo is an alias, defined as "*sudo $*"
381 @end example
382
383 Some of the built-in commands have a special behaviour in Eshell:
384
385 @table @code
386
387 @item cd
388 @findex cd
389 This command changes the current working directory. Usually, it is
390 invoked as @samp{cd foo} where @file{foo} is the new working
391 directory. But @code{cd} knows about a few special arguments:
392
393 When it receives no argument at all, it changes to the home directory.
394
395 Giving the command @samp{cd -} changes back to the previous working
396 directory (this is the same as @samp{cd $-}).
397
398 The command @samp{cd =} shows the directory stack. Each line is
399 numbered.
400
401 With @samp{cd =foo}, Eshell searches the directory stack for a
402 directory matching the regular expression @samp{foo} and changes to
403 that directory.
404
405 With @samp{cd -42}, you can access the directory stack by number.
406
407 @item history
408 @findex history
409 The @samp{history} command shows all commands kept in the history ring
410 as numbered list. If the history ring contains
411 @code{eshell-history-size} commands, those numbers change after every
412 command invocation, therefore the @samp{history} command shall be
413 applied before using the expansion mechanism with history numbers.
414
415 The n-th entry of the history ring can be applied with the @samp{!n}
416 command. If @code{n} is negative, the entry is counted from the end
417 of the history ring.
418
419 @samp{!foo} expands to the last command beginning with @code{foo}, and
420 @samp{!?foo} to the last command containing @code{foo}. The n-th
421 argument of the last command beginning with @code{foo} is accessible
422 by @code{!foo:n}.
423
424 @item su
425 @findex su
426 @itemx sudo
427 @findex sudo
428 @code{su} and @code{sudo} work as expected: they apply the following
429 commands (@code{su}), or the command being an argument (@code{sudo})
430 under the permissions of somebody else.
431
432 This does not work only on
433 the local host, but even on a remote one, when
434 @code{default-directory} is a remote file name. The necessary
435 proxy configuration of Tramp is performed
436 @ifinfo
437 automatically, @ref{Multi-hops, , , tramp}.
438 @end ifinfo
439 @ifnotinfo
440 automatically.
441 @end ifnotinfo
442 Example:
443
444 @example
445 ~ $ cd /ssh:otherhost:/etc
446 /ssh:user@@otherhost:/etc $ sudo find-file shadow
447 @end example
448
449 @end table
450
451
452 @node Arguments
453 @chapter Arguments
454
455 @menu
456 * The Parser::
457 * Variables::
458 * Substitution::
459 * Globbing::
460 * Predicates::
461 @end menu
462
463 @node The Parser
464 @section The Parser
465
466 @node Variables
467 @section Variables
468
469 @node Substitution
470 @section Substitution
471
472 @node Globbing
473 @section Globbing
474
475 @node Predicates
476 @section Predicates
477
478
479 @node Input/Output
480 @chapter Input/Output
481
482 @node Process control
483 @chapter Process control
484
485
486 @node Extension modules
487 @chapter Extension modules
488
489 @menu
490 * Writing a module::
491 * Module testing::
492 * Directory handling::
493 * Key rebinding::
494 * Smart scrolling::
495 * Terminal emulation::
496 * Built-in UNIX commands::
497 @end menu
498
499 @node Writing a module
500 @section Writing a module
501
502 @node Module testing
503 @section Module testing
504
505 @node Directory handling
506 @section Directory handling
507
508 @node Key rebinding
509 @section Key rebinding
510
511 @node Smart scrolling
512 @section Smart scrolling
513
514 @node Terminal emulation
515 @section Terminal emulation
516
517 @node Built-in UNIX commands
518 @section Built-in UNIX commands
519
520
521 @node Extras and Goodies
522 @chapter Extras and Goodies
523
524 @node Bugs and ideas
525 @chapter Bugs and ideas
526 @cindex reporting bugs and ideas
527 @cindex bugs, how to report them
528 @cindex author, how to reach
529 @cindex email to the author
530 @cindex FAQ
531 @cindex problems, list of common
532
533 If you find a bug or misfeature, don't hesitate to let me know! Send
534 email to @email{johnw@@gnu.org}. Feature requests should also be sent
535 there. I prefer discussing one thing at a time. If you find several
536 unrelated bugs, please report them separately.
537
538 If you have ideas for improvements, or if you have written some
539 extensions to this package, I would like to hear from you. I hope you
540 find this package useful!
541
542 @menu
543 * Known problems::
544 @end menu
545
546 @node Known problems
547 @section Known problems
548 @cindex known bugs
549 @cindex bugs, known
550
551 Below is complete list of known problems with Eshell version 2.4.2,
552 which is the version included with Emacs 22.
553
554 @table @asis
555 @item Documentation incomplete
556
557 @item Differentiate between aliases and functions
558
559 Allow for a bash-compatible syntax, such as:
560
561 @example
562 alias arg=blah
563 function arg () @{ blah $* @}
564 @end example
565
566 @item @samp{for i in 1 2 3 @{ grep -q a b && *echo has it @} | wc -l} outputs result after prompt
567
568 In fact, piping to a process from a looping construct doesn't work in
569 general. If I change the call to @code{eshell-copy-handles} in
570 @code{eshell-rewrite-for-command} to use @code{eshell-protect}, it seems
571 to work, but the output occurs after the prompt is displayed. The whole
572 structured command thing is too complicated at present.
573
574 @item Error with @command{bc} in @code{eshell-test}
575
576 On some XEmacs system, the subprocess interaction test fails
577 inexplicably, although @command{bc} works fine at the command prompt.
578
579 @item Eshell does not delete @file{*Help*} buffers in XEmacs 21.1.8+
580
581 In XEmacs 21.1.8, the @file{*Help*} buffer has been renamed such that
582 multiple instances of the @file{*Help*} buffer can exist.
583
584 @item Pcomplete sometimes gets stuck
585
586 You press @key{TAB}, but no completions appear, even though the
587 directory has matching files. This behavior is rare.
588
589 @item @samp{grep python $<rpm -qa>} doesn't work, but using @samp{*grep} does
590
591 This happens because the @code{grep} Lisp function returns immediately,
592 and then the asynchronous @command{grep} process expects to examine the
593 temporary file, which has since been deleted.
594
595 @item Problem with C-r repeating text
596
597 If the text @emph{before point} reads "./run", and you type @kbd{C-r r u
598 n}, it will repeat the line for every character typed.
599
600 @item Backspace doesn't scroll back after continuing (in smart mode)
601
602 Hitting space during a process invocation, such as @command{make}, will
603 cause it to track the bottom of the output; but backspace no longer
604 scrolls back.
605
606 @item It's not possible to fully @code{unload-feature} Eshell
607
608 @item Menu support was removed, but never put back
609
610 @item Using C-p and C-n with rebind gets into a locked state
611
612 This happened a few times in Emacs 21, but has been unreproducible
613 since.
614
615 @item If an interactive process is currently running, @kbd{M-!} doesn't work
616
617 @item Use a timer instead of @code{sleep-for} when killing child processes
618
619 @item Piping to a Lisp function is not supported
620
621 Make it so that the Lisp command on the right of the pipe is repeatedly
622 called with the input strings as arguments. This will require changing
623 @code{eshell-do-pipeline} to handle non-process targets.
624
625 @item Input redirection is not supported
626
627 See the above entry.
628
629 @item Problem running @command{less} without arguments on Windows
630
631 The result in the Eshell buffer is:
632
633 @example
634 Spawning child process: invalid argument
635 @end example
636
637 Also a new @command{less} buffer was created with nothing in it@dots{}
638 (presumably this holds the output of @command{less}).
639
640 If @command{less.exe} is invoked from the Eshell command line, the
641 expected output is written to the buffer.
642
643 Note that this happens on NT-Emacs 20.6.1 on Windows 2000. The term.el
644 package and the supplied shell both use the @command{cmdproxy} program
645 for running shells.
646
647 @item Implement @samp{-r}, @samp{-n} and @samp{-s} switches for @command{cp}
648
649 @item Make @kbd{M-5 M-x eshell} switch to ``*eshell<5>*'', creating if need be
650
651 @item @samp{mv @var{dir} @var{file}.tar} does not remove directories
652
653 This is because the tar option --remove-files doesn't do so. Should it
654 be Eshell's job?
655
656 @item Bind @code{standard-output} and @code{standard-error}
657
658 This would be so that if a Lisp function calls @code{print}, everything
659 will happen as it should (albeit slowly).
660
661 @item When an extension module fails to load, @samp{cd /} gives a Lisp error
662
663 @item If a globbing pattern returns one match, should it be a list?
664
665 @item Make sure syntax table is correct in Eshell mode
666
667 So that @kbd{M-DEL} acts in a predictable manner, etc.
668
669 @item Allow all Eshell buffers to share the same history and list-dir
670
671 @item There is a problem with script commands that output to @file{/dev/null}
672
673 If a script file, somewhere in the middle, uses @samp{> /dev/null},
674 output from all subsequent commands is swallowed.
675
676 @item Split up parsing of text after @samp{$} in @file{esh-var.el}
677
678 Make it similar to the way that @file{esh-arg.el} is structured.
679 Then add parsing of @samp{$[?\n]}.
680
681 @item After pressing @kbd{M-RET}, redisplay before running the next command
682
683 @item Argument predicates and modifiers should work anywhere in a path
684
685 @example
686 /usr/local/src/editors/vim $ vi **/CVS(/)/Root(.)
687 Invalid regexp: "Unmatched ( or \\("
688 @end example
689
690 With @command{zsh}, the glob above expands to all files named
691 @file{Root} in directories named @file{CVS}.
692
693 @item Typing @samp{echo $@{locate locate@}/bin<TAB>} results in a Lisp error
694
695 Perhaps it should interpolate all permutations, and make that the
696 globbing result, since otherwise hitting return here will result in
697 ``(list of filenames)/bin'', which is never valuable. Thus, one could
698 @command{cat} only C backup files by using @samp{ls $@{identity *.c@}~}.
699 In that case, having an alias command name @command{glob} for
700 @command{identity} would be useful.
701
702 @item Once symbolic mode is supported for @command{umask}, implement @command{chmod} in Lisp
703
704 @item Create @code{eshell-expand-file-name}
705
706 This would use a data table to transform things such as @samp{~+},
707 @samp{...}, etc.
708
709 @item Abstract @file{em-smart.el} into @file{smart-scroll.el}
710
711 It only really needs: to be hooked onto the output filter and the
712 pre-command hook, and to have the input-end and input-start markers.
713 And to know whether the last output group was ``successful.''
714
715 @item Allow for fully persisting the state of Eshell
716
717 This would include: variables, history, buffer, input, dir stack, etc.
718
719 @item Implement D as an argument predicate
720
721 It means that files beginning with a dot should be included in the
722 glob match.
723
724 @item A comma in a predicate list should mean OR
725
726 At the moment, this is not supported.
727
728 @item Error if a glob doesn't expand due to a predicate
729
730 An error should be generated only if @code{eshell-error-if-no-glob} is
731 non-@code{nil}.
732
733 @item @samp{(+ RET SPC TAB} does not cause @code{indent-according-to-mode} to occur
734
735 @item Create @code{eshell-auto-accumulate-list}
736
737 This is a list of commands for which, if the user presses @kbd{RET}, the
738 text is staged as the next Eshell command, rather than being sent to the
739 current interactive process.
740
741 @item Display file and line number if an error occurs in a script
742
743 @item @command{wait} doesn't work with process ids at the moment
744
745 @item Enable the direct-to-process input code in @file{em-term.el}
746
747 @item Problem with repeating @samp{echo $@{find /tmp@}}
748
749 With smart display active, if @kbd{RET} is held down, after a while it
750 can't keep up anymore and starts outputting blank lines. It only
751 happens if an asynchronous process is involved@dots{}
752
753 I think the problem is that @code{eshell-send-input} is resetting the
754 input target location, so that if the asynchronous process is not done
755 by the time the next @kbd{RET} is received, the input processor thinks
756 that the input is meant for the process; which, when smart display is
757 enabled, will be the text of the last command line! That is a bug in
758 itself.
759
760 In holding down @kbd{RET} while an asynchronous process is running,
761 there will be a point in between termination of the process, and the
762 running of @code{eshell-post-command-hook}, which would cause
763 @code{eshell-send-input} to call @code{eshell-copy-old-input}, and then
764 process that text as a command to be run after the process. Perhaps
765 there should be a way of killing pending input between the death of the
766 process, and the @code{post-command-hook}.
767
768 @item Allow for a more aggressive smart display mode
769
770 Perhaps toggled by a command, that makes each output block a smart
771 display block.
772
773 @item Create more meta variables
774
775 @table @samp
776 @item $!
777 The reason for the failure of the last disk command, or the text of the
778 last Lisp error.
779
780 @item $=
781 A special associate array, which can take references of the form
782 @samp{$=[REGEXP]}. It indexes into the directory ring.
783 @end table
784
785 @item Eshell scripts can't execute in the background
786
787 @item Support zsh's ``Parameter Expansion'' syntax, i.e. @samp{$@{@var{name}:-@var{val}@}}
788
789 @item Write an @command{info} alias that can take arguments
790
791 So that the user can enter @samp{info chmod}, for example.
792
793 @item Create a mode @code{eshell-browse}
794
795 It would treat the Eshell buffer as a outline. Collapsing the outline
796 hides all of the output text. Collapsing again would show only the
797 first command run in each directory
798
799 @item Allow other revisions of a file to be referenced using @samp{file@{rev@}}
800
801 This would be expanded by @code{eshell-expand-file-name} (see above).
802
803 @item Print ``You have new mail'' when the ``Mail'' icon is turned on
804
805 @item Implement @kbd{M-|} for Eshell
806
807 @item Implement input redirection
808
809 If it's a Lisp function, input redirection implies @command{xargs} (in a
810 way@dots{}). If input redirection is added, also update the
811 @code{file-name-quote-list}, and the delimiter list.
812
813 @item Allow @samp{#<@var{word} @var{arg}>} as a generic syntax
814
815 With the handling of @emph{word} specified by an
816 @code{eshell-special-alist}.
817
818 @item In @code{eshell-veal-using-options}, allow a @code{:complete} tag
819
820 It would be used to provide completion rules for that command. Then the
821 macro will automagically define the completion function.
822
823 @item For @code{eshell-command-on-region}, apply redirections to the result
824
825 So that @samp{+ > 'blah} would cause the result of the @code{+} (using
826 input from the current region) to be inserting into the symbol
827 @code{blah}.
828
829 If an external command is being invoked, the input is sent as standard
830 input, as if a @samp{cat <region> |} had been invoked.
831
832 If a Lisp command, or an alias, is invoked, then if the line has no
833 newline characters, it is divided by whitespace and passed as arguments
834 to the Lisp function. Otherwise, it is divided at the newline
835 characters. Thus, invoking @code{+} on a series of numbers will add
836 them; @code{min} would display the smallest figure, etc.
837
838 @item Write @code{eshell-script-mode} as a minor mode
839
840 It would provide syntax, abbrev, highlighting and indenting support like
841 @code{emacs-lisp-mode} and @code{shell-mode}.
842
843 @item In the history mechanism, finish the @command{bash}-style support
844
845 This means @samp{!n}, @samp{!#}, @samp{!:%}, and @samp{!:1-} as separate
846 from @samp{!:1*}.
847
848 @item Support the -n command line option for @command{history}
849
850 @item Implement @command{fc} in Lisp
851
852 @item Specifying a frame as a redirection target should imply the currently active window's buffer
853
854 @item Implement @samp{>@var{func-or-func-list}}
855
856 This would allow for an ``output translators'', that take a function to
857 modify output with, and a target. Devise a syntax that works well with
858 pipes, and can accommodate multiple functions (i.e., @samp{>'(upcase
859 regexp-quote)} or @samp{>'upcase}).
860
861 @item Allow Eshell to read/write to/from standard input and output
862
863 This would be optional, rather than always using the Eshell buffer.
864 This would allow it to be run from the command line (perhaps).
865
866 @item Write a @command{help} command
867
868 It would call subcommands with @option{--help}, or @option{-h} or
869 @option{/?}, as appropriate.
870
871 @item Implement @command{stty} in Lisp
872
873 @item Support @command{rc}'s matching operator, e.g. @samp{~ (@var{list}) @var{regexp}}
874
875 @item Implement @command{bg} and @command{fg} as editors of @code{eshell-process-list}
876
877 Using @command{bg} on a process that is already in the background does
878 nothing. Specifying redirection targets replaces (or adds) to the list
879 current being used.
880
881 @item Have @command{jobs} print only the processes for the current shell
882
883 @item How can Eshell learn if a background process has requested input?
884
885 @item Support @samp{2>&1} and @samp{>&} and @samp{2>} and @samp{|&}
886
887 The syntax table for parsing these should be customizable, such that the
888 user could change it to use rc syntax: @samp{>[2=1]}.
889
890 @item Allow @samp{$_[-1]}, which would indicate the last element of the array
891
892 @item Make @samp{$x[*]} equal to listing out the full contents of @samp{x}
893
894 Return them as a list, so that @samp{$_[*]} is all the arguments of the
895 last command.
896
897 @item Copy ANSI code handling from @file{term.el} into @file{em-term.el}
898
899 Make it possible for the user to send char-by-char to the underlying
900 process. Ultimately, I should be able to move away from using term.el
901 altogether, since everything but the ANSI code handling is already part
902 of Eshell. Then, things would work correctly on MS-Windows as well
903 (which doesn't have @file{/bin/sh}, although @file{term.el} tries to use
904 it).
905
906 @item Make the shell spawning commands be visual
907
908 That is, make (@command{su}, @command{bash}, @command{telnet},
909 @command{rlogin}, @command{rsh}, etc.) be part of
910 @code{eshell-visual-commands}. The only exception is if the shell is
911 being used to invoke a single command. Then, the behavior should be
912 based on what that command is.
913
914 @item Create a smart viewing command named @command{open}
915
916 This would search for some way to open its argument (similar to opening
917 a file in the Windows Explorer).
918
919 @item Alias @command{read} to be the same as @command{open}, only read-only
920
921 @item Write a @command{tail} command which uses @code{view-file}
922
923 It would move point to the end of the buffer, and then turns on
924 auto-revert mode in that buffer at frequent intervals---and a
925 @command{head} alias which assumes an upper limit of
926 @code{eshell-maximum-line-length} characters per line.
927
928 @item Make @command{dgrep} load @code{dired}, mark everything, then invoke @code{dired-do-search}
929
930 @item Write mesh.c
931
932 This would run Emacs with the appropriate arguments to invoke Eshell
933 only. That way, it could be listed as a login shell.
934
935 @item Use an intangible @code{PS2} string for multi-line input prompts
936
937 @item Auto-detect when a command is visual, by checking @code{TERMCAP} usage
938
939 @item The first keypress after @kbd{M-x watson} triggers `eshell-send-input'
940
941 @item Make @kbd{/} electric
942
943 So that it automatically expands and corrects pathnames. Or make
944 pathname completion for Pcomplete auto-expand @samp{/u/i/std<TAB>} to
945 @samp{/usr/include/std<TAB>}.
946
947 @item Write the @command{pushd} stack to disk along with @code{last-dir-ring}
948
949 @item Add options to @code{eshell/cat} which would allow it to sort and uniq
950
951 @item Implement @command{wc} in Lisp
952
953 Add support for counting sentences, paragraphs, pages, etc.
954
955 @item Once piping is added, implement @command{sort} and @command{uniq} in Lisp
956
957 @item Implement @command{touch} in Lisp
958
959 @item Implement @command{comm} in Lisp
960
961 @item Implement an @command{epatch} command in Lisp
962
963 This would call @code{ediff-patch-file}, or @code{ediff-patch-buffer},
964 depending on its argument.
965
966 @item Have an option such that @samp{ls -l} generates a dired buffer
967
968 @item Write a version of @command{xargs} based on command rewriting
969
970 That is, @samp{find X | xargs Y} would be indicated using @samp{Y
971 $@{find X@}}. Maybe @code{eshell-do-pipelines} could be changed to
972 perform this on-thy-fly rewriting.
973
974 @item Write an alias for @command{less} that brings up a @code{view-mode} buffer
975
976 Such that the user can press @key{SPC} and @key{DEL}, and then @key{q}
977 to return to Eshell. It would be equivalent to:
978 @samp{X > #<buffer Y>; view-buffer #<buffer Y>}.
979
980 @item Make @code{eshell-mode} as much a full citizen as @code{shell-mode}
981
982 Everywhere in Emacs where @code{shell-mode} is specially noticed, add
983 @code{eshell-mode} there.
984
985 @item Permit the umask to be selectively set on a @command{cp} target
986
987 @item Problem using @kbd{M-x eshell} after using @code{eshell-command}
988
989 If the first thing that I do after entering Emacs is to run
990 @code{eshell-command} and invoke @command{ls}, and then use @kbd{M-x
991 eshell}, it doesn't display anything.
992
993 @item @kbd{M-RET} during a long command (using smart display) doesn't work
994
995 Since it keeps the cursor up where the command was invoked.
996
997 @end table
998
999 @node GNU Free Documentation License
1000 @appendix GNU Free Documentation License
1001 @include doclicense.texi
1002
1003 @node Concept Index
1004 @unnumbered Concept Index
1005
1006 @printindex cp
1007
1008 @node Function and Variable Index
1009 @unnumbered Function and Variable Index
1010
1011 @printindex fn
1012
1013 @node Key Index
1014 @unnumbered Key Index
1015
1016 @printindex ky
1017 @bye