Readline and unwanted filename completion

Michael Hudson mwh at python.net
Mon Feb 4 06:40:51 EST 2002


Simon Budig <Simon.Budig at unix-ag.org> writes:

> In article <3c5b2c1f at si-nic.hrz.uni-siegen.de>, Simon Budig wrote:
> > Michael Hudson <mwh at python.net> wrote:
> >> Simon Budig <Simon.Budig at unix-ag.org> writes:

[complaint as subject]

> >>> Is there an evil hack to avoid this?
> >> 
> >> Dunno.  Doubt it, somehow.  You'll need to look at the documentation
> >> for readline, though.
> > 
> > Well - I looked at the documentation for the readline-module, but that
> > doesn't say anything about it. Maybe I should read the sources.
> 
> Ok, did that. Here is the Patch to fix this behaviour. It is against
> Modules/readline.c from Python 2.1.2.

Cool.

> ----8<-----------------------------
> --- readline.c.orig	Sat Feb  2 21:44:09 2002
> +++ readline.c	Sat Feb  2 22:01:16 2002
> @@ -346,6 +346,9 @@
>  		   lock released! */
>  		save_tstate = PyThreadState_Swap(NULL);
>  		PyEval_RestoreThread(tstate);
> +		/* Don't use the default filename completion if we
> +		   have a custom completion function... */
> +		rl_attempted_completion_over = 1;
>  		r = PyObject_CallFunction(completer, "si", text, state);
>  		if (r == NULL)
>  			goto error;
> ----8<-----------------------------
> 
> I really would appreciate, if this gets incorporated in the regular
> Python releases. 

First, an awkward question: do you know which versions of readline
support the rl_attempted_completion_over variable?  If it's not been
present since 2.2, some nasty autoconf hackery may be needed (autoconf
can join readline and ncurses on that list we were talking about...).

> Unfortunately I don't have an account at sourceforge to submit this
> the proper way.

Why not?

Cheers,
M.

-- 
  It could be argued that since Suitespot is infinitely terrible,
  that anything else, by very definition of being anything else,
  is infinitely superior.                -- ".", alt.sysadmin.recovery



More information about the Python-list mailing list