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

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

break a chunk of text into a list of lines


From: Matt Price
Subject: break a chunk of text into a list of lines
Date: Fri, 14 Nov 2008 08:24:30 -0500

On Thu, 2008-11-13 at 07:50 -0800, Xah wrote:

> Can you make your question into one specific question?
> 
> if you can make just one specific question, as much as possible to
> your problem, it's likely to get much useful replies.
> 
> from scanning several replies, here's what i think might be helpful.
> 
> if you want to write elisp to call some other script and process the
> result, it's fairly easy. If you can be specific about what command
> you want to call and how you want to parse the result, we can help
> better.
> 
> The following tutorial will probably help:
> 
> • Elisp Wrapper For Perl Scripts
> http://xahlee.org/emacs/elisp_perl_wrapper.html
> (you can use your existing knowledge of a scripting lang and turn them
> into elisp command)
> 
> • Elisp Lesson: Writing image-linkify Function
> http://xahlee.org/emacs/elisp_image_tag.html
> (contains example of calling external script and process its result)
> 

Xah,

thanks for the helpful links -- also thanks to other folks who have been
helping on this thread.  I think i have two questions, so i'll write
them in two seperate emails.

I have a python script that queries my evolution database and returns a
series of lines, with one address per line:

address@hidden:~$ python evo-query.py matt
 14 matches in 874 entries
address@hidden  Matthew East
address@hidden  Matt Price
address@hidden Matt Price
address@hidden Matt Zimmerman
address@hidden Matt Fontaine
address@hidden  Matt Price
address@hidden Matthew Garrett
address@hidden  Matthew Yates
address@hidden Matthias Dörries
address@hidden Matthew Flaschen
address@hidden  Matt Davey
address@hidden Matt Wilks
address@hidden  Matthew Vermeulen
address@hidden  matthewreedy

(note the not-so-well-maintained duplicates!)

i've written a short function based on one of your examples that grabs
this output -- i imagine it needs some fixing up, but here it is:
(defun query-python-addressbook (name)
  (interactive "s To:" )
  (setq cmd-name "python /home/matt/evo-query.py")
  (setq sh-output (shell-command-to-string (concat cmd-name " " name)))
  (message "%s" sh-output)
  )

(query-python-addressbook "matt") now returns a message with the this
text.  instead i'd like it to return a list of names.  i'm sure someone
will point me to the right info node, but i'm having some difficulty
navigating the immense amounts of documentation -- is there a simple way
to take each line of a text block and turn it into a list of lines?  

thanks much! -- second quesiton to follow...

matt





>   Xah
>http://xahlee.org/
> 
>
-- 
Matt Price
address@hidden




reply via email to

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