logo       

Re: [PATCH] new shopt `colonbreakswords' for bash 3.0: msg#00230

shells.bash.bugs

Subject: Re: [PATCH] new shopt `colonbreakswords' for bash 3.0

Chet Ramey wrote:

While the current behavior of filename completion (treating
the colon `:' as a separator for words to be completed) is
useful for PATH style variables, it is sometimes irritating
for users working a lot with filenames that contain a colon.

This patch makes this configurable with a new shopt
`colonbreakswords', enabled by default. It can be unset with

Why not just use $COMP_WORDBREAKS? That's what it's there for. One
problem with it, however, is that it's not initialized with the
`standard' list of break characters, so you have to play around with
it. Let me know about problems you find.

Uhm, yes, this would work. OTOH this will also influence
rl_filename_quote_characters, which has only cosmetic consequences,
but is irritating nevertheless.

I guess I don't understand the objection. Do you want the colons (or
other characters removed from the word break list) to be quoted? It
seems to me that the colon is the only `objectionable' character; why
should it be quoted if you're not going to use it as a word break, and
it's not special to the parser or word expansion code?

You can run COMP_WORDBREAKS=${COMP_WORDBREAKS//:/} and get the effect
I think you want.

(And, BTW, I was wrong about COMP_WORDBREAKS not being initialized to the
default value of rl_completer_word_break_chars.)

Uhm yes, sorry, COMP_WORDBREAKS does indeed what I want. The only thing my
patch does differently is that the colon is removed from
rl_filename_quote_characters, which has the effect that

mkdir d; cd d
touch a,v a::b,v
ls a,<TAB> a:<TAB>

results in

ls a,v a::b,v

while when only setting COMP_WORDBREAKS the result is

ls a,v a::b\,v

because the colon will trigger rl_filename_quoting_function, which in turn
quotes the comma. But I guess this isn't worth the effort.

Anyway, since many people seem to have problems with the default behaviour
of quoting colons in completion, I wonder if
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
will make a good FAQ entry?

-Oliver


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise