diff options
| author | Richard M. Stallman | 1995-02-28 18:04:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-28 18:04:57 +0000 |
| commit | 56c0450e94b2fa4d2b1d63ce7df0f43e9ab37275 (patch) | |
| tree | f697570ae40eed82e93995430a9eb1df8d406711 | |
| parent | e6b27a8f0a476cd2debffb05de6712721193ae6d (diff) | |
| download | emacs-56c0450e94b2fa4d2b1d63ce7df0f43e9ab37275.tar.gz emacs-56c0450e94b2fa4d2b1d63ce7df0f43e9ab37275.zip | |
(shell-command-on-region): Rename arg; doc fix.
| -rw-r--r-- | lisp/simple.el | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 1a4a245af19..8c91745b9db 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -777,22 +777,24 @@ In either case, the output is inserted after point (leaving mark after it)." | |||
| 777 | (set-buffer obuf)))) | 777 | (set-buffer obuf)))) |
| 778 | 778 | ||
| 779 | (defun shell-command-on-region (start end command | 779 | (defun shell-command-on-region (start end command |
| 780 | &optional output-buffer interactive) | 780 | &optional output-buffer replace) |
| 781 | "Execute string COMMAND in inferior shell with region as input. | 781 | "Execute string COMMAND in inferior shell with region as input. |
| 782 | Normally display output (if any) in temp buffer `*Shell Command Output*'; | 782 | Normally display output (if any) in temp buffer `*Shell Command Output*'; |
| 783 | Prefix arg means replace the region with it. | 783 | Prefix arg means replace the region with it. |
| 784 | Noninteractive args are START, END, COMMAND, FLAG. | 784 | |
| 785 | Noninteractively FLAG means insert output in place of text from START to END, | 785 | The noninteractive arguments are START, END, COMMAND, OUTPUT-BUFFER, REPLACE. |
| 786 | If REPLACE is non-nil, that means insert the output | ||
| 787 | in place of text from START to END, | ||
| 786 | and put point at the end, but don't alter the mark. | 788 | and put point at the end, but don't alter the mark. |
| 787 | 789 | ||
| 788 | If the output is one line, it is displayed in the echo area, | 790 | If the output is one line, it is displayed in the echo area, |
| 789 | but it is nonetheless available in buffer `*Shell Command Output*' | 791 | but it is nonetheless available in buffer `*Shell Command Output*' |
| 790 | even though that buffer is not automatically displayed. If there is no output | 792 | even though that buffer is not automatically displayed. |
| 791 | or output is inserted in the current buffer then `*Shell Command Output*' is | 793 | If there is no output. or ifoutput is inserted in the current buffer, |
| 792 | deleted. | 794 | then `*Shell Command Output*' is deleted. |
| 793 | 795 | ||
| 794 | The optional second argument OUTPUT-BUFFER, if non-nil, | 796 | If the optional fourth argument OUTPUT-BUFFER is non-nil, |
| 795 | says to put the output in some other buffer. | 797 | that says to put the output in some other buffer. |
| 796 | If OUTPUT-BUFFER is a buffer or buffer name, put the output there. | 798 | If OUTPUT-BUFFER is a buffer or buffer name, put the output there. |
| 797 | If OUTPUT-BUFFER is not a buffer and not nil, | 799 | If OUTPUT-BUFFER is not a buffer and not nil, |
| 798 | insert output in the current buffer. | 800 | insert output in the current buffer. |
| @@ -811,16 +813,16 @@ In either case, the output is inserted after point (leaving mark after it)." | |||
| 811 | (if (and output-buffer | 813 | (if (and output-buffer |
| 812 | (not (or (bufferp output-buffer) (stringp output-buffer)))) | 814 | (not (or (bufferp output-buffer) (stringp output-buffer)))) |
| 813 | ;; Replace specified region with output from command. | 815 | ;; Replace specified region with output from command. |
| 814 | (let ((swap (and interactive (< (point) (mark))))) | 816 | (let ((swap (and replace (< (point) (mark))))) |
| 815 | ;; Don't muck with mark | 817 | ;; Don't muck with mark |
| 816 | ;; unless called interactively. | 818 | ;; unless called interactively. |
| 817 | (and interactive (push-mark)) | 819 | (and replace (push-mark)) |
| 818 | (call-process-region start end shell-file-name t t nil | 820 | (call-process-region start end shell-file-name t t nil |
| 819 | shell-command-switch command) | 821 | shell-command-switch command) |
| 820 | (let ((shell-buffer (get-buffer "*Shell Command Output*"))) | 822 | (let ((shell-buffer (get-buffer "*Shell Command Output*"))) |
| 821 | (and shell-buffer (not (eq shell-buffer (current-buffer))) | 823 | (and shell-buffer (not (eq shell-buffer (current-buffer))) |
| 822 | (kill-buffer shell-buffer))) | 824 | (kill-buffer shell-buffer))) |
| 823 | (and interactive swap (exchange-point-and-mark))) | 825 | (and replace swap (exchange-point-and-mark))) |
| 824 | ;; No prefix argument: put the output in a temp buffer, | 826 | ;; No prefix argument: put the output in a temp buffer, |
| 825 | ;; replacing its entire contents. | 827 | ;; replacing its entire contents. |
| 826 | (let ((buffer (get-buffer-create | 828 | (let ((buffer (get-buffer-create |