diff options
author | Richard M. Stallman <rms@gnu.org> | 2002-02-01 04:20:02 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2002-02-01 04:20:02 +0000 |
commit | 195ce311607af59b164fc1b6b2e87ecad43e5241 (patch) | |
tree | 45bab7012a57545b59f4b0fabf7133b09712d53a /lisp | |
parent | 57e46f945ec87c89a17469195a6c8dcd12ac7e29 (diff) | |
download | emacs-195ce311607af59b164fc1b6b2e87ecad43e5241.tar.gz |
(shell-command-on-region): Err if no mark before reading the command string.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/simple.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 56b45e03836..7445983cc69 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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) |