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

Re: Feature idea: Expanding on completion functions



On Nov 30, 10:35pm, Richard Hartmann wrote:
}
} The completion functions are so powerful it's a shame not to use
} their output for more purposes.

Without necessarily shooting down this idea, let me point out that
completion functions don't have output.  I think the following is
mostly similar to what I said before:

What completion functions do is shove a large number of *possible*
completions into the "compadd" builtin.  Typically they generate WAY
more possibilities than you ever see as "output" ... a lot of the
magic hides in the way completion uses the contents of the command
line at or around the cursor position to throw away most of the data
that was fed to it, so you see the relevant remainder.

The rest of the magic comes from the constellation of variables that
describe the command line context so that the completion functions
have some idea where to look for possible completions.

To use the completion functions for more purposes, you have to both
populate all those context variables appropriately to each of those
other purposes, and also create the appropriate filters to remove
whatever is irrelevant to each purpose.

And then you have to decouple the stuff that performs the filtering
from the stuff that displays the results in ZLE, which is the only
place that any "output" goes right now.

-- 



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