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

Re: comments in completion

On Nov 17,  4:26pm, Bruce Stephens wrote:
} Subject: Re: comments in completion
} schaefer@xxxxxxxxxxxxxxxx said:
} > It'd probably be sufficient to make a variant of -X that applies
} > expansions in the manner of -s. 
} Wouldn't this be a bit clunky with programmable completion?

Depends on order of evaluation. :-)

} Surely if I'm 
} using a function to generate completions (a list of jobs, or a list of 
} suitable hostnames or whatever) then it would be natural to explain them 
} there?

Suppose I have the follwing; assume -Y is the expanding form of -X (mnemonic
is "why" :-) --

    compctl -K somefunc -Y '$somevar' somecommand

    somefunc() {
	reply=(some list of things)
	somevar="Some list of things means something"

Now as long as "somefunc" runs before -Y performs its expansion, the value
of "somevar" is what "somefunc" wanted it to be.  This order of evaluation
ought to be possible, because the results of the function are needed before
zsh can even decide whether to print the explanation.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

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