From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 14 00:42:55 2018 Received: (at submit) by debbugs.gnu.org; 14 Oct 2018 04:42:55 +0000 Received: from localhost ([127.0.0.1]:48695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBYEw-0006Hy-UW for submit@debbugs.gnu.org; Sun, 14 Oct 2018 00:42:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gBYEv-0006Hk-AH for submit@debbugs.gnu.org; Sun, 14 Oct 2018 00:42:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBYEp-0008V4-6b for submit@debbugs.gnu.org; Sun, 14 Oct 2018 00:42:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gBYEp-0008V0-29 for submit@debbugs.gnu.org; Sun, 14 Oct 2018 00:42:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBYEn-0005q3-Tn for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 00:42:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBYEk-0008TO-NR for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 00:42:45 -0400 Received: from smtp-1.orcon.net.nz ([60.234.4.34]:41653) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gBYEk-0008Re-Bt for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 00:42:42 -0400 Received: from [150.107.172.16] (port=48208 helo=[192.168.20.103]) by smtp-1.orcon.net.nz with esmtpa (Exim 4.86_2) (envelope-from ) id 1gBYEe-0001wM-MO for bug-gnu-emacs@gnu.org; Sun, 14 Oct 2018 17:42:36 +1300 To: bug-gnu-emacs@gnu.org From: Phil Sainty Subject: 27.0.50; [PATCH] Support program switches in 'comint-run' command Message-ID: <4c421a8c-9b14-7981-f4bf-f4e6b33d2876@orcon.net.nz> Date: Sun, 14 Oct 2018 17:42:36 +1300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------CDCFF1A1B0D0B60585C8804B" Content-Language: en-GB X-GeoIP: NZ X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) This is a multi-part message in MIME format. --------------CDCFF1A1B0D0B60585C8804B Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit This patch enables arguments to be passed to the specified program when invoking `comint-run'. Interactively, a prefix argument C-u will make the command prompt for the switches (as a string) after prompting for the program. The switches are processed with `split-string-and-unquote'. I think this is a sensible enhancement, but not necessarily the best user interface. Other possibilities which occur are: 1. Do not require a prefix arg, and simply make this the default prompting behaviour. 2. Do not require a separate prompt, and instead parse the program and its switches out of a single string. Either of those would mean that the user doesn't need to bother with (or remember to use) a prefix argument to enable something which is arguably important enough to happen by default. Option (2) is an issue when PROGRAM contains spaces, as the user would now need to quote that value, which is not currently necessary. Maybe the benefits make that a worthwhile change, though? (i.e. greater ease of use for the 'normal' use-cases where the path to the program does not contain spaces). I suppose option (3) might be "all of the above", with a user option to select the preferred prompting behaviour, but that might be overkill. ...all of which reminds me that I've been meaning to write a similar patch to allow switches to be specified for the `term' and `ansi-term' commands, and a consistent approach in all cases would seem sensible; so that's something else to keep in mind. -Phil --------------CDCFF1A1B0D0B60585C8804B Content-Type: text/x-patch; name="0001-Support-program-switches-in-comint-run-command.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Support-program-switches-in-comint-run-command.patch" >From 3adc0be13880472e74b6015c6948046a25acdb9b Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Sun, 14 Oct 2018 15:54:05 +1300 Subject: [PATCH] Support program switches in 'comint-run' command * lisp/comint.el (comint-run): Add optional SWITCHES argument. With prefix argument C-u, prompt for SWITCHES. * etc/NEWS: * doc/emacs/misc.texi: Describe new behaviour. --- doc/emacs/misc.texi | 3 ++- etc/NEWS | 4 ++++ lisp/comint.el | 16 ++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 236cb07..fe397f7 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1088,7 +1088,8 @@ Shell Mode @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 diff --git a/etc/NEWS b/etc/NEWS index 946a823..d2b8bdb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -366,6 +366,10 @@ better emulate 'M-.' in both Bash and zsh, since the former counts 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 *** Installation of 'sql-indent' from ELPA is strongly encouraged. diff --git a/lisp/comint.el b/lisp/comint.el index 5928804..5be763e 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -759,16 +759,24 @@ make-comint (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) -- 2.8.3 --------------CDCFF1A1B0D0B60585C8804B-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 11 11:33:47 2019 Received: (at 33037) by debbugs.gnu.org; 11 Jul 2019 15:33:47 +0000 Received: from localhost ([127.0.0.1]:38409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlb4s-00048G-VY for submit@debbugs.gnu.org; Thu, 11 Jul 2019 11:33:47 -0400 Received: from quimby.gnus.org ([80.91.231.51]:56772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlb4q-000484-SM for 33037@debbugs.gnu.org; Thu, 11 Jul 2019 11:33:45 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hlb4m-0004uI-LU; Thu, 11 Jul 2019 17:33:43 +0200 From: Lars Ingebrigtsen To: Phil Sainty Subject: Re: bug#33037: 27.0.50; [PATCH] Support program switches in 'comint-run' command References: <4c421a8c-9b14-7981-f4bf-f4e6b33d2876@orcon.net.nz> Date: Thu, 11 Jul 2019 17:33:40 +0200 In-Reply-To: <4c421a8c-9b14-7981-f4bf-f4e6b33d2876@orcon.net.nz> (Phil Sainty's message of "Sun, 14 Oct 2018 17:42:36 +1300") Message-ID: <87pnmg37sb.fsf@mouse.gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Phil Sainty writes: > This patch enables arguments to be passed to the specified program when > invoking `comint-run'. > > Interactively, a prefix argument C-u will make the command prompt for > the switches (as a string [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 33037 Cc: 33037@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Phil Sainty writes: > This patch enables arguments to be passed to the specified program when > invoking `comint-run'. > > Interactively, a prefix argument C-u will make the command prompt for > the switches (as a string) after prompting for the program. The > switches are processed with `split-string-and-unquote'. > > I think this is a sensible enhancement, but not necessarily the best > user interface. Other possibilities which occur are: > > 1. Do not require a prefix arg, and simply make this the default > prompting behaviour. > > 2. Do not require a separate prompt, and instead parse the program > and its switches out of a single string. I think your patch makes sense as it is, so I've applied it to the Emacs trunk now. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 11 11:33:53 2019 Received: (at control) by debbugs.gnu.org; 11 Jul 2019 15:33:53 +0000 Received: from localhost ([127.0.0.1]:38412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlb4z-00048Z-7k for submit@debbugs.gnu.org; Thu, 11 Jul 2019 11:33:53 -0400 Received: from quimby.gnus.org ([80.91.231.51]:56786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlb4v-00048P-K6 for control@debbugs.gnu.org; Thu, 11 Jul 2019 11:33:51 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hlb4t-0004uP-0T for control@debbugs.gnu.org; Thu, 11 Jul 2019 17:33:49 +0200 Date: Thu, 11 Jul 2019 17:33:46 +0200 Message-Id: <87o92037s5.fsf@mouse.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #33037 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 33037 fixed close 33037 27.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 33037 fixed close 33037 27.1 quit From unknown Sun Jun 22 03:57:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 09 Aug 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator