aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorStefan Kangas2023-01-19 06:30:25 +0100
committerStefan Kangas2023-01-19 06:30:25 +0100
commit9161a302c9f9fbfa1a8f33181bb332d2c5df3aa7 (patch)
tree21de62aa23f4ad770ff8afe322c0223ea7e0af76 /doc/misc
parentefb9ec11bbee3871d77dc4e9217bd9293d525d5d (diff)
parentdb727873803a974ba210c4942ae7cbcc3d6268ab (diff)
downloademacs-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.texi136
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
65Eshell is a shell-like command interpreter implemented in Emacs Lisp. 65Eshell is a shell-like command interpreter implemented in Emacs Lisp.
66It invokes no external processes except for those requested by the 66It invokes no external processes except for those requested by the
67user. It is intended to be an alternative to the IELM (@pxref{Lisp Interaction, Emacs Lisp Interaction, , emacs, The Emacs Editor}) 67user. It is intended to be an alternative to the IELM (@pxref{Lisp
68REPL for Emacs @emph{and} with an interface similar to command shells 68Interaction, Emacs Lisp Interaction, , emacs, The Emacs Editor})
69such as @command{bash}, @command{zsh}, @command{rc}, or 69REPL@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
193chapter covers command invocations in Eshell, including the command 194chapter covers command invocations in Eshell, including the command
194history and invoking commands in a script file. 195history and invoking commands in a script file.
195 196
197Unlike regular system shells, Eshell never invokes kernel functions
198directly, such as @code{exec(3)}. Instead, it uses the Lisp functions
199available in the Emacs Lisp library. It does this by transforming the
200input line into a callable Lisp form.@footnote{To see the Lisp form
201that 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
210Unlike regular system shells, Eshell never invokes kernel functions 218Eshell is both a command shell and an Emacs Lisp @acronym{REPL}. As a
211directly, such as @code{exec(3)}. Instead, it uses the Lisp functions 219result, you can invoke commands in two different ways: in @dfn{command
212available in the Emacs Lisp library. It does this by transforming the 220form} or in @dfn{lisp form}.
213input 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
215The command can be either an Elisp function or an external command. 222You can use the semicolon (@code{;}) to separate multiple command
216Eshell looks first for an alias (@pxref{Aliases}) with the same name as the 223invocations on a single line, executing each in turn. You can also
217command, then a built-in (@pxref{Built-ins}) or a function with the 224separate commands with @code{&&} or @code{||}. When using @code{&&},
218same name; if there is no match, it then tries to execute it as an 225Eshell will execute the second command only if the first succeeds
219external command. 226(i.e.@: has an exit status of 0); with @code{||}, Eshell will execute
220 227the second command only if the first fails.
221The semicolon (@code{;}) can be used to separate multiple command
222invocations on a single line. You can also separate commands with
223@code{&&} or @code{||}. When using @code{&&}, Eshell will execute the
224second command only if the first succeeds (i.e.@: has an exit
225status of 0); with @code{||}, Eshell will execute the second command
226only if the first fails.
227 228
228A command invocation followed by an ampersand (@code{&}) will be run 229A command invocation followed by an ampersand (@code{&}) will be run
229in the background. Eshell has no job control, so you can not suspend 230in 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
232can be controlled the same way as any other background process in 233can be controlled the same way as any other background process in
233Emacs. 234Emacs.
234 235
236@subsection Command form
237Command form looks much the same as in other shells. A command
238consists of arguments separated by spaces; the first argument is the
239command to run, with any subsequent arguments being passed to that
240command.
241
242@example
243~ $ echo hello
244hello
245@end example
246
247@cindex order of looking for commands
248@cindex command lookup order
249The command can be either an Elisp function or an external command.
250Eshell looks for the command in the following order:
251
252@enumerate
253@item
254As a command alias (@pxref{Aliases})
255
256@item
257As a built-in command (@pxref{Built-ins})
258
259@item
260As an external program
261
262@item
263As an ordinary Lisp function
264@end enumerate
265
266@vindex eshell-prefer-lisp-functions
267If you would prefer to use ordinary Lisp functions over external
268programs, set the option @code{eshell-prefer-lisp-functions} to
269@code{t}. This will swap the lookup order of the last two items.
270
271You can also group command forms together into a subcommand with curly
272braces (@code{@{@}}). This lets you use the output of a subcommand as
273an argument to another command, or within control flow statements
274(@pxref{Control Flow}).
275
276@example
277~ $ echo @{echo hello; echo there@}
278hellothere
279@end example
280
281@subsection Lisp form
282Lisp form looks like ordinary Emacs Lisp code, because that's what it
283is. As a result, you can use any syntax normally available to an
284Emacs Lisp program (@pxref{Top, , , elisp, The Emacs Lisp Reference
285Manual}).
286
287@example
288~ $ (format "hello, %s" user-login-name)
289hello, user
290@end example
291
292In addition, you can @emph{combine} command forms and Lisp forms
293together into single statements, letting you use whatever form is the
294most convenient for expressing your intentions.
295
296@example
297~ $ ls *.patch > (format-time-string "%F.log")
298@end example
299
300This 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
237Ordinarily, command arguments are parsed by Eshell as either strings 306Ordinarily, Eshell parses arguments in command form as either strings
238or numbers, depending on what the parser thinks they look like. To 307or numbers, depending on what the parser thinks they look like. To
239specify an argument of some other data type, you can use an 308specify 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'.
354sudo is an alias, defined as "*sudo $@@*" 423sudo is an alias, defined as "*sudo $@@*"
355@end example 424@end example
356 425
357@vindex eshell-prefer-lisp-functions
358If you would prefer to use the built-in commands instead of the external
359commands, set @code{eshell-prefer-lisp-functions} to @code{t}.
360
361Some of the built-in commands have different behavior from their 426Some of the built-in commands have different behavior from their
362external counterparts, and some have no external counterpart. Most of 427external counterparts, and some have no external counterpart. Most of
363these will print a usage message when given the @code{--help} option. 428these 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
926Since Eshell is a combination of an Emacs @acronym{REPL}@footnote{ 991Since Eshell is a combination of an Emacs @acronym{REPL} and a command
927Short for ``Read-Eval-Print Loop''. 992shell, it can refer to variables from two different sources: ordinary
928} and a command shell, it can refer to variables from two different 993Emacs Lisp variables, as well as environment variables. By default,
929sources: ordinary Emacs Lisp variables, as well as environment 994when using a variable in Eshell, it will first look in the list of
930variables. By default, when using a variable in Eshell, it will first 995built-in variables, then in the list of environment variables, and
931look in the list of built-in variables, then in the list of 996finally in the list of Lisp variables. If you would prefer to use
932environment variables, and finally in the list of Lisp variables. If 997Lisp variables over environment variables, you can set
933you would prefer to use Lisp variables over environment variables, you 998@code{eshell-prefer-lisp-variables} to @code{t}.
934can set @code{eshell-prefer-lisp-variables} to @code{t}.
935 999
936You can set variables in a few different ways. To set a Lisp 1000You can set variables in a few different ways. To set a Lisp
937variable, you can use the command @samp{setq @var{name} @var{value}}, 1001variable, you can use the command @samp{setq @var{name} @var{value}},