From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6622 invoked from network); 17 May 2000 14:59:28 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 May 2000 14:59:28 -0000 Received: (qmail 1122 invoked by alias); 17 May 2000 14:54:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11443 Received: (qmail 1073 invoked from network); 17 May 2000 14:54:42 -0000 Date: Wed, 17 May 2000 15:54:14 +0100 From: Peter Stephenson Subject: complete (real C) tags To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Message-id: <0FUP001EMLEECG@la-la.cambridgesiliconradio.com> Content-id: <13411.958575115.0@cambridgesiliconradio.com> MIME-version: 1.0 Content-type: MULTIPART/MIXED; BOUNDARY="Boundary_(ID_IpdxIXwHLeG/w1AXRJJFPg)" --Boundary_(ID_IpdxIXwHLeG/w1AXRJJFPg) Content-id: <13411.958575115.1@cambridgesiliconradio.com> Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT 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. I was going to send it to zshu, until I realised it didn't use style tags, and tried to make it by sticking the _wanted stuff in front, which failed, so I took it off again. Only one man will know why... -- Peter Stephenson Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070 --Boundary_(ID_IpdxIXwHLeG/w1AXRJJFPg) Content-id: <13411.958575115.2@cambridgesiliconradio.com> Content-type: text/plain; charset=us-ascii; name=_complete_tag Content-description: _complete_tag Content-disposition: attachment; filename=_complete_tag Content-transfer-encoding: 7BIT #compdef -k complete-word \C-xt # Complete tags using either TAGS or tags. Looks up your directory # hierarchy to find one. If both exist, uses TAGS. # # You can override the choice of tags file with $TAGSFILE (for TAGS) # or $tagsfile (for tags). # # Could be rewritten by some sed expert to use sed instead of perl. # setopt localoptions xtrace # Tags file to look for local c_Tagsfile=${TAGSFILE:-TAGS} c_tagsfile=${tagsfile:-tags} expl # Max no. of directories to scan up through integer c_maxdir=10 local c_path= integer c_idir while [[ ! -f $c_path$c_Tagsfile && ! -f $c_path$c_tagsfile && $c_idir -lt $c_maxdir ]]; do (( c_idir++ )) c_path=../$c_path done if [[ -f $c_path$c_Tagsfile ]]; then # prefer the more comprehensive TAGS, which unfortunately is a # little harder to parse. # could do this with sed, just can't be bothered to work out how, # after quarter of an hour of trying, except for # rm -f =sed; ln -s /usr/local/bin/perl /usr/bin/sed # but that's widely regarded as cheating. # _wanted etags expl 'emacs tags' compadd - \ $(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ && print "$1\n"' $c_path$c_Tagsfile) elif [[ -f $c_tagspath ]]; then # tags doesn't have as much in, but the tag is easy to find. # we can use awk here. # _wanted vtags expl 'vi tags' compadd - \ $(awk '{ print $1 }' $c_path$c_Tagsfile) else return 1 fi --Boundary_(ID_IpdxIXwHLeG/w1AXRJJFPg)--