Setting up pycomplete.el

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting up pycomplete.el

Jeffrey Spencer
I am trying to setup pycomplete.el on my system. I had two questions
about it:

1) Can it be integrated with auto-complete and has anyone done this
before and has some tips?? Or how do you get access to the list of
available completions. The display of completions available doesn't seem
to work or get passed back to the completions buffer like it is supposed
to. No *completions* buffer is ever created. I think this list could
also be used as a source in autocomplete.

2) How do I set it so whenever it does expand the symbol at the point it
performs a (indent-for-tab-command). I have this right now working but
the only way I can figure it out is that everytime the function is run
it doesn't which isn't desired. This is temporary until I had figured
out how to work into autocomplete.

Thanks for any help,

Jeff

--
________________________
Jeffrey Spencer
[hidden email]

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: Setting up pycomplete.el

Andreas Röhler-2
Am 07.11.2011 22:13, schrieb Jeffrey Spencer:
> I am trying to setup pycomplete.el on my system. I had two questions
> about it:
>
> 1) Can it be integrated with auto-complete and has anyone done this
> before and has some tips??

Hi,

AFAIK it should not interfere with auto-complete.el
However, these will be two different approaches.
py-complete will not come into action by themselves, only when called.

BTW current python-mode.el trunk offers customizable alternatives to
py-complete, the choice selected always on M-TAB.

Or how do you get access to the list of
> available completions. The display of completions available doesn't seem
> to work or get passed back to the completions buffer like it is supposed
> to. No *completions* buffer is ever created. I think this list could
> also be used as a source in autocomplete.

Yes, it could. But it's more complex yet due to limits of auto-complete,
which still isn't perfect for Python modes IMO.

A question is, what the resources of completion are and how to get them.


> 2) How do I set it so whenever it does expand the symbol at the point it
> performs a (indent-for-tab-command). I have this right now working but
> the only way I can figure it out is that everytime the function is run
> it doesn't which isn't desired. This is temporary until I had figured
> out how to work into autocomplete.

Have only a faintly impression what that last section means. What "it"
in the first sentence relies to?

May you write a bug-report for this?

BTW you could help development by filing you different questions and
consideration in suitable slots at

https://answers.launchpad.net/python-mode

https://blueprints.launchpad.net/python-mode/+spec/context-sensitive-completion

Should you must be a member of the team for this, that should be easy to
activate.

Thanks back,

Andreas

>
> Thanks for any help,
>
> Jeff
>

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: Setting up pycomplete.el

Andreas Röhler-2
Am 10.11.2011 05:59, schrieb Jeffrey Spencer:
> Added them in with the code below to help provide an explanation for the
> last example that you didn't quite understand. I hope it is clearer now.

yes, thanks
Well, that's a feature.

if autocomplete-related, as it's part already of PDEE, the most suitable
place for a request is here:

https://github.com/pdee/pdee/issues?sort=created&direction=desc&state=open

> I wasn't sure what the link for context-sensitive-dependant was for I
> didn't see where you could file a bug-report there.
>

in case of a Blueprint write to the whiteboard

that's an alternative to bug-reports making clear, it's an extension,
not a bug

> Also, a couple of suggestions possibly. I have the newest pycomplete()
> but I grabbed code from other sources not sure whether it was ever part
> of the official version which displays the help and signature of the
> classes,functions, etc.. if the functions are run.

could you mail me the complete code?
thanks

  There is electric
> version so it is done everytime a "(" is pressed. I don't think these
> are bad additions but was wondering why they are removed.

not sure if been ever part. Used skeleton electric paren stuff from
shipped python.el in components mode once, but had to de-activate, as in
the way it was implemented --maybe my own error-- it destroyed abbrevs
occasionally.

  They could
> easily have the keybindings removed and people set them if desired.
>

Please make a feature request in the bug-tracker

> Python-components-mode also looks good but couldn't give it a go because
> kept getting an error when trying to grab the branch:
> bzr: ERROR: Invalid url supplied to transport: "http://:0": No host
> component

