On Tue, Oct 1, 2013 at 1:59 PM, Chet Ramey <chet.ra...@case.edu> wrote:
> On 10/1/13 4:55 PM, Jeremy Lin wrote:
>
>> Thanks, I actually ended up with the same solution (for Bash 4.0 and above,
>> where 'compopt' is available, anyway). I just set '+o default' at the top of 
>> the
>> completion function and then set '-o default' as needed. Unfortunately, for
>> earlier versions of Bash, the workaround I mentioned previously seems to be
>> about as good as it gets.
>
> Earlier versions of bash are pretty old; bash-4.0 came out almost five
> years ago.

I know what you mean, but for one reason or another, there are still a
fair number
of people stuck on RHEL/CentOS 5.x, and hence using 3.2. Hopefully there will
be far fewer such people within the next few years...

>> In future versions of Bash, it would be nice if the default Readline 
>> completion
>> could be invoked explicitly, rather than requiring this 'compopt' workaround.
>
> What syntax would you suggest for doing that?  It may require inventing a
> new way for completion functions to interact with their calling environment.

If COMPREPLY could be something other than an array, that might be used
to indicate that some other behavior is desired. For example, perhaps
COMPREPLY='complete-filename' could produce the behavior you currently
get with '-o default' and COMPREPLY=(), but without needing to set '-o default',
of course. I'm not sure how cleanly this would fit into the current scheme of
things, but it's just an idea.

Jeremy

Reply via email to