From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matt Price 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 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: 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 ) 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 ; 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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: 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 " "M= atthew Garrett " "Matt Zimmerman " = "Matt Fontaine " "Matt Wilks " "Matthew Yates " "Matthew Flaschen " "Matthew Vermeulen " = "Matthew East " "matthewreedy " "Mat= thias D=C3=83=C2=B6rries " ...) 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 " "Matthew Garrett " "Matt Zimmerman " "Matt Fontaine " "Matt Wilks " "Matthew Yates " "Matth= ew Flaschen " "Matthew Vermeulen " "Matthew East " "matthewreedy " "Matthias D\303\266rries = " "Matt Davey " "Matt Price ")) 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