From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: improve _sccs' file completion
Date: Fri, 21 Feb 2003 11:52:19 +0100 [thread overview]
Message-ID: <4224.1045824739@finches.logica.co.uk> (raw)
This improves the file completion in _sccs to properly handle both s.
files referenced directly and files referenced indirectly.
I think there is a bug somewhere with _files or something. With this
function:
_foo() {
local ret=1
_files && ret=0
compset -P '*/'
compadd one two three && ret=0
return ret
}
compdef _foo foo
mkdir SCCS
foo SCCS/<tab>
For some reason, the / is removed - compstate[unambiguous] contains
just `SCCS'. With the compadd before the _files it works as I'd expect
but PREFIX/IPREFIX need to be saved either manually (as below) or by
using another function to reverse the compset.
Any ideas anyone?
Oliver
Index: Completion/Unix/Command/_sccs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_sccs,v
retrieving revision 1.1
diff -u -r1.1 _sccs
--- Completion/Unix/Command/_sccs 11 Mar 2002 13:08:27 -0000 1.1
+++ Completion/Unix/Command/_sccs 21 Feb 2003 10:32:23 -0000
@@ -2,10 +2,17 @@
(( $+functions[_sccs_files] )) ||
_sccs_files() {
- local dir=${PROJECTDIR:-~+}/${PREFIX##*/}/$finalpath
-
- compset -P '*/'
- _files -W $dir -g \*\(:s/s.//\) "$@"
+ local dir expl ret=1 pref=$PREFIX ipref=$IPREFIX
+ dir="${(M)PREFIX##*/}$finalpath"
+ [[ $~dir = (.|..|)/* ]] || dir="${PROJECTDIR:-~+}/$dir"
+ compset -P "*/"
+ _wanted file expl file compadd "$@" - $~dir/*(N.:t:s/s.//) && ret=0
+ PREFIX="$pref"
+ IPREFIX="$ipref"
+ _wanted sccs-files expl 'sccs file' _files -W ${PROJECTDIR:-~+} \
+ -g 's.*' && ret=0
+
+ return ret
}
local curcontext="$curcontext" state line
@@ -20,7 +27,7 @@
ropt='-r+[specify sccs delta id]:sccs delta id'
copt='-c+[specify date]:date-stamp'
-sfiles=':file:_sccs_files'
+sfiles=":file:_files -g s.\*"
if [[ $service = sccs ]]; then
_arguments -C -A "-*" \
@@ -34,6 +41,7 @@
return
fi
service="$words[1]"
+ sfiles=':file:_sccs_files'
curcontext="${curcontext%:*}-$service:"
fi
finalpath="${opt_args[-p]:-SCCS}"
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
reply other threads:[~2003-02-21 10:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4224.1045824739@finches.logica.co.uk \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@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).