help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing an interactive function to accept a string argument, then ca


From: Kevin Rodgers
Subject: Re: Writing an interactive function to accept a string argument, then call a Python script?
Date: Mon, 12 Feb 2007 23:20:33 -0700
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)

Endless Story wrote:
On Feb 10, 8:49 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> 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.

Yep.

Boy, lisp is SO different than anything else I'm used to ...

In a a good way, I'm sure, unless you're used to modern functional
languages.

(defun wl-psb (searchname)
    (interactive"MName to search for, double-quoted: ")
    (shell-command (concat "python c:/cygwin/home/texas/name_search.py
" searchname)))

Just curious: Is the `M' interactive code necessary in your experience?
I've always just used `s'.

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]