diff options
| author | Phil Sainty | 2019-07-11 17:33:12 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-11 18:27:12 +0200 |
| commit | 2daeea78335f4dbfd4d61fd3e179b41b48922104 (patch) | |
| tree | 6f2a66118b41828f3214651ae9c357f0a3b530ac | |
| parent | aecc82d7eb776985927bee3f62c5811cc4fc7b52 (diff) | |
| download | emacs-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.texi | 3 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/comint.el | 16 |
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 |
| 1101 | in a subprocess using unmodified Comint mode---without the | 1101 | in a subprocess using unmodified Comint mode---without the |
| 1102 | specializations of Shell mode. | 1102 | specializations 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 |
| @@ -754,6 +754,10 @@ better emulate 'M-.' in both Bash and zsh, since the former counts | |||
| 754 | from the beginning of the arguments, while the latter counts from the | 754 | from the beginning of the arguments, while the latter counts from the |
| 755 | end. | 755 | end. |
| 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 | |||
| 766 | If SWITCHES are supplied, they are passed to PROGRAM. With prefix argument | ||
| 767 | \\[universal-argument] prompt for SWITCHES as well as PROGRAM. | ||
| 768 | |||
| 765 | The buffer name is made by surrounding the file name of PROGRAM with `*'s. | 769 | The buffer name is made by surrounding the file name of PROGRAM with `*'s. |
| 766 | The file name is used to make a symbol name, such as `comint-sh-hook', and any | 770 | The file name is used to make a symbol name, such as `comint-sh-hook', and any |
| 767 | hooks on this symbol are run in the buffer. | 771 | hooks on this symbol are run in the buffer. |
| 772 | |||
| 768 | See `make-comint' and `comint-exec'." | 773 | See `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) |