From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: Generalize start-process with keyword args Date: Tue, 17 Mar 2015 22:04:26 +0000 Message-ID: <86k2yfwaad.fsf@gmail.com> References: <87d24d3uwz.fsf-ueno@gnu.org> <86a8zc21ua.fsf@gmail.com> <83oanszq6u.fsf@gnu.org> <8661a01stb.fsf@gmail.com> <83egooyu08.fsf@gnu.org> <86oanrwdhb.fsf@gmail.com> <83lhivxr42.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426629909 18246 80.91.229.3 (17 Mar 2015 22:05:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Mar 2015 22:05:09 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 17 23:04:57 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YXzbc-00076q-95 for ged-emacs-devel@m.gmane.org; Tue, 17 Mar 2015 23:04:56 +0100 Original-Received: from localhost ([::1]:57238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXzbb-00024e-Fb for ged-emacs-devel@m.gmane.org; Tue, 17 Mar 2015 18:04:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXzbO-00024X-JT for emacs-devel@gnu.org; Tue, 17 Mar 2015 18:04:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXzbK-0007iZ-I3 for emacs-devel@gnu.org; Tue, 17 Mar 2015 18:04:42 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:33802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXzbK-0007iP-BG for emacs-devel@gnu.org; Tue, 17 Mar 2015 18:04:38 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YXzbH-0006vp-Oh for emacs-devel@gnu.org; Tue, 17 Mar 2015 23:04:35 +0100 Original-Received: from 82-69-64-228.dsl.in-addr.zen.co.uk ([82.69.64.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Mar 2015 23:04:35 +0100 Original-Received: from andrewjmoreton by 82-69-64-228.dsl.in-addr.zen.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Mar 2015 23:04:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 82-69-64-228.dsl.in-addr.zen.co.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) Cancel-Lock: sha1:wC/jbg+g+nb5Cse82pa6nNyi4/A= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183976 Archived-At: On Wed 18 Mar 2015, Eli Zaretskii wrote: >> From: Andy Moreton >> Date: Tue, 17 Mar 2015 20:55:28 +0000 >> >> A simple example is using the cscope package from Cygwin. This installs >> a cscope executable, a cscope-indexer script and cscope.el that uses the >> cscope indexes for symbol lookup. cscope.el can also invoke the indexer >> script to regenerate the indexes (by invoking `cscope-indexing-script' >> with arguments via `start-process'). >> >> This script can easily be reused without modification, by advising >> `start-process to rework its arguments: cahnge PROGRAM to be "bash" and >> prepend "-c" to the PROGRAM-ARGS list. This allows cscope.el to invoke >> the original script from a Win32 emacs build without needing any changes >> to the original package. > > So how you suggest this to work? Should such scripts be treated as > executable only if the interpreter they require is on PATH, and > otherwise be treated as non-executable? Or should we always treat > them as executables, and let them fail if the interpreter is not > available? Or should we require that a script that says > > #! /usr/local/bin/perl > > is run by "/usr/local/bin/perl", and nothing else? > > What about scripts that say > > #! /usr/bin/env perl > > should we run 'env' for them, too? > > And what about MSYS mounting of Windows directories, whereby /bin/bash > resolves to something like C:\MSYS\1.0\bin\bash.exe (of which Emacs > has no idea)? > > I see a lot of complications with the semantics of this, and no easy > solutions, since the necessary tools are not available on Windows, > could be installed in any directory, and come with a set of > assumptions that don't necessarily play well with a native Emacs. I agree that this is awkward. What I envisaged was an (optional) alist of (REGEXP . (INTERPRETER INTERPRETER-ARGS)) pairs such that if start-process is onvoked for a PROGRAM that matches REGEXP, then use INTERPRETER as the PROGRAM argument to start-process, and prepend INTERPRETER-ARGS to the PROGRAM-ARGS list. E.g. (start-process name buffer "/path/to/script" "foo" "bar" "baz") and assuming something like: (setq start-process-interpreter-alist '(("/path/to/script" . ("/path/to/shell" "-c"))) would result in behaviour equivalent to: (start-process name buffer "/path/to/shell" "-c" "/path/to/script" "foo" "bar" "baz") >> > But what shell would be able to interpret such scripts on Windows? >> > AFAIK, there are no good candidates for that role. >> >> A shell from cygwin, msys2 or msys. > > They are all subtly incompatible with a native Emacs, both in the > file-name syntax and in how they treat I/O. Agreed. The filenames can be massaged (e.g. cygwin-mount.el), and other issues can be ameliorated by using a different shell (or arguments) for different tools. AndyM