Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

problem with quoting in completion function



This applies to 4.0.4 as distributed by Mandrake.

I spent some time trying to understand why the following (suggested by
Sven) does not work:

 compset -P "*,"
 all_sources=( ${all_sources:#(${~IPREFIX//,/|})} )

The intention being to remove already present matches (separated by
comma) from list of possible matches.

It turned out, completion internally quotes IPREFIX, and in my case it
had spaces inside (like "Installation CD") so pattern never matched.
I.e. it tried to match

Installation\ CD

against

Installation CD

If this quoting is intentional it does not seem to be described in
documentation. But I still do not like it, it comes unexpected enough.
It makes it impossible to simply  compare strings.

I had to finally do

    compset -P "*,"
    for i in ${(s:,:)IPREFIX}; do
        eval "all_sources=( \${all_sources:#$i} )"
    done

but that is just ugly.

-andrej





Messages sorted by: Reverse Date, Date, Thread, Author