unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* pymacs & interactivel isp functions
@ 2008-11-19 16:16 Matt Price
  2008-11-19 17:37 ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2008-11-19 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

hi,

still having trouble with my interactive query to evolution.  python has
evolution bindings so i thought it would be nice to integrate python and
emacs using pymacs.  i'm running into an issuethat i think is pymacs'
fault, i'm hoping someone on the list uses pymacs and can help.  

i wrote this little python function, which returns a list of names and
addresses:


def return_addresslist (queryterm):
    results = abook.search(queryterm)
    names =[]
    for record in results:
        name = str(record.get_name())
        print type(name)
        address = str(record.get_property('email_1'))
        names.append(name + " " + "<" + address +">")
        for i in ["2","3"]:
            if record.get_property('email_' + i):
                 address = record.get_property('email_' + i)
                 record.get_property('email_' + i)
                 names.append(name + ' '+ "<" + address +">")
    return names

then in an elisp file, i try e.g.:
(pymacs-load "edsquery")
(setq collection (edsquery-return-addresslist "matt"))

which assigns this value to collection:
("Matt Price <matt.price@utoronto.ca>" "Matt Price <moptop99@gmail.com>" "Matthew Garrett <mjg59@srcf.ucam.org>" "Matt Zimmerman <mdz@canonical.com>" "Matt Fontaine <Matty_fontaine@hotmail.com>" "Matt Wilks <matt@madhaus.cns.utoronto.ca>" "Matthew Yates <myatesmyates@yahoo.com>" "Matthew Flaschen <matthew.flaschen@gatech.edu>" "Matthew Vermeulen <MattVermeulen@gmail.com>" "Matthew East <matt@mdke.org>" "matthewreedy <matthewreedy@yahoo.com>" "Matthias Dörries <matthias.doerries@gersulp.u-strasbg.fr>" ...)

my problem comes with a test function that triesto use the results of a
query as a collection for tab-completion:

(defun matt/external-addressbook-completion (stub)
"get a list of addresses for tab-completion in a new email"
  (interactive (list (completing-read "Name: "
				      (edsquery-return-addresslist (string))
;;				      collection
				      nil t))))

the function works properly if i use the list "collection" generated as
above, but does not give any completion options if the python function
is called instead.  

in the *Pymacs* buffer i noticesomething that seems important.  when i
call the python function direction with (edsquery-python-addressbook
"matt), i have this message:
>23	eval python[1]("matt")
[]
<600 (return '("Matt Price <matt.price@utoronto.ca>" "Matt Price <moptop99@gmail.com>" "Matthew Garrett <mjg59@srcf.ucam.org>" "Matt Zimmerman <mdz@canonical.com>" "Matt Fontaine <Matty_fontaine@hotmail.com>" "Matt Wilks <matt@madhaus.cns.utoronto.ca>" "Matthew Yates <myatesmyates@yahoo.com>" "Matthew Flaschen <matthew.flaschen@gatech.edu>" "Matthew Vermeulen <MattVermeulen@gmail.com>" "Matthew East <matt@mdke.org>" "matthewreedy <matthewreedy@yahoo.com>" "Matthias D\303\266rries <matthias.doerries@gersulp.u-strasbg.fr>" "Matt Davey <mcdavey@mrao.cam.ac.uk>" "Matt Price <matt.price@utoronto.ca>"))

but when calling from completing-read, i get this instead:

>19	eval python[1]("")
[]
<14	(return 'nil)

to me it seems that the completion function isn't being sent the input
string.  but i can't understand why this should be, as identical syntax
works with straight lisp functions.  
-- 
Matt Price
matt.price@utoronto.ca




^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <mailman.747.1227111401.26697.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2008-11-22 21:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19 16:16 pymacs & interactivel isp functions Matt Price
2008-11-19 17:37 ` Drew Adams
2008-11-22  8:39   ` Matt Price
2008-11-22 15:27     ` Kevin Rodgers
2008-11-22 15:27     ` Drew Adams
2008-11-22 21:07       ` Matt Price
2008-11-22 21:45         ` Drew Adams
     [not found] <mailman.747.1227111401.26697.help-gnu-emacs@gnu.org>
2008-11-20 19:48 ` Greg Detre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).