changeset 10805:7b7874738e7c

(shell-command-on-region): When computing interactive args, read the minibuffer arg first, then get the region bounds.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Feb 1995 05:02:54 +0000
parents abd9ad4309b0
children 9e59d5bdaab8
files lisp/simple.el
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Thu Feb 23 04:59:43 1995 +0000
+++ b/lisp/simple.el	Thu Feb 23 05:02:54 1995 +0000
@@ -795,11 +795,17 @@
 If OUTPUT-BUFFER is not a buffer and not nil,
 insert output in the current buffer.
 In either case, the output is inserted after point (leaving mark after it)."
-  (interactive (list (region-beginning) (region-end)
-		     (read-from-minibuffer "Shell command on region: "
-					   nil nil nil 'shell-command-history)
-		     current-prefix-arg
-		     (prefix-numeric-value current-prefix-arg)))
+  (interactive (let ((string
+		      ;; Do this before calling region-beginning
+		      ;; and region-end, in case subprocess output
+		      ;; relocates them while we are in the minibuffer.
+		      (read-from-minibuffer "Shell command on region: "
+					    nil nil nil
+					    'shell-command-history)))
+		 (list (region-beginning) (region-end)
+		       string
+		       current-prefix-arg
+		       (prefix-numeric-value current-prefix-arg))))
   (if (and output-buffer
 	   (not (or (bufferp output-buffer) (stringp output-buffer))))
       ;; Replace specified region with output from command.