> > How about giving programmable completion a new hook that allows the > > user/compspec author to display the completions? That is a general > > solution. > > > > I thought only about $COMPREPLY because it's what I was using and > thought it would be just a quick & dirty hack. Of course a hook is a > much better solution!
I'm looking at ways to implement this right now. What would be most useful to the compspec authors out there? Should it be a global hook that is enabled if the user defines a shell function with a particular name? Should the name of the command to display matches be an option to `complete' or `compopt' and just another compspec attribute? The invocation seems simple: run the command or shell function with a set of three or more arguments. The display function needs to know the number of matches, the length of the longest match, and the match list. It could compute the first two, but readline already does the work, so why not pass them through? My inclination is to make it another compspec attribute, specified with a new `-L' option to complete and compopt. compgen doesn't need to understand it. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/