[IPython-dev] ipython/pydb integration - readline

Ville M. Vainio vivainio at gmail.com
Sun Oct 29 16:30:11 CST 2006


On 10/29/06, R. Bernstein <rocky at panix.com> wrote:

> 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.

pos_in_line is necessary because the cursor could be positioned like
this on the moment of pressing tab:

cp /var/lo[cursor] /home/foo

I thought passing the last "symbol" as convenience (in this example,
'/var/lo') could be handy, but it would bloat the hook too much.

I guess I'll pass a "Struct" object, where the hook would be:

def my_complete_symbol(event):
 print event.line, event.pos_in_line, event.symbol, event.command

(where 'command' would be the first word).

symbol and command are there purely for the convenience.

I think the completion hooks should be dispatchable by both of:

- Dictionary lookup with 'command' (for performance)
- Regexp (where the hooks with empty regexp are always tried).

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-dev mailing list