[IPython-user] python-mode tab completion problem

John Barnard barnarj at ccf.org
Fri Dec 30 09:40:33 CST 2005


Fernando Perez <Fernando.Perez <at> colorado.edu> writes:

> I can confirm that a simple
> 
> (require 'ipython)
> 
> is all I need under XEmacs for this to work as expected, including tab
> completions showing up in a normal emacs completions buffer.
> 
> I'm sure getting this to work with regular emacs is perfectly possible, it's
> just that I can't seem to find the magic incantation for that.
> 
> Cheers,
> 
> f
> 

To get tab completion working with GNU Emacs 23 (I'm using a
pre-release Cocoa build), I commented out the following three
lines in the complete method of the IPCompleter class in
completer.py:

if not self.get_line_buffer().strip():
        self.readline.insert_text('\t')
        return None

Using pdb within IPython (within Emacs), I found that the
self.get_line_buffer() call was returning the empty string,
hence, the complete method returned before do any completion
lookups. This code doesn't seem to serve a crucial function;
terminal-based ipython runs fine except it now prompts you when
you hit tab on an empty line -- the commented code gets rid of
the prompt. Basically, the commented code only works properly
with readline, which isn't used when running ipython within
Emacs.

Note I'm using the latest IPython from SVN.

Best,

John Barnard






More information about the IPython-user mailing list