* Replacing a region with external filter program
@ 2006-09-08 6:51 Thomas
2006-09-08 6:57 ` David Kastrup
2006-09-08 15:24 ` Kevin Rodgers
0 siblings, 2 replies; 3+ messages in thread
From: Thomas @ 2006-09-08 6:51 UTC (permalink / raw)
Hi, Is it possible to visual-select a region and then calls an external
filter program (like awk, sed, uniq, sort, etc.) which consumes the
region as its input and replace the original area with the output of
the
filtering?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Replacing a region with external filter program
2006-09-08 6:51 Replacing a region with external filter program Thomas
@ 2006-09-08 6:57 ` David Kastrup
2006-09-08 15:24 ` Kevin Rodgers
1 sibling, 0 replies; 3+ messages in thread
From: David Kastrup @ 2006-09-08 6:57 UTC (permalink / raw)
"Thomas" <totohero@empal.com> writes:
> Hi, Is it possible to visual-select a region and then calls an
> external filter program (like awk, sed, uniq, sort, etc.) which
> consumes the region as its input and replace the original area with
> the output of the filtering?
M-| (translated from <escape> |) runs the command shell-command-on-region
which is an interactive compiled Lisp function in `simple.el'.
It is bound to M-|, <menu-bar> <tools> <shell-on-region>.
(shell-command-on-region START END COMMAND &optional OUTPUT-BUFFER
REPLACE ERROR-BUFFER DISPLAY-ERROR-BUFFER)
Execute string COMMAND in inferior shell with region as input.
Normally display output (if any) in temp buffer `*Shell Command Output*';
Prefix arg means replace the region with it. Return the exit code of
COMMAND.
To specify a coding system for converting non-ASCII characters
in the input and output to the shell command, use C-x RET c
before this command. By default, the input (from the current buffer)
is encoded in the same coding system that will be used to save the file,
`buffer-file-coding-system'. If the output is going to replace the region,
then it is decoded from that same coding system.
The noninteractive arguments are START, END, COMMAND,
OUTPUT-BUFFER, REPLACE, ERROR-BUFFER, and DISPLAY-ERROR-BUFFER.
Noninteractive callers can specify coding systems by binding
`coding-system-for-read' and `coding-system-for-write'.
If the command generates output, the output may be displayed
in the echo area or in a buffer.
If the output is short enough to display in the echo area
(determined by the variable `max-mini-window-height' if
`resize-mini-windows' is non-nil), it is shown there. Otherwise
it is displayed in the buffer `*Shell Command Output*'. The output
is available in that buffer in both cases.
If there is output and an error, a message about the error
appears at the end of the output.
If there is no output, or if output is inserted in the current buffer,
then `*Shell Command Output*' is deleted.
If the optional fourth argument OUTPUT-BUFFER is non-nil,
that says to put the output in some other buffer.
If OUTPUT-BUFFER is a buffer or buffer name, put the output there.
If OUTPUT-BUFFER is not a buffer and not nil,
insert output in the current buffer.
In either case, the output is inserted after point (leaving mark after it).
If REPLACE, the optional fifth argument, is non-nil, that means insert
the output in place of text from START to END, putting point and mark
around it.
If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer
or buffer name to which to direct the command's standard error output.
If it is nil, error output is mingled with regular output.
If DISPLAY-ERROR-BUFFER is non-nil, display the error buffer if there
were any errors. (This is always t, interactively.)
In an interactive call, the variable `shell-command-default-error-buffer'
specifies the value of ERROR-BUFFER.
[back]
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Replacing a region with external filter program
2006-09-08 6:51 Replacing a region with external filter program Thomas
2006-09-08 6:57 ` David Kastrup
@ 2006-09-08 15:24 ` Kevin Rodgers
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2006-09-08 15:24 UTC (permalink / raw)
Thomas wrote:
> Hi, Is it possible to visual-select a region and then calls an external
> filter program (like awk, sed, uniq, sort, etc.) which consumes the
> region as its input and replace the original area with the output of
> the
> filtering?
C-u M-|
--
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-08 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-08 6:51 Replacing a region with external filter program Thomas
2006-09-08 6:57 ` David Kastrup
2006-09-08 15:24 ` Kevin Rodgers
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.