comparison lisp/simple.el @ 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 7d9423ce104d
children bccf0295c66e
comparison
equal deleted inserted replaced
10804:abd9ad4309b0 10805:7b7874738e7c
793 says to put the output in some other buffer. 793 says to put the output in some other buffer.
794 If OUTPUT-BUFFER is a buffer or buffer name, put the output there. 794 If OUTPUT-BUFFER is a buffer or buffer name, put the output there.
795 If OUTPUT-BUFFER is not a buffer and not nil, 795 If OUTPUT-BUFFER is not a buffer and not nil,
796 insert output in the current buffer. 796 insert output in the current buffer.
797 In either case, the output is inserted after point (leaving mark after it)." 797 In either case, the output is inserted after point (leaving mark after it)."
798 (interactive (list (region-beginning) (region-end) 798 (interactive (let ((string
799 (read-from-minibuffer "Shell command on region: " 799 ;; Do this before calling region-beginning
800 nil nil nil 'shell-command-history) 800 ;; and region-end, in case subprocess output
801 current-prefix-arg 801 ;; relocates them while we are in the minibuffer.
802 (prefix-numeric-value current-prefix-arg))) 802 (read-from-minibuffer "Shell command on region: "
803 nil nil nil
804 'shell-command-history)))
805 (list (region-beginning) (region-end)
806 string
807 current-prefix-arg
808 (prefix-numeric-value current-prefix-arg))))
803 (if (and output-buffer 809 (if (and output-buffer
804 (not (or (bufferp output-buffer) (stringp output-buffer)))) 810 (not (or (bufferp output-buffer) (stringp output-buffer))))
805 ;; Replace specified region with output from command. 811 ;; Replace specified region with output from command.
806 (let ((swap (and interactive (< (point) (mark))))) 812 (let ((swap (and interactive (< (point) (mark)))))
807 ;; Don't muck with mark 813 ;; Don't muck with mark