bzr branch lp:~a-roehler/python-mode/components-python-mode

should do it

> but I'll give it a go soon when I get a chance.
>
>
> Cheers,
> Jeff
>
>
>
> (defun py-complete ()
> (interactive)
> (let* ((pymacs-forget-mutability t)
> (symbol (py-symbol-near-point))
> (completions
> (list (pycomplete-pycomplete symbol
> (py-find-global-imports)))))
> (cond ((null completions) ; no matching symbol
> (message "Can't find completion for \"%s\"" symbol)
> (ding))
> ((null (cdr completions)) ; sole completion
> (insert (car completions)))
> (t
> (message "Making completion list...")
> (with-output-to-temp-buffer "*PythonCompletions*"
> (display-completion-list completions))
> (message "Making completion list...%s" "done")))(indent-for-tab-command)))
>
> On 08/11/11 17:48, Andreas Röhler wrote:
>> Am 07.11.2011 22:13, schrieb Jeffrey Spencer:
>>> I am trying to setup pycomplete.el on my system. I had two questions
>>> about it:
>>>
>>> 1) Can it be integrated with auto-complete and has anyone done this
>>> before and has some tips??
>>
>> Hi,
>>
>> AFAIK it should not interfere with auto-complete.el
>> However, these will be two different approaches.
>> py-complete will not come into action by themselves, only when called.
>>
>> BTW current python-mode.el trunk offers customizable alternatives to
>> py-complete, the choice selected always on M-TAB.
>>
>> Or how do you get access to the list of
>>> available completions. The display of completions available doesn't seem
>>> to work or get passed back to the completions buffer like it is supposed
>>> to. No *completions* buffer is ever created. I think this list could
>>> also be used as a source in autocomplete.
>>
>> Yes, it could. But it's more complex yet due to limits of
>> auto-complete, which still isn't perfect for Python modes IMO.
>>
>> A question is, what the resources of completion are and how to get them.
>>
>>
>>> 2) How do I set it so whenever it does expand the symbol at the point it
>>> performs a (indent-for-tab-command). I have this right now working but
>>> the only way I can figure it out is that everytime the function is run
>>> it doesn't which isn't desired. This is temporary until I had figured
>>> out how to work into autocomplete.
>>
>> Have only a faintly impression what that last section means. What "it"
>> in the first sentence relies to?
>>
>> May you write a bug-report for this?
>>
>> BTW you could help development by filing you different questions and
>> consideration in suitable slots at
>>
>> https://answers.launchpad.net/python-mode
>>
>> https://blueprints.launchpad.net/python-mode/+spec/context-sensitive-completion
>>
>>
>> Should you must be a member of the team for this, that should be easy
>> to activate.
>>
>> Thanks back,
>>
>> Andreas
>>
>>>
>>> Thanks for any help,
>>>
>>> Jeff
>>>
>>
>> _______________________________________________
>> Python-mode mailing list
>> [hidden email]
>> http://mail.python.org/mailman/listinfo/python-mode
>

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode
Reply | Threaded
Open this post in threaded view
|

Re: Setting up pycomplete.el

Andreas Röhler-2
Am 10.11.2011 11:51, schrieb Jeffrey Spencer:

> Also a feature request if that code was implemented would be to make it
> work for example if you type:
>
> numpy.arange
>
> and then the hotkey for help it works. It doesn't function correctly in
> this case:
>
> numpy.arange(
>
> then hitting a hot-key now. This may have been something to do with
> electric function for "(" but I was planning on reimplementing so the
> help works either way. It detects first whether a "(" is the previous
> character or not. Then does completion from the prior if so. I assume
> this will work properly but haven't implemented it yet but should be
> trivial.
>
> Cheers,
> Jeff
>
>

could you make an entry in the bug-tracker?

Please indicate which python-mode version, resp. revision

thanks

_______________________________________________
Python-mode mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-mode