[Pythonmac-SIG] readline support for OS X Leopard
emoy at apple.com
emoy at apple.com
Sat Oct 27 03:50:32 CEST 2007
It right there in my original message (and in the python man page).
You have to use EditLine syntax:
readline.parse_and_bind ("bind ^I rl_complete")
Ed
On Oct 26, 2007, at 6:46 PM, Noah Gift wrote:
> I was just going to say the same thing. Getting this to work and
> then GVim, and I will be quite happy.
>
> On 10/26/07, Boyd Waters < bwaters at nrao.edu> wrote:
> Oops, I spoke too soon when I said that readline support with
> Leopard's Python works for me with IPython.
>
> Many things DO work, but tab-completion does NOT.
>
> I am trying to get tab completion working.
>
> Forget IPython, just try this "unit test" of rlcompleter with the
> Python that ships with Leopard:
>
> See http://docs.python.org/lib/module-rlcompleter.html
>
> Launch python from a Terminal shell prompt.
> at the prompt, type the following commands:
> import rlcompleter
> import readline
> readline.parse_and_bind("tab: complete")
>
> Now, try it out: start some input, then hit the Tab key to get some
> possible completions:
>
> readline. <TAB PRESSED>
>
> The tab is passed as raw input, and the completer does not give any
> completions.
>
> Tried with both Terminal and xterm.
>
>
> Reported as Apple Bug # 5563035
>
> I've also asked the IPython devs for help - and volunteered to get
> this resolved somehow for them -- but I don't think it's an IPython
> problem (since you can do this from "raw" interactive python).
>
> Here's hoping...
>
>
> - boyd
>
>
> Boyd Waters
> Mac Programmer
> National Radio Astronomy Observatory
> http://www.aoc.nrao.edu/~bwaters
>
>
> On Oct 22, 2007, at 12:35 PM, Noah Gift wrote:
>
> > Edward,
> >
> > Thanks for the information. Do you know of a way to get IPython to
> > use edline instead? IPython is growing in popularity for Python
> > programmers, and it seems like getting a way forward that works with
> > edline makes sense, or maybe I am wrong and people will need to just
> > manually install readline themselves.
> >
> > Noah
> >
> > On 10/22/07, Edward Moy < emoy at apple.com> wrote:
> > On Oct 21, 2007, at 10:51 PM, Noah Gift wrote:
> >
> >> I have been getting ready for the official leopard release in a few
> >> days, and have been a bit worried about readline support. I forgot
> >> what I did to get it to work for IPython, which I absolutely cannot
> >> live without anymore. Is there a plan for a Leopard binary that
> >> fixes readline, or can I help someone prepare some documentation on
> >> getting readline working properly. I don't have a lot of time
> >> during the next couple of weeks to get into compile hell, but if
> >> someone has any easy fix to get readline to work, I would greatly
> >> appreciate it.
> >
> >
> > The installed version of python on Leopard will actually have
> > readline support turned on by default, but it uses the EditLine
> > (libedit) library, not the GNU Readline (due to licensing reasons).
> > While functionally equivalent, the command syntax is different.
> > From the python(1) man page:
> >
> >
> > INTERACTIVE INPUT EDITING AND HISTORY SUBSTITUTION
> > The Python inteterpreter supports editing of the current
> > input line and
> > history substitution, similar to facilities found in the Korn
> > shell and
> > the GNU Bash shell. However, rather than being implemented
> > using the
> > GNU Readline library, this Python interpreter uses the
> > BSD EditLine
> > library editline(3) with a GNU Readline emulation layer.
> >
> >
> > The readline module provides the access to the EditLine
> > library, but
> > there are a few major differences compared to a traditional
> > implementa-
> > tion using the Readline library. The command language
> > used in the
> > preference files is that of EditLine, as described in
> > editrc(5) and not
> > that used by the Readline library. This also means
> > that the
> > parse_and_bind() routines uses EditLine commands. And the
> > preference
> > file itself is ~/.editrc instead of ~/.inputrc.
> >
> >
> > For example, the rlcompleter module, which defines a
> > completion func-
> > tion for the readline modules, works correctly with
> > the EditLine
> > libraries, but needs to be initialized somewhat differently:
> >
> >
> > import rlcompleter
> > import readline
> > readline.parse_and_bind ("bind ^I rl_complete")
> >
> >
> > For vi mode, one needs:
> >
> >
> > readline.parse_and_bind ("bind -v")
> >
> >
> >
> --------------------------------------------------------------------------
> > Edward Moy
> > Apple Computer, Inc.
> > emoy at apple.com
> >
> >
> >
> >
> > _______________________________________________
> > Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> > http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20071026/edc550f3/attachment-0001.htm
More information about the Pythonmac-SIG
mailing list