From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Endless Story" Newsgroups: gmane.emacs.help Subject: Re: Writing an interactive function to accept a string argument, then call a Python script? Date: 10 Feb 2007 02:57:34 -0800 Organization: http://groups.google.com Message-ID: <1171105054.246773.140640@p10g2000cwp.googlegroups.com> References: <1171026496.713032.169290@v33g2000cwv.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1171107645 18677 80.91.229.12 (10 Feb 2007 11:40:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 10 Feb 2007 11:40:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 10 12:40:38 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HFqar-0002ek-5b for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Feb 2007 12:40:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HFqaq-0007BU-DN for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Feb 2007 06:40:36 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!postnews.google.com!p10g2000cwp.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 19 Original-NNTP-Posting-Host: 162.84.222.82 Original-X-Trace: posting.google.com 1171105070 1286 127.0.0.1 (10 Feb 2007 10:57:50 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 10 Feb 2007 10:57:50 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.02 (X11; Linux i686; U; en),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: p10g2000cwp.googlegroups.com; posting-host=162.84.222.82; posting-account=JP8pbg0AAADYDr61n41ZYs45c0xuivey Original-Xref: shelby.stanford.edu gnu.emacs.help:145456 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:41060 Archived-At: On Feb 10, 8:49 am, Kevin Rodgers wrote: > Endless Story wrote: > (defun trivial-but-reasonably-valuable (string-to-match) > (interactive "sMatch: ") > (shell-command (format "/home/me/myscript.py %s" > (shell-quote-argument string-to-match)))) Thanks! Below is what I ended up writing (after only 90 minutes of Googling!!) - now I'm going to try your suggestion of adding shell- quote-argument (which I gather from the doco does nice things like escape characters as necessary). Maybe it will obviate the need to remind the user (me) to use double quotes around multi-word input. Boy, lisp is SO different than anything else I'm used to ... (defun wl-psb (searchname) (interactive"MName to search for, double-quoted: ") (shell-command (concat "python c:/cygwin/home/texas/name_search.py " searchname)))