]> git.eshelyaron.com Git - emacs.git/commitdiff
(shell-command-on-region): Err if no mark before reading the command string.
authorRichard M. Stallman <rms@gnu.org>
Fri, 1 Feb 2002 04:20:02 +0000 (04:20 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 1 Feb 2002 04:20:02 +0000 (04:20 +0000)
lisp/simple.el

index 56b45e0383605f5df81fb3d29f4716cfb087aaf9..7445983cc69d1137f3cd61b5efab203d173b1090 100644 (file)
@@ -1421,13 +1421,15 @@ or buffer name to which to direct the command's standard error output.
 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)