From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: daniel Newsgroups: gmane.emacs.help Subject: Re: pymacs Date: Mon, 10 Jun 2013 14:12:13 +0100 Message-ID: References: <877gi27j5h.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1370869971 3120 80.91.229.3 (10 Jun 2013 13:12:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Jun 2013 13:12:51 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Eric Abrahamsen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 10 15:12:52 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Um1tz-0003Ke-Hh for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jun 2013 15:12:51 +0200 Original-Received: from localhost ([::1]:43999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um1tz-0006FS-1Q for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jun 2013 09:12:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um1tn-0006F6-KL for help-gnu-emacs@gnu.org; Mon, 10 Jun 2013 09:12:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um1tj-0001Jw-8j for help-gnu-emacs@gnu.org; Mon, 10 Jun 2013 09:12:39 -0400 Original-Received: from mail-pb0-x22c.google.com ([2607:f8b0:400e:c01::22c]:61377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um1ti-0001Jd-V4 for help-gnu-emacs@gnu.org; Mon, 10 Jun 2013 09:12:35 -0400 Original-Received: by mail-pb0-f44.google.com with SMTP id uo1so2501980pbc.31 for ; Mon, 10 Jun 2013 06:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=DwoFqoT3b+5mKi1MGpAdLog1BoSnDBQwyQPSk0hHb/U=; b=OXRIV9XGrVseVlmMNj7RKuYKNBom8bGoQ6jwXPlzp6fwLIAqWV/VNK6d5B2sZzzCQe xVv5XzogNh5/EF0u/xzD5TojJ1vcn4nHmnhCDa6+Dj3mgF2moadqxJS/DHHKLiHglHzk M38VeKxHwq9kXzJeYh1vR+x9y44nfwffHlI3v6k6n54WCzWq5xj9FUog+wtaZdPcmk+z wJBpqPSCKNCTGlixI8Sdb60g539xnisdOQLz+gAxiS1a0Vln4/cI3fdju2CYRCLtnOzq Dj+5SzTlEAjDcxlThtyrGRWKtecHiR9IyyUKSTsXXPB5+XW2pYIrl4tMCqAtdZ4GcAAR uXLw== X-Received: by 10.66.159.168 with SMTP id xd8mr13796773pab.146.1370869954117; Mon, 10 Jun 2013 06:12:34 -0700 (PDT) Original-Received: by 10.70.55.69 with HTTP; Mon, 10 Jun 2013 06:12:13 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::22c X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91435 Archived-At: To put it more simple, the problem is when a python function returns a elisp symbol back to elisp: def teste(): symb = lisp.simbolo OR symb = lisp["simbolo"] OR symb = lisp("'simbolo") #str(symb) gives " 'simbolo " return symb When the function is invoked from elisp it doesn't return the symbol. I need this for a python program that creates an emacs menu. And the menu structure need to have these symbols that are the functions to be called when an menu item is selected. 2013/6/10 daniel > > > > 2013/6/10 Eric Abrahamsen > >> >> What else do you need to know? >> >> > In Ubuntu it is easy to install Pymacs because it is on the standard > repository. > > The question is about passing values from python and elisp and the > opposite way. > > # A function that receives a elisp variable name and returns it's value: > from pymacs import lisp > def tvar(n): > return lisp[n].value() > > > AND IN ELISP: > > (pymacs-load "pymacs_teste") > > (setq PTEST "string") > (pymacs-teste-tvar "PTEST") ;; returns "string" Ok! > > (setq PTEST (list 1 2 3)) > (pymacs-teste-tvar "PTEST") ;; returns (lambda (&rest arguments) > (pymacs-apply (quote (pymacs-python . 4543)) arguments)) > > When python calls lisp[n].value() it returns a kind of wrapper which works > well inside python. But if I return it back to elisp, it doesn't work. > > If I do instead > def tvar(n): > return list( lisp[n].value() ) > > It works perfectly. > > But I don't know what to do if PTEST contains a elisp symbol. > > > > > > >