From: Danek Duvall <duvall@emufarm.org>
To: zsh-users@sunsite.dk
Cc: Jonas Juselius <jonas@iki.fi>
Subject: Re: Completion function for bitkeeper?
Date: Thu, 6 Nov 2003 07:32:25 -0800 [thread overview]
Message-ID: <20031106153225.GA491@lorien.emufarm.org> (raw)
In-Reply-To: <20030523160155.GA14388@lorien.emufarm.org>
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
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
[-- Attachment #2: _sccsfiles --]
[-- Type: text/plain, Size: 1461 bytes --]
#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
}
next prev parent reply other threads:[~2003-11-06 15:33 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-23 16:00 Steve Borho
2003-05-23 16:01 ` Danek Duvall
2003-11-06 15:32 ` Danek Duvall [this message]
2003-11-07 19:17 ` Oliver Kiddle
2003-11-10 18:20 ` Danek Duvall
2003-11-11 8:22 ` Oliver Kiddle
2003-11-11 10:42 ` Peter Stephenson
2003-11-11 15:21 ` Oliver Kiddle
2003-11-11 15:24 ` Peter Stephenson
2003-11-11 16:13 ` Oliver Kiddle
2003-11-11 16:23 ` Peter Stephenson
2003-11-11 16:44 ` Oliver Kiddle
2003-11-11 16:23 ` Danek Duvall
2003-11-11 19:06 ` Oliver Kiddle
2003-11-11 21:28 ` Danek Duvall
2003-11-14 8:04 ` Oliver Kiddle
2003-11-14 10:47 ` Peter Stephenson
2003-11-14 13:09 ` Oliver Kiddle
2003-11-14 16:12 ` Bart Schaefer
2003-11-14 16:23 ` Peter Stephenson
2003-11-14 17:14 ` Bart Schaefer
2003-11-14 17:01 ` Oliver Kiddle
2003-11-14 15:46 ` Danek Duvall
2003-11-14 21:24 ` Danek Duvall
2003-11-17 15:47 ` Oliver Kiddle
2003-11-17 17:51 ` Danek Duvall
2003-11-19 10:23 ` Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031106153225.GA491@lorien.emufarm.org \
--to=duvall@emufarm.org \
--cc=jonas@iki.fi \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).