From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: shell-quote-argument: make it behave as if on Unix? Date: Fri, 12 Apr 2002 14:46:19 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200204121846.g3CIkJc16875@rum.cs.yale.edu> References: <2950-Wed10Apr2002195652+0300-eliz@is.elta.co.il> <200204120311.g3C3Bjg22167@aztec.santafe.edu> <200204120409.g3C49h707814@rum.cs.yale.edu> <5567-Fri12Apr2002131610+0300-eliz@is.elta.co.il> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1018637308 26820 127.0.0.1 (12 Apr 2002 18:48:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 12 Apr 2002 18:48:28 +0000 (UTC) Cc: monnier+gnu/emacs@rum.cs.yale.edu, rms@gnu.org, Kai.Grossjohann@CS.Uni-Dortmund.DE, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16w65z-0006yT-00 for ; Fri, 12 Apr 2002 20:48:27 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16w6MN-0007Bl-00 for ; Fri, 12 Apr 2002 21:05:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16w65g-0003kp-00; Fri, 12 Apr 2002 14:48:08 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16w63x-0003g9-00; Fri, 12 Apr 2002 14:46:21 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g3CIkJc16875; Fri, 12 Apr 2002 14:46:19 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: "Eli Zaretskii" Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2591 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2591 > > From: "Stefan Monnier" > > Date: Fri, 12 Apr 2002 00:09:43 -0400 > > > > -(defun shell-quote-argument (argument) > > - "Quote an argument for passing as argument to an inferior shell." > > - (if (eq system-type 'ms-dos) > > +(defun shell-quote-argument (argument &optional shell-type) > > + "Quote an argument for passing as argument to an inferior shell. > > +SHELL-TYPE is the type of shell to which this will be passed. > > +It defaults to the value of `system-type'." > > + (unless shell-type (setq shell-type system-type)) > > + (if (eq shell-type 'ms-dos) > > This is what I had in mind, but I think `shell-type' is not a good > name for that argument, since without reading the source of the > function, I'd be tempted to use something like 'bash or 'command.com > there instead of ms-dos or windows-nt. I think system-type or os-type > is better. I also suggest to say in the doc string that the possible > values are those used in the system-type variable. I think what matters is the type of shell, so `shell-type' sounds better to me. But you're right that the docstring should list the known values, so as to remove any ambiguity. In any case, I even prefer Kim's solution of just documenting that it relies on `system-type' to decide what to do. Stefan PS: A `system-type' argument would not be a good idea, since I do not like using `defvar'd variables for arguments (it doesn't interact well with lexical scoping).