Mercurial > emacs
comparison man/misc.texi @ 38132:1471b85b3b80
Give examples for M-! and M-|.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 20 Jun 2001 10:50:04 +0000 |
parents | 64ee3e7394ed |
children | 24fa5ae5fd91 |
comparison
equal
deleted
inserted
replaced
38131:a678d1512bf0 | 38132:1471b85b3b80 |
---|---|
355 minibuffer and executes it as a shell command in a subshell made just | 355 minibuffer and executes it as a shell command in a subshell made just |
356 for that command. Standard input for the command comes from the null | 356 for that command. Standard input for the command comes from the null |
357 device. If the shell command produces any output, the output appears | 357 device. If the shell command produces any output, the output appears |
358 either in the echo area (if it is short), or in an Emacs buffer named | 358 either in the echo area (if it is short), or in an Emacs buffer named |
359 @samp{*Shell Command Output*}, which is displayed in another window | 359 @samp{*Shell Command Output*}, which is displayed in another window |
360 but not selected (if the output is long). A numeric argument, as in | 360 but not selected (if the output is long). |
361 @kbd{M-1 M-!}, directs this command to insert any output into the | 361 |
362 current buffer instead. In that case, point is left before the output | 362 For instance, one way to decompress a file @file{foo.gz} from Emacs |
363 and the mark is set after the output. | 363 is to type @kbd{M-! gunzip foo.gz @key{RET}}. That shell command |
364 normally creates the file @file{foo} and produces no terminal output. | |
365 | |
366 A numeric argument, as in @kbd{M-1 M-!}, says to insert terminal | |
367 output into the current buffer instead of a separate buffer. It puts | |
368 point before the output, and sets the mark after the output. For | |
369 instance, @kbd{M-1 M-! gunzip < foo.gz @key{RET}} would insert the | |
370 uncompressed equivalent of @file{foo.gz} into the current buffer. | |
364 | 371 |
365 If the shell command line ends in @samp{&}, it runs asynchronously. | 372 If the shell command line ends in @samp{&}, it runs asynchronously. |
366 For a synchronous shell command, @code{shell-command} returns the | 373 For a synchronous shell command, @code{shell-command} returns the |
367 command's exit status (0 means success), when it is called from a Lisp | 374 command's exit status (0 means success), when it is called from a Lisp |
368 program. | 375 program. You do not get any status information for an asynchronous |
376 command, since it hasn't finished yet. | |
369 | 377 |
370 @kindex M-| | 378 @kindex M-| |
371 @findex shell-command-on-region | 379 @findex shell-command-on-region |
372 @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!} but | 380 @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!} but |
373 passes the contents of the region as the standard input to the shell | 381 passes the contents of the region as the standard input to the shell |
374 command, instead of no input. If a numeric argument is used, meaning | 382 command, instead of no input. If a numeric argument is used, meaning |
375 insert the output in the current buffer, then the old region is deleted | 383 insert the output in the current buffer, then the old region is deleted |
376 first and the output replaces it as the contents of the region. It | 384 first and the output replaces it as the contents of the region. It |
377 returns the command's exit status when it is called from a Lisp program. | 385 returns the command's exit status when it is called from a Lisp program. |
386 | |
387 One use for @kbd{M-|} is to run @code{uudecode}. For instance, if | |
388 the buffer contains uuencoded text, type @kbd{C-x h M-| uudecode | |
389 @key{RET}} to feed the entire buffer contents to the @code{uudecode} | |
390 program. That program will ignore everything except the encoded text, | |
391 and will store the decoded output into the file whose name is | |
392 specified in the encoded text. | |
378 | 393 |
379 @vindex shell-file-name | 394 @vindex shell-file-name |
380 @cindex environment | 395 @cindex environment |
381 Both @kbd{M-!} and @kbd{M-|} use @code{shell-file-name} to specify the | 396 Both @kbd{M-!} and @kbd{M-|} use @code{shell-file-name} to specify the |
382 shell to use. This variable is initialized based on your @env{SHELL} | 397 shell to use. This variable is initialized based on your @env{SHELL} |