Mercurial > hg > xemacs-beta
comparison lisp/prim/process.el @ 48:56c54cf7c5b6 r19-16b90
Import from CVS: tag r19-16b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:56:04 +0200 |
parents | 0293115a14e9 |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
47:11c6df210d7f | 48:56c54cf7c5b6 |
---|---|
158 (if (string-match "[ \t]*&[ \t]*$" command) | 158 (if (string-match "[ \t]*&[ \t]*$" command) |
159 ;; Command ending with ampersand means asynchronous. | 159 ;; Command ending with ampersand means asynchronous. |
160 (progn | 160 (progn |
161 (require 'background) ; whizzy comint background code | 161 (require 'background) ; whizzy comint background code |
162 (background (substring command 0 (match-beginning 0)))) | 162 (background (substring command 0 (match-beginning 0)))) |
163 (shell-command-on-region (point) (point) command nil))))) | 163 (shell-command-on-region (point) (point) command output-buffer))))) |
164 | 164 |
165 ;; We have a sentinel to prevent insertion of a termination message | 165 ;; We have a sentinel to prevent insertion of a termination message |
166 ;; in the buffer itself. | 166 ;; in the buffer itself. |
167 (defun shell-command-sentinel (process signal) | 167 (defun shell-command-sentinel (process signal) |
168 (if (memq (process-status process) '(exit signal)) | 168 (if (memq (process-status process) '(exit signal)) |
190 that says to put the output in some other buffer. | 190 that says to put the output in some other buffer. |
191 If OUTPUT-BUFFER is a buffer or buffer name, put the output there. | 191 If OUTPUT-BUFFER is a buffer or buffer name, put the output there. |
192 If OUTPUT-BUFFER is not a buffer and not nil, | 192 If OUTPUT-BUFFER is not a buffer and not nil, |
193 insert output in the current buffer. | 193 insert output in the current buffer. |
194 In either case, the output is inserted after point (leaving mark after it)." | 194 In either case, the output is inserted after point (leaving mark after it)." |
195 (interactive (if (not (region-exists-p)) | 195 (interactive (let ((string |
196 (error "The region is not active now") | |
197 (let ((string | |
198 ;; Do this before calling region-beginning | 196 ;; Do this before calling region-beginning |
199 ;; and region-end, in case subprocess output | 197 ;; and region-end, in case subprocess output |
200 ;; relocates them while we are in the minibuffer. | 198 ;; relocates them while we are in the minibuffer. |
201 (read-shell-command "Shell command on region: "))) | 199 (read-shell-command "Shell command on region: "))) |
202 ;; call-interactively recognizes region-beginning and | 200 ;; call-interactively recognizes region-beginning and |
203 ;; region-end specially, leaving them in the history. | 201 ;; region-end specially, leaving them in the history. |
204 (list (region-beginning) (region-end) | 202 (list (region-beginning) (region-end) |
205 string | 203 string |
206 current-prefix-arg | 204 current-prefix-arg |
207 current-prefix-arg)))) | 205 current-prefix-arg))) |
208 (if (or replace | 206 (if (or replace |
209 (and output-buffer | 207 (and output-buffer |
210 (not (or (bufferp output-buffer) (stringp output-buffer))))) | 208 (not (or (bufferp output-buffer) (stringp output-buffer))))) |
211 ;; Replace specified region with output from command. | 209 ;; Replace specified region with output from command. |
212 (let ((swap (and replace (< start end)))) | 210 (let ((swap (and replace (< start end)))) |