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

Re: [BUG?] Unexpected behaviour with `compdef -p`



On Wed, 2018-10-03 at 09:56 -0500, dana wrote:
> I was trying to use `compdef -p` to avoid having to list out a large
> number of commands i want to complete that all have the same prefix,
> and i found that it doesn't really work the way i expected — it
> destroys the completion output.
> 
> I am not that familiar with the part of the completion system that
> deals with this. Is the above in fact the intended behaviour? (If it
> is, what scenario would one use -p in where it wouldn't cause these
> problems?)

The code's not *that* complicated, this time --- look in

Completion/Base/Core/_dispatch

The loop with _patcomps is handling the compdef -p.  Then the normal
name look-up happens.  This looks like it could be trashing your input.
With a judicious "if" around that bit, and probably also setting name
and comp in the loop above, you ought to be able to get it to work, I
think.

pws




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