diff options
| author | Jim Porter | 2024-05-31 09:36:03 -0700 |
|---|---|---|
| committer | Jim Porter | 2024-06-03 20:13:40 -0700 |
| commit | 991600a82c7678fa15301e609f259cf3ec184089 (patch) | |
| tree | 884f8d2fd895737aa0af69f4601eed24a5d2a8b9 | |
| parent | 2a699edbe5e1ab39d97b30e8d783763adc0acf9c (diff) | |
| download | emacs-991600a82c7678fa15301e609f259cf3ec184089.tar.gz emacs-991600a82c7678fa15301e609f259cf3ec184089.zip | |
Add an "Interaction" chapter to the Eshell manual
* doc/misc/eshell.texi (Interaction): New chapter.
(Completion, History): Move into "Interaction" and add key indexing.
(Key rebinding): Add key indexing.
(Command Index): Add this index.
| -rw-r--r-- | doc/misc/eshell.texi | 228 |
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, | |||
| 1556 | you can set the option @code{eshell-explicit-remote-commands} to | 1553 | you 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 | ||
| 1563 | The @samp{history} command shows all commands kept in the history ring | ||
| 1564 | as numbered list. If the history ring contains | ||
| 1565 | @code{eshell-history-size} commands, those numbers change after every | ||
| 1566 | command invocation, therefore the @samp{history} command shall be | ||
| 1567 | applied before using the expansion mechanism with history numbers. | ||
| 1568 | |||
| 1569 | The n-th entry of the history ring can be applied with the @samp{!n} | ||
| 1570 | command. If @code{n} is negative, the entry is counted from the end | ||
| 1571 | of the history ring. | ||
| 1572 | |||
| 1573 | @cindex event designators | ||
| 1574 | @findex eshell-expand-history-references | ||
| 1575 | When 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 | ||
| 1578 | command beginning with @code{foo}, and @samp{!?foo} to the last | ||
| 1579 | command containing @code{foo}. The n-th argument of the last command | ||
| 1580 | beginning with @code{foo} is accessible by @code{!foo:n}. | ||
| 1581 | |||
| 1582 | @vindex eshell-history-file-name | ||
| 1583 | @vindex eshell-history-append | ||
| 1584 | The history is loaded to the history ring from the file | ||
| 1585 | @code{eshell-history-file-name} at the start of every session, and | ||
| 1586 | saved to that file at the end of every session. The default history | ||
| 1587 | saving behavior is to overwrite the history file with the whole | ||
| 1588 | history ring of the session. If @code{eshell-history-append} is | ||
| 1589 | non-@code{nil}, the history will instead be saved by appending new | ||
| 1590 | entries from the session to the history file, which could prevent | ||
| 1591 | potential history loss with multiple Eshell sessions. Unlike other | ||
| 1592 | shells, such as Bash, Eshell cannot currently be configured to control | ||
| 1593 | the size of the history file. In particular, when | ||
| 1594 | @code{eshell-history-append} is non-@code{nil}, the size of the file | ||
| 1595 | will keep increasing, and the recommended way to truncate the file is | ||
| 1596 | to run the @samp{history -w} command in an Eshell session. | ||
| 1597 | |||
| 1598 | Since the default buffer navigation and searching key-bindings are | ||
| 1599 | still present in the Eshell buffer, the commands for history | ||
| 1600 | navigation and searching are bound to different keys: | ||
| 1601 | |||
| 1602 | @table @kbd | ||
| 1603 | @item M-r | ||
| 1604 | @itemx M-s | ||
| 1605 | History I-search. | ||
| 1606 | |||
| 1607 | @item M-p | ||
| 1608 | @itemx M-n | ||
| 1609 | Previous and next history line. If there is anything on the input | ||
| 1610 | line when you run these commands, they will instead jump to the | ||
| 1611 | previous or next line that begins with that string. | ||
| 1612 | @end table | ||
| 1613 | |||
| 1614 | @node Completion | ||
| 1615 | @section Completion | ||
| 1616 | Eshell uses the pcomplete package for programmable completion, similar | ||
| 1617 | to that of other command shells. Argument completion differs depending | ||
| 1618 | on the preceding command: for example, possible completions for | ||
| 1619 | @command{rmdir} are only directories, while @command{rm} completions can | ||
| 1620 | be directories @emph{and} files. Eshell provides predefined completions | ||
| 1621 | for the built-in functions and some common external commands, and you | ||
| 1622 | can define your own for any command. | ||
| 1623 | |||
| 1624 | Eshell completion also works for Lisp forms and glob patterns. If the | ||
| 1625 | point is on a Lisp form, then @key{TAB} will behave similarly to | ||
| 1626 | completion in @code{elisp-mode} and @code{lisp-interaction-mode}. For | ||
| 1627 | glob patterns, the pattern will be removed from the input line, and | ||
| 1628 | replaced by the completion. | ||
| 1629 | |||
| 1630 | If you want to see the entire list of possible completions (e.g. when it's | ||
| 1631 | below the @code{completion-cycle-threshold}), press @kbd{M-?}. | ||
| 1632 | |||
| 1633 | @subsection pcomplete | ||
| 1634 | Pcomplete, short for programmable completion, is the completion | ||
| 1635 | library originally written for Eshell, but usable for command | ||
| 1636 | completion@footnote{Command completion, as opposed to code completion, | ||
| 1637 | which is beyond the scope of pcomplete.} in other modes. | ||
| 1638 | |||
| 1639 | Completions are defined as functions (with @code{defun}) named | ||
| 1640 | @code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the | ||
| 1641 | command for which this function provides completions; you can also name | ||
| 1642 | the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions | ||
| 1643 | for a specific major mode. | ||
| 1644 | |||
| 1645 | @node Control Flow | 1556 | @node Control Flow |
| 1646 | @section Control Flow | 1557 | @section Control Flow |
| 1647 | Because Eshell commands can not (easily) be combined with Lisp forms, | 1558 | Because 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 | |||
| 2403 | As an interactive shell, Eshell contains many features for helping to | ||
| 2404 | interact with your command environment. In addition, since Eshell is a | ||
| 2405 | part of Emacs, all of the usual Emacs commands work within Eshell as | ||
| 2406 | well. | ||
| 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 | ||
| 2423 | Move point to the beginning of the input for the next or previous | ||
| 2424 | prompt. With a prefix argument, move to the n-th next or previous | ||
| 2425 | prompt. | ||
| 2426 | |||
| 2427 | @kindex C-c C-r | ||
| 2428 | @kindex C-M-l | ||
| 2429 | @item C-c C-r | ||
| 2430 | @itemx C-M-l | ||
| 2431 | Move point to the start of the previous command's output and display it | ||
| 2432 | at the top of the window. With a prefix argument, this also narrows the | ||
| 2433 | region to the last command's output. | ||
| 2434 | |||
| 2435 | @end table | ||
| 2436 | |||
| 2437 | @node Completion | ||
| 2438 | @section Completion | ||
| 2439 | Eshell uses the pcomplete package for programmable completion, similar | ||
| 2440 | to that of other command shells. Argument completion differs depending | ||
| 2441 | on the preceding command: for example, possible completions for | ||
| 2442 | @command{rmdir} are only directories, while @command{rm} completions can | ||
| 2443 | be directories @emph{and} files. Eshell provides predefined completions | ||
| 2444 | for the built-in functions and some common external commands, and you | ||
| 2445 | can define your own for any command. | ||
| 2446 | |||
| 2447 | @kindex TAB | ||
| 2448 | Eshell completion also works for Lisp forms and glob patterns. If the | ||
| 2449 | point is on a Lisp form, then @key{TAB} will behave similarly to | ||
| 2450 | completion in @code{elisp-mode} and @code{lisp-interaction-mode}. For | ||
| 2451 | glob patterns, the pattern will be removed from the input line, and | ||
| 2452 | replaced by the completion. | ||
| 2453 | |||
| 2454 | @kindex M-? | ||
| 2455 | If you want to see the entire list of possible completions (e.g. when it's | ||
| 2456 | below the @code{completion-cycle-threshold}), press @kbd{M-?}. | ||
| 2457 | |||
| 2458 | @subsection pcomplete | ||
| 2459 | Pcomplete, short for programmable completion, is the completion | ||
| 2460 | library originally written for Eshell, but usable for command | ||
| 2461 | completion@footnote{Command completion, as opposed to code completion, | ||
| 2462 | which is beyond the scope of pcomplete.} in other modes. | ||
| 2463 | |||
| 2464 | Completions are defined as functions (with @code{defun}) named | ||
| 2465 | @code{pcomplete/COMMAND}, where @code{COMMAND} is the name of the | ||
| 2466 | command for which this function provides completions; you can also name | ||
| 2467 | the function @code{pcomplete/MAJOR-MODE/COMMAND} to define completions | ||
| 2468 | for a specific major mode. | ||
| 2469 | |||
| 2470 | @node History | ||
| 2471 | @section History | ||
| 2472 | @cmindex history | ||
| 2473 | @vindex eshell-history-size | ||
| 2474 | The @samp{history} command shows all commands kept in the history ring | ||
| 2475 | as numbered list. If the history ring contains | ||
| 2476 | @code{eshell-history-size} commands, those numbers change after every | ||
| 2477 | command invocation, therefore the @samp{history} command shall be | ||
| 2478 | applied before using the expansion mechanism with history numbers. | ||
| 2479 | |||
| 2480 | The n-th entry of the history ring can be applied with the @samp{!n} | ||
| 2481 | command. If @code{n} is negative, the entry is counted from the end | ||
| 2482 | of the history ring. | ||
| 2483 | |||
| 2484 | @cindex event designators | ||
| 2485 | @findex eshell-expand-history-references | ||
| 2486 | When 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 | ||
| 2489 | command beginning with @code{foo}, and @samp{!?foo} to the last | ||
| 2490 | command containing @code{foo}. The n-th argument of the last command | ||
| 2491 | beginning with @code{foo} is accessible by @code{!foo:n}. | ||
| 2492 | |||
| 2493 | @vindex eshell-history-file-name | ||
| 2494 | @vindex eshell-history-append | ||
| 2495 | The history is loaded to the history ring from the file | ||
| 2496 | @code{eshell-history-file-name} at the start of every session, and | ||
| 2497 | saved to that file at the end of every session. The default history | ||
| 2498 | saving behavior is to overwrite the history file with the whole | ||
| 2499 | history ring of the session. If @code{eshell-history-append} is | ||
| 2500 | non-@code{nil}, the history will instead be saved by appending new | ||
| 2501 | entries from the session to the history file, which could prevent | ||
| 2502 | potential history loss with multiple Eshell sessions. Unlike other | ||
| 2503 | shells, such as Bash, Eshell cannot currently be configured to control | ||
| 2504 | the size of the history file. In particular, when | ||
| 2505 | @code{eshell-history-append} is non-@code{nil}, the size of the file | ||
| 2506 | will keep increasing, and the recommended way to truncate the file is | ||
| 2507 | to run the @samp{history -w} command in an Eshell session. | ||
| 2508 | |||
| 2509 | Since the default buffer navigation and searching key-bindings are | ||
| 2510 | still present in the Eshell buffer, the commands for history | ||
| 2511 | navigation 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 | ||
| 2518 | History I-search. | ||
| 2519 | |||
| 2520 | @kindex M-p | ||
| 2521 | @kindex M-n | ||
| 2522 | @item M-p | ||
| 2523 | @itemx M-n | ||
| 2524 | Previous and next history line. If there is anything on the input | ||
| 2525 | line when you run these commands, they will instead jump to the | ||
| 2526 | previous 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 |
| 2491 | Eshell provides a facility for defining extension modules so that they | 2531 | Eshell 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 | |||
| 2524 | input text. To enable this module, add @code{eshell-rebind} to | 2564 | input 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 | ||
| 2527 | For example, it binds @kbd{C-u} to kill the current input text and | 2571 | For 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 |
| 2529 | enabled, it also binds @kbd{C-p} and @kbd{C-n} to move through the | 2573 | enabled, 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 |