summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorPhil Sainty <psainty@orcon.net.nz>2019-07-11 17:33:12 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-07-11 18:27:12 +0200
commit2daeea78335f4dbfd4d61fd3e179b41b48922104 (patch)
tree6f2a66118b41828f3214651ae9c357f0a3b530ac /lisp/comint.el
parentaecc82d7eb776985927bee3f62c5811cc4fc7b52 (diff)
downloademacs-2daeea78335f4dbfd4d61fd3e179b41b48922104.tar.gz
emacs-2daeea78335f4dbfd4d61fd3e179b41b48922104.tar.bz2
emacs-2daeea78335f4dbfd4d61fd3e179b41b48922104.zip
Support program switches in 'comint-run' command
* etc/NEWS: * doc/emacs/misc.texi: Describe new behaviour (bug#33037). * lisp/comint.el (comint-run): Add optional SWITCHES argument. With prefix argument C-u, prompt for SWITCHES.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 55e64865a27..049e9e71a79 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -760,16 +760,24 @@ Returns the (possibly newly created) process buffer."
(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)