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

Re: question about "-E" option of compadd



On Apr 25,  3:48pm, Han Pingtian wrote:
} Subject: Re: question about "-E" option of compadd
}
} But looks like even if -E was used, all but one empty strings
} still being removed ? like this:
} 
} % _foo()
} compadd -E 3 foo1 foo1 foo1 foo2 foo3 '' '' ''
} % compdef _foo foo
} % foo <tab>
}    foo1 foo2 foo3

There's this other part of the documentation for -E

    empty matches [are] only useful to format completion lists and to
    make explanatory string be shown in completion lists 

Without -V -2, the completion listing is deduplicated on the match
string regardless of the descriptions, so you'll only see one of the
possibly several descriptions.  With -V -2, identical matches and
their corresponding descriptions are shown, but if the descriptions
are missing then the deduplication still happens.

In other words -E is only used to "pad" the list of matches to have
the same number of elements as the array of descriptions passed to -d.
It's not an error to pass -E without -d but it's not useful either.

Or at least that's my understanding of how it's expected to work, and
is how it works in e.g. Oliver's new _dates helper function; but it
is quite possible that some other combination of options bends it.



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