aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-28 18:04:57 +0000
committerRichard M. Stallman1995-02-28 18:04:57 +0000
commit56c0450e94b2fa4d2b1d63ce7df0f43e9ab37275 (patch)
treef697570ae40eed82e93995430a9eb1df8d406711
parente6b27a8f0a476cd2debffb05de6712721193ae6d (diff)
downloademacs-56c0450e94b2fa4d2b1d63ce7df0f43e9ab37275.tar.gz
emacs-56c0450e94b2fa4d2b1d63ce7df0f43e9ab37275.zip
(shell-command-on-region): Rename arg; doc fix.
-rw-r--r--lisp/simple.el24
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.
782Normally display output (if any) in temp buffer `*Shell Command Output*'; 782Normally display output (if any) in temp buffer `*Shell Command Output*';
783Prefix arg means replace the region with it. 783Prefix arg means replace the region with it.
784Noninteractive args are START, END, COMMAND, FLAG. 784
785Noninteractively FLAG means insert output in place of text from START to END, 785The noninteractive arguments are START, END, COMMAND, OUTPUT-BUFFER, REPLACE.
786If REPLACE is non-nil, that means insert the output
787in place of text from START to END,
786and put point at the end, but don't alter the mark. 788and put point at the end, but don't alter the mark.
787 789
788If the output is one line, it is displayed in the echo area, 790If the output is one line, it is displayed in the echo area,
789but it is nonetheless available in buffer `*Shell Command Output*' 791but it is nonetheless available in buffer `*Shell Command Output*'
790even though that buffer is not automatically displayed. If there is no output 792even though that buffer is not automatically displayed.
791or output is inserted in the current buffer then `*Shell Command Output*' is 793If there is no output. or ifoutput is inserted in the current buffer,
792deleted. 794then `*Shell Command Output*' is deleted.
793 795
794The optional second argument OUTPUT-BUFFER, if non-nil, 796If the optional fourth argument OUTPUT-BUFFER is non-nil,
795says to put the output in some other buffer. 797that says to put the output in some other buffer.
796If OUTPUT-BUFFER is a buffer or buffer name, put the output there. 798If OUTPUT-BUFFER is a buffer or buffer name, put the output there.
797If OUTPUT-BUFFER is not a buffer and not nil, 799If OUTPUT-BUFFER is not a buffer and not nil,
798insert output in the current buffer. 800insert 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