From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Matt Price <matt.price@utoronto.ca>
Newsgroups: gmane.emacs.help
Subject: pymacs & interactivel isp functions
Date: Wed, 19 Nov 2008 11:16:29 -0500
Organization: History Department, University of Toronto
Message-ID: <1227111389.17262.159.camel@localhost>
NNTP-Posting-Host: lo.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1227111443 7167 80.91.229.12 (19 Nov 2008 16:17:23 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 19 Nov 2008 16:17:23 +0000 (UTC)
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 19 17:18:24 2008
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
	by lo.gmane.org with esmtp (Exim 4.50)
	id 1L2pkp-0002AZ-Fw
	for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Nov 2008 17:18:12 +0100
Original-Received: from localhost ([127.0.0.1]:51100 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1L2pjg-000129-H3
	for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Nov 2008 11:17:00 -0500
Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1L2pjM-00011r-N3
	for help-gnu-emacs@gnu.org; Wed, 19 Nov 2008 11:16:40 -0500
Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1L2pjM-00011S-4J
	for help-gnu-emacs@gnu.org; Wed, 19 Nov 2008 11:16:40 -0500
Original-Received: from [199.232.76.173] (port=46742 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1L2pjL-00011C-Qj
	for help-gnu-emacs@gnu.org; Wed, 19 Nov 2008 11:16:39 -0500
Original-Received: from bureau60.ns.utoronto.ca ([128.100.132.147]:52687)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <matt.price@utoronto.ca>) id 1L2pjL-0003eR-Bw
	for help-gnu-emacs@gnu.org; Wed, 19 Nov 2008 11:16:39 -0500
Original-Received: from anarres.mercey.org
	(CPE001d7e1d5798-CM0014f8cd1c4c.cpe.net.cable.rogers.com
	[173.32.83.31]) (authenticated bits=0)
	by bureau60.ns.utoronto.ca (8.13.8/8.13.8) with ESMTP id mAJGGVmw030894
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <help-gnu-emacs@gnu.org>; Wed, 19 Nov 2008 11:16:37 -0500
Original-Received: by anarres.mercey.org (Postfix, from userid 1000)
	id E3F2712035D; Wed, 19 Nov 2008 11:16:30 -0500 (EST)
X-Mailer: Evolution 2.24.1 
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.help:59931
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/59931>

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. =20

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


def return_addresslist (queryterm):
    results =3D abook.search(queryterm)
    names =3D[]
    for record in results:
        name =3D str(record.get_name())
        print type(name)
        address =3D str(record.get_property('email_1'))
        names.append(name + " " + "<" + address +">")
        for i in ["2","3"]:
            if record.get_property('email_' + i):
                 address =3D 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>" "M=
atthew 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 <m=
atthew.flaschen@gatech.edu>" "Matthew Vermeulen <MattVermeulen@gmail.com>" =
"Matthew East <matt@mdke.org>" "matthewreedy <matthewreedy@yahoo.com>" "Mat=
thias D=C3=83=C2=B6rries <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. =20

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@ca=
nonical.com>" "Matt Fontaine <Matty_fontaine@hotmail.com>" "Matt Wilks <mat=
t@madhaus.cns.utoronto.ca>" "Matthew Yates <myatesmyates@yahoo.com>" "Matth=
ew Flaschen <matthew.flaschen@gatech.edu>" "Matthew Vermeulen <MattVermeule=
n@gmail.com>" "Matthew East <matt@mdke.org>" "matthewreedy <matthewreedy@ya=
hoo.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. =20
--=20
Matt Price
matt.price@utoronto.ca