* PATCH: improve _sccs' file completion
@ 2003-02-21 10:52 Oliver Kiddle
0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2003-02-21 10:52 UTC (permalink / raw)
To: Zsh workers
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-21 10:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-21 10:52 PATCH: improve _sccs' file completion Oliver Kiddle
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).