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

Re: complete (real C) tags



On May 17,  3:54pm, Peter Stephenson wrote:
} Subject: complete (real C) tags
}
} I don't think I ever posted this; it allows the new completion system to
} complete tags from a TAGS or tags file (i.e. the tags used by Emacs and vi,
} nothing to do with completion tags).  I have it bound to ^Xt.

Somebody sent me a similar thing for compctl.  Hmm, where did I put it?
 
}   # could do this with sed, just can't be bothered to work out how,
}     $(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
} 	    print "$1\n"' $c_path$c_Tagsfile)

That's a valiant effort, but it doesn't agree with the way emacs parses
a TAGS file.  You'd be better off simply discarding everything after the
DEL character and also discarding all punctuation, and then treating the
remaining words on every line as if they were all candidates.  (Try using
find-tag on e.g. the word `static' in emacs sometime.)

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'

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



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