comparison lisp/prim/process.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 56c54cf7c5b6
children 7d55a9ba150c
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; General Public License for more details. 16 ;; General Public License for more details.
17 17
18 ;; You should have received a copy of the GNU General Public License 18 ;; You should have received a copy of the GNU General Public License
19 ;; along with XEmacs; see the file COPYING. If not, write to the 19 ;; along with XEmacs; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 ;; Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA. 21 ;; Boston, MA 02111-1307, USA.
22 22
23 ;;; Synched up with: FSF 19.30. 23 ;;; Synched up with: FSF 19.30.
24 24
25 ;;; Code: 25 ;;; Code:
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 output-buffer))))) 163 (shell-command-on-region (point) (point) command nil)))))
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 (let ((string 195 (interactive (if (not (region-exists-p))
196 (error "The region is not active now")
197 (let ((string
196 ;; Do this before calling region-beginning 198 ;; Do this before calling region-beginning
197 ;; and region-end, in case subprocess output 199 ;; and region-end, in case subprocess output
198 ;; relocates them while we are in the minibuffer. 200 ;; relocates them while we are in the minibuffer.
199 (read-shell-command "Shell command on region: "))) 201 (read-shell-command "Shell command on region: ")))
200 ;; call-interactively recognizes region-beginning and 202 ;; call-interactively recognizes region-beginning and
201 ;; region-end specially, leaving them in the history. 203 ;; region-end specially, leaving them in the history.
202 (list (region-beginning) (region-end) 204 (list (region-beginning) (region-end)
203 string 205 string
204 current-prefix-arg 206 current-prefix-arg
205 current-prefix-arg))) 207 current-prefix-arg))))
206 (if (or replace 208 (if (or replace
207 (and output-buffer 209 (and output-buffer
208 (not (or (bufferp output-buffer) (stringp output-buffer))))) 210 (not (or (bufferp output-buffer) (stringp output-buffer)))))
209 ;; Replace specified region with output from command. 211 ;; Replace specified region with output from command.
210 (let ((swap (and replace (< start end)))) 212 (let ((swap (and replace (< start end))))