all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <eqrlbf$age$1@sea.gmane.org> (raw)
In-Reply-To: <1171105054.246773.140640@p10g2000cwp.googlegroups.com>

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	other threads:[~2007-02-13  6:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-09 13:08 Writing an interactive function to accept a string argument, then call a Python script? Endless Story
2007-02-09 14:18 ` Stack
2007-02-10  8:49 ` Kevin Rodgers
     [not found] ` <mailman.4285.1171097378.2155.help-gnu-emacs@gnu.org>
2007-02-10 10:57   ` Endless Story
2007-02-13  6:20     ` Kevin Rodgers [this message]
     [not found]     ` <mailman.4406.1171347657.2155.help-gnu-emacs@gnu.org>
2007-02-13 11:21       ` Endless Story
2007-02-14 17:32         ` Edward Dodge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='eqrlbf$age$1@sea.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.