Author steven.daprano
Recipients belopolsky, cben, eric.araujo, ezio.melotti, flox, giampaolo.rodola, larry, lesmana, loewis, mark.dickinson, ned.deily, pitrou, python-dev, r.david.murray, ronaldoussoren, serhiy.storchaka, steven.daprano, techtonik, tshepang
Date 2013-07-31.08:04:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <51F8C4F5.6020506@pearwood.info>
In-reply-to <1375254853.62.0.149911365749.issue5845@psf.upfronthosting.co.za>
Content
On 31/07/13 17:14, Larry Hastings wrote:

> IMO the optimal solution is that tab preceded by only whitespace indents, and tab preceded by any non-whitespace character attempts to complete.  Can we goad readline into behaving this way?

Yes we can. Attached are a pair of lightweight modules I've used for this for the last 3-4 years, and it works fine in Python 2.4 through 3.3. I put something like this in my startup.py:

import completer
import history
history = history.History()
completer = completer.Completer(
         bindings=(r'"\C-xo": overwrite-mode',
                   r'"\C-xd": dump-functions',
                  ))

Originally they were in a single class, but I was persuaded that it was cleaner to separate them.
Files
File name Uploaded
completer.py steven.daprano, 2013-07-31.08:04:13
history.py steven.daprano, 2013-07-31.08:04:13
History
Date User Action Args
2013-07-31 08:04:15steven.dapranosetrecipients: + steven.daprano, loewis, ronaldoussoren, mark.dickinson, cben, belopolsky, pitrou, larry, techtonik, giampaolo.rodola, ned.deily, ezio.melotti, eric.araujo, r.david.murray, flox, lesmana, tshepang, python-dev, serhiy.storchaka
2013-07-31 08:04:14steven.dapranolinkissue5845 messages
2013-07-31 08:04:14steven.dapranocreate