aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-01 05:50:57 +0000
committerRichard M. Stallman1994-11-01 05:50:57 +0000
commit59fc41e5478ebe7fbefdedc6cb14b9b252448527 (patch)
tree41580d7807bd431191793d6075d08757afebf451
parent7d1aa45da3f2a94171fcc946084e354f4ca7b570 (diff)
downloademacs-59fc41e5478ebe7fbefdedc6cb14b9b252448527.tar.gz
emacs-59fc41e5478ebe7fbefdedc6cb14b9b252448527.zip
(shell-command-switch): New variable.
(shell-command, shell-command-on-region): Use new variable.
-rw-r--r--lisp/simple.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index c4426c5ea1c..2f0fbc61b4a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -667,6 +667,9 @@ then call `undo-more' one or more times to undo them."
667(defvar shell-command-history nil 667(defvar shell-command-history nil
668 "History list for some commands that read shell commands.") 668 "History list for some commands that read shell commands.")
669 669
670(defvar shell-command-switch "-c"
671 "Switch used to have the shell execute its command line argument.")
672
670(defun shell-command (command &optional output-buffer) 673(defun shell-command (command &optional output-buffer)
671 "Execute string COMMAND in inferior shell; display output, if any. 674 "Execute string COMMAND in inferior shell; display output, if any.
672If COMMAND ends in ampersand, execute it asynchronously. 675If COMMAND ends in ampersand, execute it asynchronously.
@@ -691,7 +694,7 @@ In either case, the output is inserted after point (leaving mark after it)."
691 ;; non-interactively. Besides, if someone wants their other 694 ;; non-interactively. Besides, if someone wants their other
692 ;; aliases for shell commands then they can still have them. 695 ;; aliases for shell commands then they can still have them.
693 (call-process shell-file-name nil t nil 696 (call-process shell-file-name nil t nil
694 "-c" command) 697 shell-command-switch command)
695 ;; This is like exchange-point-and-mark, but doesn't activate the mark. 698 ;; This is like exchange-point-and-mark, but doesn't activate the mark.
696 ;; It is cleaner to avoid activation, even though the command 699 ;; It is cleaner to avoid activation, even though the command
697 ;; loop would deactivate the mark because we inserted text. 700 ;; loop would deactivate the mark because we inserted text.
@@ -722,7 +725,8 @@ In either case, the output is inserted after point (leaving mark after it)."
722 (display-buffer buffer) 725 (display-buffer buffer)
723 (setq default-directory directory) 726 (setq default-directory directory)
724 (setq proc (start-process "Shell" buffer 727 (setq proc (start-process "Shell" buffer
725 shell-file-name "-c" command)) 728 shell-file-name
729 shell-command-switch command))
726 (setq mode-line-process '(":%s")) 730 (setq mode-line-process '(":%s"))
727 (set-process-sentinel proc 'shell-command-sentinel) 731 (set-process-sentinel proc 'shell-command-sentinel)
728 (set-process-filter proc 'shell-command-filter) 732 (set-process-filter proc 'shell-command-filter)
@@ -800,7 +804,7 @@ In either case, the output is inserted after point (leaving mark after it)."
800 ;; unless called interactively. 804 ;; unless called interactively.
801 (and interactive (push-mark)) 805 (and interactive (push-mark))
802 (call-process-region start end shell-file-name t t nil 806 (call-process-region start end shell-file-name t t nil
803 "-c" command) 807 shell-command-switch command)
804 (let ((shell-buffer (get-buffer "*Shell Command Output*"))) 808 (let ((shell-buffer (get-buffer "*Shell Command Output*")))
805 (and shell-buffer (not (eq shell-buffer (current-buffer))) 809 (and shell-buffer (not (eq shell-buffer (current-buffer)))
806 (kill-buffer shell-buffer))) 810 (kill-buffer shell-buffer)))
@@ -820,7 +824,7 @@ In either case, the output is inserted after point (leaving mark after it)."
820 (delete-region (point-min) start) 824 (delete-region (point-min) start)
821 (call-process-region (point-min) (point-max) 825 (call-process-region (point-min) (point-max)
822 shell-file-name t t nil 826 shell-file-name t t nil
823 "-c" command) 827 shell-command-switch command)
824 (setq success t)) 828 (setq success t))
825 ;; Clear the output buffer, then run the command with output there. 829 ;; Clear the output buffer, then run the command with output there.
826 (save-excursion 830 (save-excursion
@@ -829,7 +833,7 @@ In either case, the output is inserted after point (leaving mark after it)."
829 (erase-buffer)) 833 (erase-buffer))
830 (call-process-region start end shell-file-name 834 (call-process-region start end shell-file-name
831 nil buffer nil 835 nil buffer nil
832 "-c" command) 836 shell-command-switch command)
833 (setq success t)) 837 (setq success t))
834 ;; Report the amount of output. 838 ;; Report the amount of output.
835 (let ((lines (save-excursion 839 (let ((lines (save-excursion