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

Re: complete (real C) tags



> Bart wrote:
> BTW, here's the equivalent sed (actually, even slightly more accurate, if
> the TAGS file is for a C or C++ program), using $'...' to interpolate \t
> and \x7f.  It can still miss multiple identifiers that appear on the same
> declaration line in the C source file (it picks out only the rightmost).
> 
>     sed -ne 's/^\(.*[a-zA-Z_0-9]\)[[ '$'\t'':;,()]*'$'\177''.*$/\1/' \
> 	-e 's/\(.*[^a-zA-Z_0-9]\)*\([a-zA-Z_0-9]*\)$/\2/p'

I've finally discovered why this doesn't work for me.  First, $'...''...'
is using RCQUOTES to interpolate a ' in the middle.  I suspect this is
wrong with $'...', since you can quote a single quote in that, but I'll
take counsel before trying to fix it.

Second, Solaris sed didn't seem to think much of the second pattern: it
seems to want to remove the whole line.  I've rewritten it as

   sed -ne 's/^\(.*[a-zA-Z_0-9]\)[[ '$'\t'':;,()]*'$'\177''.*$/\1/' \
       -e 's/^.*[^a-zA-Z_0-9]//' \
       -e '/^[a-zA-Z_].*/p'

and this seems to do roughly what I want.

Finally, I've noticed it's several *times* slower for a long tags list when
going through _main_complete (see Sven's patch for _complete_tag in 11459)
rather than just compadd, so I'm very tempted just to miss that out --- try
it with a full `etags -t **/*.[ch]' TAGS file for zsh: I get less than a
second with just compadd, something like five seconds with _main_complete
(on a Sun Enterprise server, too).  I suppose the problem is the huge array
being constantly set and restored as it passes through the shell functions
--- it may not have very much to do with completion as such, although I
think that saves and restores some of its state when calling functions,
too.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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