Pymacs problem

Alberto Griggio albgrig at tiscalinet.it
Thu Oct 21 15:43:05 EDT 2004


On Thu, 21 Oct 2004 10:56:09 -0500, Skip Montanaro wrote:

> I'm trying to use the Pymacs bridge to add a symbol completion facility to
> Emacs's python-mode. 

This sound quite cool! :-)


> What do I need to do to convert that object into a true Python list of
> strings?  I'm afraid I don't quite understand the description of the lisp
> object in the Pymacs docs.  I tried imports.value() but that just gave me
> 
>     (aref pymacs-lisp 0)
> 
> Any help appreciated...
> 

Disclaimer: so far I've only played with Pymacs a little bit, I'm by no 
means an expert. Anyway, from the manual:

"""
Proper Emacs Lisp lists, those for which the cdr of last cell is nil, are
normally transmitted opaquely to Python. If pymacs-forget-mutability is
set, or if Python later asks for these to be expanded, proper Emacs Lisp
lists get converted into Python lists, if we except the empty list, which
is always converted as Python None. In the other direction, Python lists
are always converted into proper Emacs Lisp lists.
"""

So, maybe try

    (defun py-complete ()
      (interactive)
      (let ((pymacs-forget-mutability t)) 
	(pycomplete-pycomplete (py-symbol-near-point)
                               (py-find-global-imports))))

HTH,
Alberto







More information about the Python-list mailing list