diff options
| author | Stefan Kangas | 2023-01-19 06:30:25 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2023-01-19 06:30:25 +0100 |
| commit | 9161a302c9f9fbfa1a8f33181bb332d2c5df3aa7 (patch) | |
| tree | 21de62aa23f4ad770ff8afe322c0223ea7e0af76 /doc/misc | |
| parent | efb9ec11bbee3871d77dc4e9217bd9293d525d5d (diff) | |
| parent | db727873803a974ba210c4942ae7cbcc3d6268ab (diff) | |
| download | emacs-9161a302c9f9fbfa1a8f33181bb332d2c5df3aa7.tar.gz emacs-9161a302c9f9fbfa1a8f33181bb332d2c5df3aa7.zip | |
Merge from origin/emacs-29
db727873803 ruby-ts-mode: Use font-lock-constant-face for true/false/nil
819719330ad (ruby-ts--indent-rules): Add a rule for continuation of a...
94b9cbf96fb (ruby-ts--parent-call-or-bol): Handle more cases with nes...
ba33b83ce4b (ruby-ts--statement-container-regexp): Remove "parenthesi...
f2bedf695c1 ruby-ts-mode: Handle indent in parenless calls much close...
758ac5eabbe Fix split-window-below for the case when split-window-kee...
8e9783b4ce4 Rebind in read-regexp-map ‘M-c’ to ‘M-s c’ compatible wit...
78f93d92b28 * lisp/vc/vc-dir.el: Make keys ‘% m’ and ‘* %’ compatible...
dc3f85fd4b0 Use proper types for Eshell warnings
6a8338a8bc8 ; Avoid byte-compiler warning in cc-fonts.el.
9186be20aeb ; Clarify doc strings of some functions in files.el
bd5ef3ef95e Improve the documentation of 'auto-mode-alist' search
1798ff5a663 ; Fix minor mistakes in documentation
faee7e1f1bd ; * lisp/treesit.el (treesit-font-lock-fontify-region): M...
24f0dfd3731 Revert "Revert "Add c-or-c++-ts-mode (bug#59613)""
ac3bc775b6f Make it harder to misactivate tree-sitter font-lock fast ...
bdd82fa7977 ; * src/treesit.c: Remove unused boilerplate.
343b9b3dfe3 ruby-ts-mode: Obey the option ruby-method-call-indent
045404d1aac ruby-ts-mode: Obey the option ruby-after-operator-indent
300ca6ac372 ruby-ts-mode: Fix indent after operator or conditional
ac5516bd7d5 ruby-ts-mode: Fix/change indentation of a continuation me...
5e2e68a0c2d ruby-ts-mode: Fix indent inside parenthesized_expr and el...
9ed9ff4690a ruby-ts-mode: Fix the rules for hanging arrays and hashes
c4f0b6ccea1 Add more detail about how to invoke Eshell commands
dbac923b9df CC Mode: On removal of "typedef", remove pertinent types ...
56d69c2fc47 ; Relax timeouts for failing ERC test
183e7492702 Don't preserve non-module minor modes in erc-open
7b8322f6285 Use correct buffer for local-module vars in erc-open
7b13422298a ; Avoid plist-get as generalized var in erc-compat
09e9d7c7496 Fix display of warnings on w32 console
bd094207c76 Fix buffer-list-update-hook for indirect buffers
9e7a5d58eea ; Fix tree-sitter indent anchor preset
7c61a304104 Fix treesit-node-first-child-for-pos (bug#60127)
b36cc7e7bbb ; * src/treesit.c (Ftreesit_induce_sparse_tree): Minor ch...
# Conflicts:
# etc/NEWS
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/eshell.texi | 136 |
1 files changed, 100 insertions, 36 deletions
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index c40ff58f42c..57a2020fdca 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi | |||
| @@ -64,10 +64,11 @@ modify this GNU manual.'' | |||
| 64 | 64 | ||
| 65 | Eshell is a shell-like command interpreter implemented in Emacs Lisp. | 65 | Eshell is a shell-like command interpreter implemented in Emacs Lisp. |
| 66 | It invokes no external processes except for those requested by the | 66 | It invokes no external processes except for those requested by the |
| 67 | user. It is intended to be an alternative to the IELM (@pxref{Lisp Interaction, Emacs Lisp Interaction, , emacs, The Emacs Editor}) | 67 | user. It is intended to be an alternative to the IELM (@pxref{Lisp |
| 68 | REPL for Emacs @emph{and} with an interface similar to command shells | 68 | Interaction, Emacs Lisp Interaction, , emacs, The Emacs Editor}) |
| 69 | such as @command{bash}, @command{zsh}, @command{rc}, or | 69 | REPL@footnote{Short for ``Read-Eval-Print Loop''.} for Emacs |
| 70 | @command{4dos}. | 70 | @emph{and} with an interface similar to command shells such as |
| 71 | @command{bash}, @command{zsh}, @command{rc}, or @command{4dos}. | ||
| 71 | @c This manual is updated to release 2.4 of Eshell. | 72 | @c This manual is updated to release 2.4 of Eshell. |
| 72 | 73 | ||
| 73 | @insertcopying | 74 | @insertcopying |
| @@ -193,6 +194,13 @@ In a command shell, everything is done by invoking commands. This | |||
| 193 | chapter covers command invocations in Eshell, including the command | 194 | chapter covers command invocations in Eshell, including the command |
| 194 | history and invoking commands in a script file. | 195 | history and invoking commands in a script file. |
| 195 | 196 | ||
| 197 | Unlike regular system shells, Eshell never invokes kernel functions | ||
| 198 | directly, such as @code{exec(3)}. Instead, it uses the Lisp functions | ||
| 199 | available in the Emacs Lisp library. It does this by transforming the | ||
| 200 | input line into a callable Lisp form.@footnote{To see the Lisp form | ||
| 201 | that will be invoked, type this as the Eshell prompt: | ||
| 202 | @kbd{eshell-parse-command 'echo hello'}} | ||
| 203 | |||
| 196 | @menu | 204 | @menu |
| 197 | * Invocation:: | 205 | * Invocation:: |
| 198 | * Arguments:: | 206 | * Arguments:: |
| @@ -207,23 +215,16 @@ history and invoking commands in a script file. | |||
| 207 | 215 | ||
| 208 | @node Invocation | 216 | @node Invocation |
| 209 | @section Invocation | 217 | @section Invocation |
| 210 | Unlike regular system shells, Eshell never invokes kernel functions | 218 | Eshell is both a command shell and an Emacs Lisp @acronym{REPL}. As a |
| 211 | directly, such as @code{exec(3)}. Instead, it uses the Lisp functions | 219 | result, you can invoke commands in two different ways: in @dfn{command |
| 212 | available in the Emacs Lisp library. It does this by transforming the | 220 | form} or in @dfn{lisp form}. |
| 213 | input line into a callable Lisp form.@footnote{To see the Lisp form that will be invoked, type: @samp{eshell-parse-command "echo hello"}} | ||
| 214 | 221 | ||
| 215 | The command can be either an Elisp function or an external command. | 222 | You can use the semicolon (@code{;}) to separate multiple command |
| 216 | Eshell looks first for an alias (@pxref{Aliases}) with the same name as the | 223 | invocations on a single line, executing each in turn. You can also |
| 217 | command, then a built-in (@pxref{Built-ins}) or a function with the | 224 | separate commands with @code{&&} or @code{||}. When using @code{&&}, |
| 218 | same name; if there is no match, it then tries to execute it as an | 225 | Eshell will execute the second command only if the first succeeds |
| 219 | external command. | 226 | (i.e.@: has an exit status of 0); with @code{||}, Eshell will execute |
| 220 | 227 | the second command only if the first fails. | |
| 221 | The semicolon (@code{;}) can be used to separate multiple command | ||
| 222 | invocations on a single line. You can also separate commands with | ||
| 223 | @code{&&} or @code{||}. When using @code{&&}, Eshell will execute the | ||
| 224 | second command only if the first succeeds (i.e.@: has an exit | ||
| 225 | status of 0); with @code{||}, Eshell will execute the second command | ||
| 226 | only if the first fails. | ||
| 227 | 228 | ||
| 228 | A command invocation followed by an ampersand (@code{&}) will be run | 229 | A command invocation followed by an ampersand (@code{&}) will be run |
| 229 | in the background. Eshell has no job control, so you can not suspend | 230 | in the background. Eshell has no job control, so you can not suspend |
| @@ -232,12 +233,80 @@ the foreground. That said, background processes invoked from Eshell | |||
| 232 | can be controlled the same way as any other background process in | 233 | can be controlled the same way as any other background process in |
| 233 | Emacs. | 234 | Emacs. |
| 234 | 235 | ||
| 236 | @subsection Command form | ||
| 237 | Command form looks much the same as in other shells. A command | ||
| 238 | consists of arguments separated by spaces; the first argument is the | ||
| 239 | command to run, with any subsequent arguments being passed to that | ||
| 240 | command. | ||
| 241 | |||
| 242 | @example | ||
| 243 | ~ $ echo hello | ||
| 244 | hello | ||
| 245 | @end example | ||
| 246 | |||
| 247 | @cindex order of looking for commands | ||
| 248 | @cindex command lookup order | ||
| 249 | The command can be either an Elisp function or an external command. | ||
| 250 | Eshell looks for the command in the following order: | ||
| 251 | |||
| 252 | @enumerate | ||
| 253 | @item | ||
| 254 | As a command alias (@pxref{Aliases}) | ||
| 255 | |||
| 256 | @item | ||
| 257 | As a built-in command (@pxref{Built-ins}) | ||
| 258 | |||
| 259 | @item | ||
| 260 | As an external program | ||
| 261 | |||
| 262 | @item | ||
| 263 | As an ordinary Lisp function | ||
| 264 | @end enumerate | ||
| 265 | |||
| 266 | @vindex eshell-prefer-lisp-functions | ||
| 267 | If you would prefer to use ordinary Lisp functions over external | ||
| 268 | programs, set the option @code{eshell-prefer-lisp-functions} to | ||
| 269 | @code{t}. This will swap the lookup order of the last two items. | ||
| 270 | |||
| 271 | You can also group command forms together into a subcommand with curly | ||
| 272 | braces (@code{@{@}}). This lets you use the output of a subcommand as | ||
| 273 | an argument to another command, or within control flow statements | ||
| 274 | (@pxref{Control Flow}). | ||
| 275 | |||
| 276 | @example | ||
| 277 | ~ $ echo @{echo hello; echo there@} | ||
| 278 | hellothere | ||
| 279 | @end example | ||
| 280 | |||
| 281 | @subsection Lisp form | ||
| 282 | Lisp form looks like ordinary Emacs Lisp code, because that's what it | ||
| 283 | is. As a result, you can use any syntax normally available to an | ||
| 284 | Emacs Lisp program (@pxref{Top, , , elisp, The Emacs Lisp Reference | ||
| 285 | Manual}). | ||
| 286 | |||
| 287 | @example | ||
| 288 | ~ $ (format "hello, %s" user-login-name) | ||
| 289 | hello, user | ||
| 290 | @end example | ||
| 291 | |||
| 292 | In addition, you can @emph{combine} command forms and Lisp forms | ||
| 293 | together into single statements, letting you use whatever form is the | ||
| 294 | most convenient for expressing your intentions. | ||
| 295 | |||
| 296 | @example | ||
| 297 | ~ $ ls *.patch > (format-time-string "%F.log") | ||
| 298 | @end example | ||
| 299 | |||
| 300 | This command writes a list of all files matching the glob pattern | ||
| 301 | @code{*.patch} (@pxref{Globbing}) to a file named | ||
| 302 | @code{@var{current-date}.log} (@pxref{Redirection}). | ||
| 303 | |||
| 235 | @node Arguments | 304 | @node Arguments |
| 236 | @section Arguments | 305 | @section Arguments |
| 237 | Ordinarily, command arguments are parsed by Eshell as either strings | 306 | Ordinarily, Eshell parses arguments in command form as either strings |
| 238 | or numbers, depending on what the parser thinks they look like. To | 307 | or numbers, depending on what the parser thinks they look like. To |
| 239 | specify an argument of some other data type, you can use an | 308 | specify an argument of some other data type, you can use a Lisp form |
| 240 | @ref{Dollars Expansion, Elisp expression}: | 309 | (@pxref{Invocation}): |
| 241 | 310 | ||
| 242 | @example | 311 | @example |
| 243 | ~ $ echo (list 1 2 3) | 312 | ~ $ echo (list 1 2 3) |
| @@ -354,10 +423,6 @@ eshell/sudo is a compiled Lisp function in `em-tramp.el'. | |||
| 354 | sudo is an alias, defined as "*sudo $@@*" | 423 | sudo is an alias, defined as "*sudo $@@*" |
| 355 | @end example | 424 | @end example |
| 356 | 425 | ||
| 357 | @vindex eshell-prefer-lisp-functions | ||
| 358 | If you would prefer to use the built-in commands instead of the external | ||
| 359 | commands, set @code{eshell-prefer-lisp-functions} to @code{t}. | ||
| 360 | |||
| 361 | Some of the built-in commands have different behavior from their | 426 | Some of the built-in commands have different behavior from their |
| 362 | external counterparts, and some have no external counterpart. Most of | 427 | external counterparts, and some have no external counterpart. Most of |
| 363 | these will print a usage message when given the @code{--help} option. | 428 | these will print a usage message when given the @code{--help} option. |
| @@ -923,15 +988,14 @@ For example, you could handle a subset of the options for the | |||
| 923 | @node Variables | 988 | @node Variables |
| 924 | @section Variables | 989 | @section Variables |
| 925 | @vindex eshell-prefer-lisp-variables | 990 | @vindex eshell-prefer-lisp-variables |
| 926 | Since Eshell is a combination of an Emacs @acronym{REPL}@footnote{ | 991 | Since Eshell is a combination of an Emacs @acronym{REPL} and a command |
| 927 | Short for ``Read-Eval-Print Loop''. | 992 | shell, it can refer to variables from two different sources: ordinary |
| 928 | } and a command shell, it can refer to variables from two different | 993 | Emacs Lisp variables, as well as environment variables. By default, |
| 929 | sources: ordinary Emacs Lisp variables, as well as environment | 994 | when using a variable in Eshell, it will first look in the list of |
| 930 | variables. By default, when using a variable in Eshell, it will first | 995 | built-in variables, then in the list of environment variables, and |
| 931 | look in the list of built-in variables, then in the list of | 996 | finally in the list of Lisp variables. If you would prefer to use |
| 932 | environment variables, and finally in the list of Lisp variables. If | 997 | Lisp variables over environment variables, you can set |
| 933 | you would prefer to use Lisp variables over environment variables, you | 998 | @code{eshell-prefer-lisp-variables} to @code{t}. |
| 934 | can set @code{eshell-prefer-lisp-variables} to @code{t}. | ||
| 935 | 999 | ||
| 936 | You can set variables in a few different ways. To set a Lisp | 1000 | You can set variables in a few different ways. To set a Lisp |
| 937 | variable, you can use the command @samp{setq @var{name} @var{value}}, | 1001 | variable, you can use the command @samp{setq @var{name} @var{value}}, |