1628 |
|
|
1629 |
(defun shell-command-on-region (start end command |
(defun shell-command-on-region (start end command |
1630 |
&optional output-buffer replace |
&optional output-buffer replace |
1631 |
error-buffer) |
error-buffer display-error-buffer) |
1632 |
"Execute string COMMAND in inferior shell with region as input. |
"Execute string COMMAND in inferior shell with region as input. |
1633 |
Normally display output (if any) in temp buffer `*Shell Command Output*'; |
Normally display output (if any) in temp buffer `*Shell Command Output*'; |
1634 |
Prefix arg means replace the region with it. Return the exit code of |
Prefix arg means replace the region with it. Return the exit code of |
1641 |
`buffer-file-coding-system'. If the output is going to replace the region, |
`buffer-file-coding-system'. If the output is going to replace the region, |
1642 |
then it is decoded from that same coding system. |
then it is decoded from that same coding system. |
1643 |
|
|
1644 |
The noninteractive arguments are START, END, COMMAND, OUTPUT-BUFFER, |
The noninteractive arguments are START, END, COMMAND, |
1645 |
REPLACE, ERROR-BUFFER. Noninteractive callers can specify coding |
OUTPUT-BUFFER, REPLACE, ERROR-BUFFER, and DISPLAY-ERROR-BUFFER. |
1646 |
systems by binding `coding-system-for-read' and |
Noninteractive callers can specify coding systems by binding |
1647 |
`coding-system-for-write'. |
`coding-system-for-read' and `coding-system-for-write'. |
1648 |
|
|
1649 |
If the command generates output, the output may be displayed |
If the command generates output, the output may be displayed |
1650 |
in the echo area or in a buffer. |
in the echo area or in a buffer. |
1674 |
If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer |
If optional sixth argument ERROR-BUFFER is non-nil, it is a buffer |
1675 |
or buffer name to which to direct the command's standard error output. |
or buffer name to which to direct the command's standard error output. |
1676 |
If it is nil, error output is mingled with regular output. |
If it is nil, error output is mingled with regular output. |
1677 |
|
If DISPLAY-ERROR-BUFFER is non-nil, display the error buffer if there |
1678 |
|
were any errors. (This is always t, interactively.) |
1679 |
In an interactive call, the variable `shell-command-default-error-buffer' |
In an interactive call, the variable `shell-command-default-error-buffer' |
1680 |
specifies the value of ERROR-BUFFER." |
specifies the value of ERROR-BUFFER." |
1681 |
(interactive (let (string) |
(interactive (let (string) |
1693 |
string |
string |
1694 |
current-prefix-arg |
current-prefix-arg |
1695 |
current-prefix-arg |
current-prefix-arg |
1696 |
shell-command-default-error-buffer))) |
shell-command-default-error-buffer |
1697 |
|
t))) |
1698 |
(let ((error-file |
(let ((error-file |
1699 |
(if error-buffer |
(if error-buffer |
1700 |
(make-temp-file |
(make-temp-file |
1803 |
(format-insert-file error-file nil) |
(format-insert-file error-file nil) |
1804 |
;; Put point after the inserted errors. |
;; Put point after the inserted errors. |
1805 |
(goto-char (- (point-max) pos-from-end))) |
(goto-char (- (point-max) pos-from-end))) |
1806 |
(display-buffer (current-buffer)))) |
(and display-error-buffer |
1807 |
|
(display-buffer (current-buffer))))) |
1808 |
(delete-file error-file)) |
(delete-file error-file)) |
1809 |
exit-status)) |
exit-status)) |
1810 |
|
|