aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/misc/eshell.texi228
1 files changed, 134 insertions, 94 deletions
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 873d14aff32..c8a04bfa33f 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -79,15 +79,14 @@ similar to command shells such as @command{bash}, @command{zsh},
79* Commands:: 79* Commands::
80* Expansion:: 80* Expansion::
81* Input/Output:: 81* Input/Output::
82* Interaction::
82* Extension modules:: 83* Extension modules::
83* Bugs and ideas:: Known problems, and future ideas. 84* Bugs and ideas:: Known problems, and future ideas.
84* GNU Free Documentation License:: The license for this documentation. 85* GNU Free Documentation License:: The license for this documentation.
85* Concept Index:: 86* Concept Index::
86* Function and Variable Index:: 87* Function and Variable Index::
87* Command Index:: 88* Command Index::
88@ignore
89* Key Index:: 89* Key Index::
90@end ignore
91@end menu 90@end menu
92 91
93@node Introduction 92@node Introduction
@@ -208,8 +207,6 @@ that will be invoked, type this as the Eshell prompt:
208* Variables:: 207* Variables::
209* Aliases:: 208* Aliases::
210* Remote Access:: 209* Remote Access::
211* History::
212* Completion::
213* Control Flow:: 210* Control Flow::
214* Scripts:: 211* Scripts::
215@end menu 212@end menu
@@ -1556,92 +1553,6 @@ The GNU Emacs Manual}). To disable explicity-remote commands entirely,
1556you can set the option @code{eshell-explicit-remote-commands} to 1553you can set the option @code{eshell-explicit-remote-commands} to
1557@code{nil}. 1554@code{nil}.
1558 1555
1559@node History
1560@section History
1561@cmindex history
1562@vindex eshell-history-size
1563The @samp{history} command shows all commands kept in the history ring
1564as numbered list. If the history ring contains
1565@code{eshell-history-size} commands, those numbers change after every
1566command invocation, therefore the @samp{history} command shall be
1567applied before using the expansion mechanism with history numbers.
1568
1569The n-th entry of the history ring can be applied with the @samp{!n}
1570command. If @code{n} is negative, the entry is counted from the end
1571of the history ring.
1572
1573@cindex event designators
1574@findex eshell-expand-history-references
1575When history event designators are enabled (by adding
1576@code{eshell-expand-history-references} to
1577@code{eshell-expand-input-functions}), @samp{!foo} expands to the last
1578command beginning with @code{foo}, and @samp{!?foo} to the last
1579command containing @code{foo}. The n-th argument of the last command
1580beginning with @code{foo} is accessible by @code{!foo:n}.
1581
1582@vindex eshell-history-file-name
1583@vindex eshell-history-append
1584The history is loaded to the history ring from the file
1585@code{eshell-history-file-name} at the start of every session, and
1586saved to that file at the end of every session. The default history
1587saving behavior is to overwrite the history file with the whole
1588history ring of the session. If @code{eshell-history-append} is
1589non-@code{nil}, the history will instead be saved by appending new
1590entries from the session to the history file, which could prevent
1591potential history loss with multiple Eshell sessions. Unlike other
1592shells, such as Bash, Eshell cannot currently be configured to control
1593the size of the history file. In particular, when
1594@code{eshell-history-append} is non-@code{nil}, the size of the file
1595will keep increasing, and the recommended way to truncate the file is
1596to run the @samp{history -w} command in an Eshell session.
1597
1598Since the default buffer navigation and searching key-bindings are
1599still present in the Eshell buffer, the commands for history
1600navigation and searching are bound to different keys:
1601
1602@table @kbd
1603@item M-r
1604@itemx M-s
1605History I-search.
1606
1607@item M-p
1608@itemx M-n
1609Previous and next history line. If there is anything on the input
1610line when you run these commands, they will instead jump to the
1611previous or next line that begins with that string.
1612@end table
1613
1614@node Completion
1615@section Completion
1616Eshell uses the pcomplete package for programmable completion, similar
1617to that of other command shells. Argument completion differs depending
1618on the preceding command: for example, possible completions for
1619@command{rmdir} are only directories, while @command{rm} completions can
1620be directories @emph{and} files. Eshell provides predefined completions
1621for the built-in functions and some common external commands, and you
1622can define your own for any command.
1623
1624Eshell completion also works for Lisp forms and glob patterns. If the
1625point is on a Lisp form, then @key{TAB} will behave similarly to
1626completion in @code{elisp-mode} and @code{lisp-interaction-mode}. For
1627glob patterns, the pattern will be removed from the input line, and
1628replaced by the completion.
1629
1630If you want to see the entire list of possible completions (e.g. when it's
1631below the @code{completion-cycle-threshold}), press @kbd{M-?}.
1632
1633@subsection pcomplete
1634Pcomplete, short for programmable completion, is the completion
1635library originally written for Eshell, but usable for command
1636completion@footnote{Command completion, as opposed to code completion,
1637which is beyond the scope of pcomplete.} in other modes.
1638
1639Completions are defined as functions (with @code{defun}) named
1640@code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the
1641command for which this function provides completions; you can also name
1642the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions
1643for a specific major mode.
1644
1645@node Control Flow 1556@node Control Flow
1646@section Control Flow 1557@section Control Flow
1647Because Eshell commands can not (easily) be combined with Lisp forms, 1558Because Eshell commands can not (easily) be combined with Lisp forms,
@@ -2486,6 +2397,135 @@ at the end of the command are excluded. This allows input like this:
2486 sh -c "foo | baz" >#<buffer quux> 2397 sh -c "foo | baz" >#<buffer quux>
2487@end example 2398@end example
2488 2399
2400@node Interaction
2401@chapter Interaction
2402
2403As an interactive shell, Eshell contains many features for helping to
2404interact with your command environment. In addition, since Eshell is a
2405part of Emacs, all of the usual Emacs commands work within Eshell as
2406well.
2407
2408@menu
2409* Navigation::
2410* Completion::
2411* History::
2412@end menu
2413
2414@node Navigation
2415@section Navigation
2416
2417@table @kbd
2418
2419@kindex C-c C-n
2420@kindex C-c C-p
2421@item C-c C-n
2422@itemx C-c C-p
2423Move point to the beginning of the input for the next or previous
2424prompt. With a prefix argument, move to the n-th next or previous
2425prompt.
2426
2427@kindex C-c C-r
2428@kindex C-M-l
2429@item C-c C-r
2430@itemx C-M-l
2431Move point to the start of the previous command's output and display it
2432at the top of the window. With a prefix argument, this also narrows the
2433region to the last command's output.
2434
2435@end table
2436
2437@node Completion
2438@section Completion
2439Eshell uses the pcomplete package for programmable completion, similar
2440to that of other command shells. Argument completion differs depending
2441on the preceding command: for example, possible completions for
2442@command{rmdir} are only directories, while @command{rm} completions can
2443be directories @emph{and} files. Eshell provides predefined completions
2444for the built-in functions and some common external commands, and you
2445can define your own for any command.
2446
2447@kindex TAB
2448Eshell completion also works for Lisp forms and glob patterns. If the
2449point is on a Lisp form, then @key{TAB} will behave similarly to
2450completion in @code{elisp-mode} and @code{lisp-interaction-mode}. For
2451glob patterns, the pattern will be removed from the input line, and
2452replaced by the completion.
2453
2454@kindex M-?
2455If you want to see the entire list of possible completions (e.g. when it's
2456below the @code{completion-cycle-threshold}), press @kbd{M-?}.
2457
2458@subsection pcomplete
2459Pcomplete, short for programmable completion, is the completion
2460library originally written for Eshell, but usable for command
2461completion@footnote{Command completion, as opposed to code completion,
2462which is beyond the scope of pcomplete.} in other modes.
2463
2464Completions are defined as functions (with @code{defun}) named
2465@code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the
2466command for which this function provides completions; you can also name
2467the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions
2468for a specific major mode.
2469
2470@node History
2471@section History
2472@cmindex history
2473@vindex eshell-history-size
2474The @samp{history} command shows all commands kept in the history ring
2475as numbered list. If the history ring contains
2476@code{eshell-history-size} commands, those numbers change after every
2477command invocation, therefore the @samp{history} command shall be
2478applied before using the expansion mechanism with history numbers.
2479
2480The n-th entry of the history ring can be applied with the @samp{!n}
2481command. If @code{n} is negative, the entry is counted from the end
2482of the history ring.
2483
2484@cindex event designators
2485@findex eshell-expand-history-references
2486When history event designators are enabled (by adding
2487@code{eshell-expand-history-references} to
2488@code{eshell-expand-input-functions}), @samp{!foo} expands to the last
2489command beginning with @code{foo}, and @samp{!?foo} to the last
2490command containing @code{foo}. The n-th argument of the last command
2491beginning with @code{foo} is accessible by @code{!foo:n}.
2492
2493@vindex eshell-history-file-name
2494@vindex eshell-history-append
2495The history is loaded to the history ring from the file
2496@code{eshell-history-file-name} at the start of every session, and
2497saved to that file at the end of every session. The default history
2498saving behavior is to overwrite the history file with the whole
2499history ring of the session. If @code{eshell-history-append} is
2500non-@code{nil}, the history will instead be saved by appending new
2501entries from the session to the history file, which could prevent
2502potential history loss with multiple Eshell sessions. Unlike other
2503shells, such as Bash, Eshell cannot currently be configured to control
2504the size of the history file. In particular, when
2505@code{eshell-history-append} is non-@code{nil}, the size of the file
2506will keep increasing, and the recommended way to truncate the file is
2507to run the @samp{history -w} command in an Eshell session.
2508
2509Since the default buffer navigation and searching key-bindings are
2510still present in the Eshell buffer, the commands for history
2511navigation and searching are bound to different keys:
2512
2513@table @kbd
2514@kindex M-r
2515@kindex M-s
2516@item M-r
2517@itemx M-s
2518History I-search.
2519
2520@kindex M-p
2521@kindex M-n
2522@item M-p
2523@itemx M-n
2524Previous and next history line. If there is anything on the input
2525line when you run these commands, they will instead jump to the
2526previous or next line that begins with that string.
2527@end table
2528
2489@node Extension modules 2529@node Extension modules
2490@chapter Extension modules 2530@chapter Extension modules
2491Eshell provides a facility for defining extension modules so that they 2531Eshell provides a facility for defining extension modules so that they
@@ -2524,6 +2564,10 @@ mimic the bindings used in other shells when the user is editing new
2524input text. To enable this module, add @code{eshell-rebind} to 2564input text. To enable this module, add @code{eshell-rebind} to
2525@code{eshell-modules-list}. 2565@code{eshell-modules-list}.
2526 2566
2567@kindex C-u
2568@kindex C-w
2569@kindex C-p
2570@kindex C-n
2527For example, it binds @kbd{C-u} to kill the current input text and 2571For example, it binds @kbd{C-u} to kill the current input text and
2528@kbd{C-w} to @code{backward-kill-word}. If the history module is 2572@kbd{C-w} to @code{backward-kill-word}. If the history module is
2529enabled, it also binds @kbd{C-p} and @kbd{C-n} to move through the 2573enabled, it also binds @kbd{C-p} and @kbd{C-n} to move through the
@@ -3174,13 +3218,9 @@ Since it keeps the cursor up where the command was invoked.
3174 3218
3175@printindex cm 3219@printindex cm
3176 3220
3177@c There are no @kindex entries in this manual; avoid generating an
3178@c empty menu.
3179@ignore
3180@node Key Index 3221@node Key Index
3181@unnumbered Key Index 3222@unnumbered Key Index
3182 3223
3183@printindex ky 3224@printindex ky
3184@end ignore
3185 3225
3186@bye 3226@bye