From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6908 invoked from network); 6 Nov 2003 15:33:20 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 Nov 2003 15:33:20 -0000 Received: (qmail 15923 invoked by alias); 6 Nov 2003 15:32:39 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6745 Received: (qmail 15882 invoked from network); 6 Nov 2003 15:32:38 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 6 Nov 2003 15:32:38 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [66.93.131.57] by sunsite.dk (MessageWall 1.0.8) with SMTP; 6 Nov 2003 15:32:36 -0000 Received: from lorien.emufarm.org (localhost [127.0.0.1]) by lorien.emufarm.org (8.12.7/8.12.7) with ESMTP id hA6FWQ1C004419; Thu, 6 Nov 2003 07:32:27 -0800 Received: (from duvall@localhost) by lorien.emufarm.org (8.12.7/8.12.7/Submit) id hA6FWPqR004418; Thu, 6 Nov 2003 07:32:25 -0800 Date: Thu, 6 Nov 2003 07:32:25 -0800 From: Danek Duvall To: zsh-users@sunsite.dk Cc: Jonas Juselius Subject: Re: Completion function for bitkeeper? Message-ID: <20031106153225.GA491@lorien.emufarm.org> Mail-Followup-To: Danek Duvall , zsh-users@sunsite.dk, Jonas Juselius References: <20030523160020.GA9026@borho.org> <20030523160155.GA14388@lorien.emufarm.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: <20030523160155.GA14388@lorien.emufarm.org> User-Agent: Mutt/1.5.4i --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I completely neglected to add the _sccsfiles function to the mail, and now that I'm being asked about it again, I figure I should just send it to the list. :) If someone can explain me out of my confusion in the first big comment, that'd be really nice, but what I have appears to work. Thanks, Danek --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_sccsfiles #autoload +X # %W% %E% _sccsfiles () { local i=1 pfiles pdirs sfile="SCCS/s." # If _sccsfiles is called from one of the _sccs_* functions, then # it'll have some compadd options added after the first word, so # the positional parameters are not all "ours". # # One option is to precede the call to _sccsfiles in the optspec's # action with a space, which prevents these extra parameters from # being passed in. Ugh. See the documentation for _arguments in # zshcompsys(1), where it talks about action starting with a space. # # Instead, remove the first few arguments if they match $expl. Why # they're passed in both places I don't know (and this may be a # bug). while [[ -n "$1" && "$1" == "$expl[i]" ]]; do shift ((++i)) done [[ "$1" == "-e" ]] && sfile="SCCS/p." compset -P "*/" # Add matching files pfiles=( ${IPREFIX}${sfile}${PREFIX}*(.N) ) pfiles=( ${pfiles/${IPREFIX}${sfile}} ) compadd -af pfiles # Add matching directories # This should be made more efficient to only descend as far as # necessary in each directory to find an s. file. if [[ -z ${PREFIX} ]]; then pdirs=( ${IPREFIX}**/${sfile}*(.N) ) else pdirs=( ${IPREFIX}${PREFIX}*/**/${sfile}*(.N) ) fi # Remove IPREFIX, then only take first-level directory pdirs=( ${^${pdirs/${IPREFIX}}%%/*} ) # Remove SCCS directories pdirs=( ${pdirs:#SCCS} ) compadd -aq -S / pdirs # Explicitly return success as the above may have failed. return 0 } --LZvS9be/3tNcYl/X--