From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.help Subject: Re: Split string into shell words? Date: Wed, 28 Jan 2004 09:37:18 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87brooeaf5.fsf@emptyhost.emptydomain.de> References: <87broy5zjp.fsf@emptyhost.emptydomain.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1075279639 30652 80.91.224.253 (28 Jan 2004 08:47:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2004 08:47:19 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 28 09:47:14 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AllLu-00074w-00 for ; Wed, 28 Jan 2004 09:47:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AllKJ-0002dq-Uj for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jan 2004 03:45:35 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!213-203-244-156.kunde.vdserver.DE!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: 213-203-244-156.kunde.vdserver.de (213.203.244.156) Original-X-Trace: news.uni-berlin.de 1075279020 25951092 213.203.244.156 ([73968] 10430) User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:27t9rCklNjZTqbtqO29Lg/trWbA= Original-Xref: shelby.stanford.edu gnu.emacs.help:120494 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16440 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16440 Stefan Monnier writes: > It's pretty nasty to do it right: > > foo "bar $(baz "toto") titi" > > should turn into "foo" "bar $(baz \"toto\") titi". > What do you need this for ? I want to make it so that typing "vi foo" at the shell prompt (as in M-x shell) does like C-x C-f foo RET. Thus, I wrote shell-integration.el (posted to gnu.emacs.sources). The mode looks whether it knows the command typed as the first word on the line and then invokes a lisp function, if so. I thought it would be good if that lisp function received a list of arguments. That's why I wanted to split the current command line into words. Now I have used the following workaround: each such lisp function receives only a single string as its arg, which is the whole command line. The lisp functions then (normally) use the comint-arguments function to extract the words they need. Hm. It seems that my approach was too simple-minded, as I can't say "vi $(uname)" -- this will try to edit a file called "$(uname)" rather than editing a file called "Linux". So I guess I need to pass the command to the shell for expansion first, then pass the result to the Lisp function. Kai