Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: more exclusion lists
- X-seq: zsh-workers 7690
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: more exclusion lists
- Date: Tue, 7 Sep 1999 14:50:03 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
This adds exclusion lists to some more completion functions (and a few
option descriptions).
Then it uses `->' in some more places, thus making the functions
`_gs_name' and `_exec_funcs' (both in User) superfluous, so they can
be removed now.
Finally, it changes the return value of `_arguments' if a `->' action
is used. This is needed to be able set `compstate[[restore]=""' in
wrapper functions like `_x(t|)_arguments'.
Bye
Sven
diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments Tue Sep 7 13:15:57 1999
+++ Completion/Base/_arguments Tue Sep 7 14:44:53 1999
@@ -740,7 +740,7 @@
options=( "${(@kv)_options}" )
state="${${action[3,-1]##[ ]#}%%[ ]#}"
compstate[restore]=''
- return 1
+ return 300
else
if [[ "${(t)line}" != *local* ]]; then
local line
diff -u -r oldcompletion/User/_gprof Completion/User/_gprof
--- oldcompletion/User/_gprof Tue Sep 7 13:16:08 1999
+++ Completion/User/_gprof Tue Sep 7 14:11:11 1999
@@ -1,12 +1,55 @@
#compdef gprof
+local state line ret=1
+typeset -A options
+
_arguments -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
- -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name: _exec_funcs' \
+ -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \
'-I:directory:_dir_list' \
- '-d-:debug level:' '-k:function names: _exec_funcs -p' \
+ '-d-:debug level:' '-k:function names:->pair' \
'-m:minimum execution count:' \
':executable:_files -g \*\(\*\)' \
':profile file:_files -g gmon.\*' \
-- -s '(#--[no-] --)' \
- '*=name*:function name: _exec_funcs' \
- '*=dirs*:directory:_dir_list'
+ '*=name*:function name:->funcs' \
+ '*=dirs*:directory:_dir_list' && ret=0
+
+if [[ -n "$state" ]]; then
+ local cmd pair expl
+
+ [[ "$state" = pair ]] && pair=yes
+
+ if [[ $#line -gt 1 ]]; then
+ cmd="$line[2]"
+ else
+ return 1
+ fi
+
+ if [[ -n "$cmd" ]]; then
+ if [[ "$cmd" = /* ]]; then
+ tmp="$cmd"
+ else
+ tmp="$PWD/$cmd"
+ fi
+
+ if [[ "$tmp" != "$_gprof_command" ]]; then
+ _gprof_command="$tmp"
+ _gprof_funcs=( "${(@)${(@M)${(@f)$(nm $cmd)}:#[^ ]# [tT] ([^_]|_[^_])*}##* }" )
+ fi
+
+ if [[ -n "$pair" ]]; then
+ if compset -P '*/'; then
+ _description expl 'call arc to function'
+ else
+ _description expl 'call arc from function'
+ fi
+ else
+ _description expl function
+ fi
+ compadd -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
+ else
+ return 1
+ fi
+fi
+
+return ret
diff -u -r oldcompletion/User/_gs Completion/User/_gs
--- oldcompletion/User/_gs Tue Sep 7 13:16:08 1999
+++ Completion/User/_gs Tue Sep 7 14:37:44 1999
@@ -8,12 +8,50 @@
return 1
fi
else
+ local state line ret=1
+ typeset -A options
+
_x_arguments \
- -q \
- '-g-:device size (<width>x<height>):' \
- '-r-:resolution (<val> or <x>x<y>):' \
- '-I:search paths:_dir_list' \
- \*-{d,D}'-:def: _gs_name -d' \
- \*-{s,S}'-:def: _gs_name -s' \
- '*:PostScript file:_ps'
+ '-q[quiet startup]' \
+ '-g-[set device size]:device size (<width>x<height>):' \
+ '-r-[set resolution]:resolution (<val> or <x>x<y>):' \
+ '-I[add search paths]:search paths:_dir_list' \
+ \*-{d,D}'-[define name with definition]:def:->dname' \
+ \*-{s,S}'-[define name with value]:def:->sname' \
+ '*:PostScript file:_ps' && ret=0
+
+ case "$state" in
+ dname)
+ if [[ "$PREFIX" = *\=* ]]; then
+ _message 'systemdict definition value'
+ else
+ _description expl 'systemdict definition name'
+ compadd "$expl[@]" -M 'm:{a-z}={A-Z}' - \
+ DISKFONTS NOCACHE NOBIND NODISPLAY NOPAUSE PLATFONTS SAFER \
+ WRITESYSTEMDICT && ret=0
+ fi
+ ;;
+ sname)
+ if compset -P '*\='; then
+ case "$IPREFIX" in
+ *DEVICE\=)
+ _description expl 'ghostscript device'
+ compadd "$expl[@]" - "${(@)${=${$(gs -h)##* devices:}%%Search path:*}:#}" && ret=0
+ ;;
+ *OutputFile\=)
+ _description expl 'output file'
+ _files && ret=0
+ ;;
+ *)
+ _message 'systemdict value'
+ return 1
+ esac
+ else
+ _description expl 'systemdict name'
+ compadd "$expl[@]" -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && ret=0
+ fi
+ ;;
+ esac
+
+ return ret
fi
diff -u -r oldcompletion/User/_gv Completion/User/_gv
--- oldcompletion/User/_gv Tue Sep 7 13:16:09 1999
+++ Completion/User/_gv Tue Sep 7 14:18:16 1999
@@ -1,8 +1,34 @@
#compdef gv gview
_xt_arguments \
- -{,no}{safer,quiet,center,swap,antialias,dsc,eof,pixmap,watch,resize} \
- -{monochrome,grayscale,color,portrait,landscape,upsidedown,seascape,h,help,v,spartan} \
+ '(-nosafer)-safer' \
+ '(-safer)-nosafer' \
+ '(-noquiet)-quiet' \
+ '(-quiet)-noquiet' \
+ '(-nocenter)-center' \
+ '(-center)-nocenter' \
+ '(-noswap)-swap' \
+ '(-swap)-noswap' \
+ '(-noantialias)-antialias' \
+ '(-antialias)-noantialias' \
+ '(-nodsc)-dsc' \
+ '(-dsc)-nodsc' \
+ '(-noeof)-eof' \
+ '(-eof)-noeof' \
+ '(-nopixmap)-pixmap' \
+ '(-pixmap)-nopixmap' \
+ '(-nowatch)-watch' \
+ '(-watch)-nowatch' \
+ '(-noresize)-resize' \
+ '(-resize)-noresize' \
+ '(-grayscale -color)-monochrome' \
+ '(-monochrome -color)-grayscale' \
+ '(-grayscale -color)-monochrome' \
+ '(-landscape -seascape -upsidedown)-portrait' \
+ '(-portrait -seascape -upsidedown)-landscape' \
+ '(-portrait -landscape -upsidedown)-seascape' \
+ '(-portrait -landscape -seascape)-upsidedown' \
+ -{h,help,v,spartan} \
'-arguments:ghostscript arguments:' \
'-page:label of first page:' \
'-media:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \
diff -u -r oldcompletion/User/_patch Completion/User/_patch
--- oldcompletion/User/_patch Tue Sep 7 13:16:09 1999
+++ Completion/User/_patch Tue Sep 7 14:27:58 1999
@@ -1,19 +1,32 @@
#compdef patch
_arguments -s \
- '-p+:number:(0)' \
- '-F+:lines:' \
- -{l,c,e,n,u,N,R,E,Z,T,b,t,f,s,v} \
+ '(--strip)-p+:number:(0)' \
+ '(--fuzz)-F+:lines:' \
+ '(--context)-c' \
+ '(--ed)-e' \
+ '(--force)-f' \
+ '(--batch)-t' \
+ '(--ignore-whitespace)-l' \
+ '(--normal)-n' \
+ '(--forward)-N' \
+ '(--reverse)-R' \
+ '(--silent --quiet)-s' \
+ '(--skip)-S' \
+ '(--unified)-u' \
+ '(--version)-v' \
+ -{E,Z,T} \
'-i+:patch file:_files' \
- '-o+:output file:_files' \
- '-r+:reject file:_files' \
- '-D+:name:' \
- '-V+:version control style:(simple numbered existing)' \
- '-B+:backup path prefix:' \
+ '(--output)-o+:output file:_files' \
+ '(--reject-file)-r+:reject file:_files' \
+ '(--ifdef)-D+:name:' \
+ '(--version-control)-V+:version control style:(simple numbered existing)' \
+ '(--prefix)-B+:backup path prefix:' \
+ '(--suffix)-b:backup extension:' \
'-Y+:backup basename prefix:_files' \
'-z+:backup file suffix:(.bak)' \
'-g+:NUM:' \
- '-d+:chdir to:_files -/' \
+ '(--directory)-d+:chdir to:_files -/' \
':original file:_files' \
':patch file:_files' \
-- \
diff -u -r oldcompletion/User/_xargs Completion/User/_xargs
--- oldcompletion/User/_xargs Tue Sep 7 13:16:11 1999
+++ Completion/User/_xargs Tue Sep 7 14:31:12 1999
@@ -3,9 +3,11 @@
_arguments \
-{p,t,x} \
-{e-,E}':end-of-file string:' \
- -{i-,I}':replacement string for lines:' \
- -{l-,L}':number of input lines:' \
- '-n:maximum number of arguments:' \
+ '(-x -I)-i-:replacement string for lines:' \
+ '(-x -i)-I:replacement string for lines:' \
+ '(-n -L -x)-l-:number of input lines:' \
+ '(-n -l)-L:number of input lines:' \
+ '(-l -L)-n:maximum number of arguments:' \
'-s:maximum command line length:' \
':command: _command_names -e' \
'*::args:_normal'
diff -u -r oldcompletion/X/_x_arguments Completion/X/_x_arguments
--- oldcompletion/X/_x_arguments Tue Sep 7 13:16:11 1999
+++ Completion/X/_x_arguments Tue Sep 7 14:45:03 1999
@@ -1,6 +1,14 @@
#compdef -P */X11/*
+local ret
+
_arguments \
'-display:display:_x_display' \
'-geometry:geometry:_x_geometry' \
"$@"
+
+ret=$?
+
+[[ "$ret" = 300 ]] && compstate[restore]=''
+
+return ret
diff -u -r oldcompletion/X/_xt_arguments Completion/X/_xt_arguments
--- oldcompletion/X/_xt_arguments Tue Sep 7 13:16:12 1999
+++ Completion/X/_xt_arguments Tue Sep 7 14:45:08 1999
@@ -20,6 +20,8 @@
# cf. XrmParseCommand(3X11), X11R6.4/xc/lib/Xt/Initialize.c, X(5)
+local ret
+
_arguments \
-+{rv,synchronous} \
-{reverse,iconic} \
@@ -42,3 +44,9 @@
'-xrm:resource:_x_resource' \
'-xtsessionID:session ID:_xt_session_id' \
"$@"
+
+ret=$?
+
+[[ "$ret" = 300 ]] && compstate[restore]=''
+
+return ret
diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- od/Zsh/compsys.yo Tue Sep 7 13:15:20 1999
+++ Doc/Zsh/compsys.yo Tue Sep 7 14:46:19 1999
@@ -965,7 +965,8 @@
that implement a state machine. In this case, the `var(string)' (with
all leading and trailing spaces and tabs removed) will be stored in
the global parameter tt(state) and the function returns with a return
-value of one after setting the global `tt(line)' and `tt(options)'
+value of 300 (to make it distinguishable from other return values)
+after setting the global `tt(line)' and `tt(options)'
parameters as described below and without resetting any changes made
to the special parameters such as tt(PREFIX) and tt(words).
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author