@findex comint-run
You can use @kbd{M-x comint-run} to execute any program of your choice
in a subprocess using unmodified Comint mode---without the
-specializations of Shell mode.
+specializations of Shell mode. To pass arguments to the program, use
+@kbd{C-u M-x comint-run}.
@node Shell Prompts
@subsection Shell Prompts
from the beginning of the arguments, while the latter counts from the
end.
++++
+*** 'comint-run' can now accept a list of switches to pass to the program.
+'C-u M-x comint-run' will prompt for the switches interactively.
+
** SQL
*** SQL Indent Minor Mode
(apply #'make-comint-in-buffer name nil program startfile switches))
;;;###autoload
-(defun comint-run (program)
- "Run PROGRAM in a Comint buffer and switch to it.
+(defun comint-run (program &optional switches)
+ "Run PROGRAM in a Comint buffer and switch to that buffer.
+
+If SWITCHES are supplied, they are passed to PROGRAM. With prefix argument
+\\[universal-argument] prompt for SWITCHES as well as PROGRAM.
+
The buffer name is made by surrounding the file name of PROGRAM with `*'s.
The file name is used to make a symbol name, such as `comint-sh-hook', and any
hooks on this symbol are run in the buffer.
+
See `make-comint' and `comint-exec'."
(declare (interactive-only make-comint))
- (interactive "sRun program: ")
+ (interactive
+ (list (read-string "Run program: ")
+ (and (consp current-prefix-arg)
+ (split-string-and-unquote (read-string "Switches: ")))))
(let ((name (file-name-nondirectory program)))
- (switch-to-buffer (make-comint name program))
+ (switch-to-buffer (apply #'make-comint name program nil switches))
(run-hooks (intern-soft (concat "comint-" name "-hook")))))
(defun comint-exec (buffer name command startfile switches)