[IPython-dev] ipython/pydb integration - readline

R. Bernstein rocky at panix.com
Sun Oct 29 16:29:29 EST 2006

Ville M. Vainio writes:
 > On 10/29/06, R. Bernstein <rocky at panix.com> wrote:
 > >  > If this would require new functionality in the readline module
 > >
 > > As Ville has confirmed, the problem is not in the readline module(s)
 > > but in ipython's completion interface. If this has been addressed at
 > > the interface or API level in the chain-saw branch, I'd be interested
 > > to learn of that fact.
 > No need for chainsaw, I'll add a:
 > complete_symbol(line, pos_in_line) -> [completions]

I think this would suffice or at least go in the right direction.

For what it's worth, this was Alexander Schmolck's view on the matter:

  What should really happen IMO, is that ipython offer some sensible
  completion interface to editor-shells etc. that is agnostic of the
  mode (plain, p(y)db or whatever else the future may hold) and just
  take the whole command line so far and return the possible
  completions for the last word of that line. That would also make
  things like e.g. filename completion for contexts such as 
  possible (I'm pretty sure ipython outside of emacs already
  offers better context sensitive completion, although I never run
  ipython outside emacs).

So to reconcile these two views, basically the calling program would
have to find where the last "word" begins. Probably okay.

Looking to see how this matches the corresponding GNU Emacs interface
gud-gdb-complete-command() I see that that the routine picks out the
last word rather than being told where the last word starts. Since
finding word boundaries may be a little application specific, perhaps
passing in a position is not so bad. But maybe better though would to
make "pos_in_line" optional and use a default find last word search to
pick the word out.

Don't know. Just throwing all of this out for thought. 

More information about the IPython-dev mailing list