unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: daniel <idnael@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: pymacs
Date: Mon, 10 Jun 2013 14:12:13 +0100	[thread overview]
Message-ID: <CABX3oxbUtNQnF-WjBnr8fPmEG4r5jXdZAUVWCjxkejVYm++Mdw@mail.gmail.com> (raw)
In-Reply-To: <CABX3oxahBOQ2J5ARobrDCwKKPQBZOR5nHRywLCV0MKNtvGraPQ@mail.gmail.com>

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 <idnael@gmail.com>

>
>
>
> 2013/6/10 Eric Abrahamsen <eric@ericabrahamsen.net>
>
>>
>> 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.
>
>
>
>
>
>
>


  reply	other threads:[~2013-06-10 13:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-09 19:35 pymacs daniel
2013-06-09 22:19 ` pymacs andrea crotti
2013-06-09 22:37   ` pymacs daniel
2013-06-10  3:13     ` pymacs Eric Abrahamsen
2013-06-10 10:54       ` pymacs daniel
2013-06-10 13:12         ` daniel [this message]
2013-06-10 13:37           ` pymacs Eric Abrahamsen
2013-06-10 17:50             ` pymacs daniel
2013-06-10 18:03               ` pymacs Andreas Röhler
2013-06-10 22:43                 ` pymacs Kyle Machulis
2013-06-16 20:38                   ` pymacs daniel
2013-06-10  5:20 ` pymacs Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABX3oxbUtNQnF-WjBnr8fPmEG4r5jXdZAUVWCjxkejVYm++Mdw@mail.gmail.com \
    --to=idnael@gmail.com \
    --cc=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).