aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sainty2019-07-11 17:33:12 +0200
committerLars Ingebrigtsen2019-07-11 18:27:12 +0200
commit2daeea78335f4dbfd4d61fd3e179b41b48922104 (patch)
tree6f2a66118b41828f3214651ae9c357f0a3b530ac
parentaecc82d7eb776985927bee3f62c5811cc4fc7b52 (diff)
downloademacs-2daeea78335f4dbfd4d61fd3e179b41b48922104.tar.gz
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.
-rw-r--r--doc/emacs/misc.texi3
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/comint.el16
3 files changed, 18 insertions, 5 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index cfc50d33b5f..9339626cc45 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1099,7 +1099,8 @@ the directory tracking feature, and a few user commands.
1099@findex comint-run 1099@findex comint-run
1100 You can use @kbd{M-x comint-run} to execute any program of your choice 1100 You can use @kbd{M-x comint-run} to execute any program of your choice
1101in a subprocess using unmodified Comint mode---without the 1101in a subprocess using unmodified Comint mode---without the
1102specializations of Shell mode. 1102specializations of Shell mode. To pass arguments to the program, use
1103@kbd{C-u M-x comint-run}.
1103 1104
1104@node Shell Prompts 1105@node Shell Prompts
1105@subsection Shell Prompts 1106@subsection Shell Prompts
diff --git a/etc/NEWS b/etc/NEWS
index 532babd0fa6..89111b1b7de 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -754,6 +754,10 @@ better emulate 'M-.' in both Bash and zsh, since the former counts
754from the beginning of the arguments, while the latter counts from the 754from the beginning of the arguments, while the latter counts from the
755end. 755end.
756 756
757+++
758*** 'comint-run' can now accept a list of switches to pass to the program.
759'C-u M-x comint-run' will prompt for the switches interactively.
760
757** SQL 761** SQL
758 762
759*** SQL Indent Minor Mode 763*** SQL Indent Minor Mode
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."
760 (apply #'make-comint-in-buffer name nil program startfile switches)) 760 (apply #'make-comint-in-buffer name nil program startfile switches))
761 761
762;;;###autoload 762;;;###autoload
763(defun comint-run (program) 763(defun comint-run (program &optional switches)
764 "Run PROGRAM in a Comint buffer and switch to it. 764 "Run PROGRAM in a Comint buffer and switch to that buffer.
765
766If SWITCHES are supplied, they are passed to PROGRAM. With prefix argument
767\\[universal-argument] prompt for SWITCHES as well as PROGRAM.
768
765The buffer name is made by surrounding the file name of PROGRAM with `*'s. 769The buffer name is made by surrounding the file name of PROGRAM with `*'s.
766The file name is used to make a symbol name, such as `comint-sh-hook', and any 770The file name is used to make a symbol name, such as `comint-sh-hook', and any
767hooks on this symbol are run in the buffer. 771hooks on this symbol are run in the buffer.
772
768See `make-comint' and `comint-exec'." 773See `make-comint' and `comint-exec'."
769 (declare (interactive-only make-comint)) 774 (declare (interactive-only make-comint))
770 (interactive "sRun program: ") 775 (interactive
776 (list (read-string "Run program: ")
777 (and (consp current-prefix-arg)
778 (split-string-and-unquote (read-string "Switches: ")))))
771 (let ((name (file-name-nondirectory program))) 779 (let ((name (file-name-nondirectory program)))
772 (switch-to-buffer (make-comint name program)) 780 (switch-to-buffer (apply #'make-comint name program nil switches))
773 (run-hooks (intern-soft (concat "comint-" name "-hook"))))) 781 (run-hooks (intern-soft (concat "comint-" name "-hook")))))
774 782
775(defun comint-exec (buffer name command startfile switches) 783(defun comint-exec (buffer name command startfile switches)