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: Sat, 10 Feb 2007 01:49:15 -0700
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)

Endless Story wrote:
I have hacked out a Python script to do something trivial but
reasonably valuable to me (search a bunch of files for a matching
string pulled from another file). Well, okay, now I want to call this
script from the Emacs minibuffer ... but my understanding of lisp is
pretty poor, which is why I wrote the script in Python to begin with!
(took me a couple of hours instead of a month).

Can anyone give me a simple recipe for an interactive function that
will do the following:

1) In the minibuffer, prompt me for a string to enter.
2) Feed the string as the sole argument to the Python script (let's
say it's at /home/me/myscript.py).
3) Display the return value in the minibuffer


(defun trivial-but-reasonably-valuable (string-to-match)
  (interactive "sMatch: ")
  (shell-command (format "/home/me/myscript.py %s"
                         (shell-quote-argument string-to-match))))

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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