changeset 43032:27a9a1ef61f9

(shell-command-on-region): Err if no mark before reading the command string.
author Richard M. Stallman <rms@gnu.org>
date Fri, 01 Feb 2002 04:20:02 +0000
parents 46823e7a2cae
children 9af85e74c287
files lisp/simple.el
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Fri Feb 01 04:18:46 2002 +0000
+++ b/lisp/simple.el	Fri Feb 01 04:20:02 2002 +0000
@@ -1421,13 +1421,15 @@
 If it is nil, error output is mingled with regular output.
 In an interactive call, the variable `shell-command-default-error-buffer'
 specifies the value of ERROR-BUFFER."
-  (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)))
+  (interactive (let (string)
+		 (unless (mark)
+		   (error "The mark is not set now, so there is no region"))
+		 ;; Do this before calling region-beginning
+		 ;; and region-end, in case subprocess output
+		 ;; relocates them while we are in the minibuffer.
+		 (setq string (read-from-minibuffer "Shell command on region: "
+						    nil nil nil
+						    'shell-command-history))
 		 ;; call-interactively recognizes region-beginning and
 		 ;; region-end specially, leaving them in the history.
 		 (list (region-beginning) (region-end)