* PATCH: cleanup of a few completion functions
@ 2002-01-16 15:37 Oliver Kiddle
2002-01-16 16:44 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2002-01-16 15:37 UTC (permalink / raw)
To: zsh-workers
This is a number of small changes and fixes to completion functions.
Including:
- use of pager style in _complete-debug. Sorry Bart but I'm really fed
up with it using vi and the style will allow it to be changed by
anyone who wants to use their editor instead of their pager.
- use of remote-access style in _ssh
- factor out completion of terminal names
- improved _alias
- a number of spelling corrections.
- addition of descriptions where they were lacking before
- a few missing local declarations or -C arguments to _arguments
Anyone know what is going on with the "(${opts#-l})-L+[.... specs in
_zle and _pine? They don't seem to work to me. Did they before (I may
have blindly copied _zle when I wrote _pine)? To work, it seems to need
to be "(${(@)^^opts#-l})-L+...
Oliver
Index: Completion/AIX/Command/_lspv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/AIX/Command/_lspv,v
retrieving revision 1.1
diff -u -r1.1 _lspv
--- Completion/AIX/Command/_lspv 2001/04/02 12:19:40 1.1
+++ Completion/AIX/Command/_lspv 2002/01/16 15:29:54
@@ -1,7 +1,7 @@
#compdef lspv
_arguments -C -s \
- '(-p -M)-l[list logical volumns on physical volume]' \
+ '(-p -M)-l[list logical volumes on physical volume]' \
'(-l -M)-p[list partitions on physical volume]' \
'(-l -p)-M[list mapping of physical and logical partition numbers]' \
'-n[specify physical volume to access variable descriptor from]:physical volume:_physical_volumes' \
Index: Completion/Base/Utility/_sep_parts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_sep_parts,v
retrieving revision 1.2
diff -u -r1.2 _sep_parts
--- Completion/Base/Utility/_sep_parts 2001/05/29 17:54:08 1.2
+++ Completion/Base/Utility/_sep_parts 2002/01/16 15:29:54
@@ -3,7 +3,7 @@
# This function can be used to separately complete parts of strings
# where each part may be one of a set of matches and different parts
# have different sets.
-# Arguments are alternatingly arrays and separator strings. Arrays may
+# Arguments are alternately arrays and separator strings. Arrays may
# be given by name or literally as words separated by white space in
# parentheses, e.g.:
#
Index: Completion/Mandrake/Command/_urpmi
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Mandrake/Command/_urpmi,v
retrieving revision 1.4
diff -u -r1.4 _urpmi
--- Completion/Mandrake/Command/_urpmi 2002/01/14 11:30:20 1.4
+++ Completion/Mandrake/Command/_urpmi 2002/01/16 15:29:54
@@ -11,12 +11,12 @@
}
_urpmi() {
- local state context line ret=1
+ local expl state curcontext="$curcontext" line ret=1
typeset -A opt_args
case "$service" in
urpmi.addmedia )
- _arguments -A '-*' \
+ _arguments -C -A '-*' \
"(--wget)--curl[use curl to retrieve distant files]" \
"(:)--distrib[automatically create all media from an installation medium]:media URL:->media_url" \
"--update[mark as update media]" \
@@ -31,13 +31,13 @@
&& ret=0
;;
urpmi.removemedia )
- _arguments -A '-*' \
+ _arguments -C -A '-*' \
"(:)-a[select all media]" \
"(-a)"{,\*}": :->urpmi_media" \
&& ret=0
;;
urpmi.update )
- _arguments -A '-*' \
+ _arguments -C -A '-*' \
"(--wget)--curl[use curl to retrieve distant files]" \
"(--curl)--wget[use wget to retrieve distant files]" \
"(:)-a[select all non-removable media]" \
@@ -48,7 +48,7 @@
&& ret=0
;;
urpmi )
- _arguments -A '-*' \
+ _arguments -C -A '-*' \
"(: -)--help[print usage information]" \
"(--help)--allow-medium-change[allow change of removable media]" \
"(--help)--auto[do not ask any questions]" \
Index: Completion/Unix/Command/_cpio
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_cpio,v
retrieving revision 1.1
diff -u -r1.1 _cpio
--- Completion/Unix/Command/_cpio 2001/04/02 11:47:11 1.1
+++ Completion/Unix/Command/_cpio 2002/01/16 15:29:54
@@ -2,7 +2,7 @@
(( $+_is_gnu )) || typeset -gA _is_gnu
-local cmd=$service args ig context curcontext="$curcontext" state line opt_args
+local cmd=$service args ig curcontext="$curcontext" state line
local expl ret
local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)'
@@ -114,7 +114,7 @@
fi
ret=1
-_arguments -s "$args[@]" && ret=0
+_arguments -C -s "$args[@]" && ret=0
if [[ $state = afile ]]; then
if compset -P '*:'; then
Index: Completion/Unix/Command/_fsh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_fsh,v
retrieving revision 1.1
diff -u -r1.1 _fsh
--- Completion/Unix/Command/_fsh 2001/12/26 03:46:13 1.1
+++ Completion/Unix/Command/_fsh 2002/01/16 15:29:54
@@ -1,6 +1,8 @@
#compdef fsh
-_arguments \
+local curcontext="$curcontext" state line
+
+_arguments -C \
'(--help)-h[help]' \
'(-h)--help' \
'(--version)-V[version]' \
Index: Completion/Unix/Command/_ifconfig
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ifconfig,v
retrieving revision 1.1
diff -u -r1.1 _ifconfig
--- Completion/Unix/Command/_ifconfig 2001/12/19 15:07:31 1.1
+++ Completion/Unix/Command/_ifconfig 2002/01/16 15:29:54
@@ -1,6 +1,6 @@
#compdef ifconfig
-local context state line ret=1
+local curcontext="$curcontext" state line ret=1
local -a opts args alias debug updownlist
alias=( '(-alias alias)'{,-}'alias[remove or establish alternate address for if]' )
@@ -63,7 +63,7 @@
;;
esac
-_arguments "$args[@]" \
+_arguments -C "$args[@]" \
'-a[apply to all interfaces]' \
'1:network interface:_net_interfaces' \
'::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \
Index: Completion/Unix/Command/_java
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_java,v
retrieving revision 1.4
diff -u -r1.4 _java
--- Completion/Unix/Command/_java 2001/12/19 15:10:40 1.4
+++ Completion/Unix/Command/_java 2002/01/16 15:29:54
@@ -8,7 +8,7 @@
case "$service" in
javac)
- _arguments \
+ _arguments -C \
'-g-[generate debugging information]:debug:->debug' \
'-O[optimize]' \
'-nowarn[suppress warnings]' \
@@ -32,7 +32,7 @@
;&
java)
- _arguments \
+ _arguments -C \
"$jdb_args[@]" \
'(-cp)-classpath[specify path for user class files]:class path:->classpath' \
'(-classpath)-cp[specify path for user class files]:class path:->classpath' \
@@ -50,7 +50,7 @@
;;
javadoc)
- _arguments \
+ _arguments -C \
'-overview[specify overview file]:_files' \
'-public[display public classes and members only]' \
'-protected[display public/protected classes and members only (default)]' \
@@ -94,7 +94,7 @@
;;
appletviewer)
- _arguments \
+ _arguments -C \
'-debug[run applet on jdb]' \
'-encoding[specify character encoding for source files]:encoding:->encoding' \
'-J-[specify java option]:java option:' \
@@ -120,7 +120,7 @@
m ':manifest file:_files'
f ':archive file:_files -g \*.\(jar\|zip\)'
)
- _arguments \
+ _arguments -C \
"${jar_cmd/[^-]*/:dummy:}" \
${${(s::)jar_cmd}/(#b)(?)/$tmpassoc[$match[1]]} \
'*:file:->jararg' && return 0
@@ -128,7 +128,7 @@
;;
javah|javah_g)
- _arguments \
+ _arguments -C \
'-o[specify output file]:output file:_files' \
'-d[specify destination directory]:directory:_files -/' \
'-stubs[generate stubs]' \
@@ -144,7 +144,7 @@
;;
javap)
- _arguments \
+ _arguments -C \
'-help[print help message]' \
'-l[line and local variable tables]' \
'-b[backward compatible to JDK1.1]' \
@@ -169,7 +169,7 @@
;;
rmic)
- _arguments \
+ _arguments -C \
'-classpath[specify path for user class files]:class path:->classpath' \
'-d[specify destination directory]:directory:_files -/' \
'-depend[treat dependencies]' \
@@ -207,7 +207,7 @@
;;
native2ascii)
- _arguments \
+ _arguments -C \
'-reverse[convert Latin-1 (with \udddd) to native encoding]' \
'-encoding[specify character encoding]:encoding:->encoding' \
':input file:_files' \
Index: Completion/Unix/Command/_lynx
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_lynx,v
retrieving revision 1.2
diff -u -r1.2 _lynx
--- Completion/Unix/Command/_lynx 2001/12/12 11:29:36 1.2
+++ Completion/Unix/Command/_lynx 2002/01/16 15:29:54
@@ -14,20 +14,20 @@
'-blink' \
'-book' \
'-buried_news' \
- '-cache=:NUMBER:' \
+ '-cache=:number of documents:' \
'-case' \
- '-cfg=:FILENAME:_files' \
+ '-cfg=:configuration file:_files' \
'-child' \
'-color' \
'-cookies' \
'-core' \
'-crawl' \
- '-display=:DISPLAY:_x_display' \
+ '-display=:display:_x_display' \
'-dump' \
- '-editor=:EDITOR:_files' \
+ '-editor=:editor:_command_names -e' \
'-emacskeys' \
'-enable_scrollback' \
- '-error_file=:FILENAME:_files' \
+ '-error_file=:error file:_files' \
'-fileversions' \
'-force_html' \
'-force_secure' \
@@ -41,7 +41,7 @@
'-image_links' \
'-ismap' \
'-index=:URL:->html' \
- '-link=:NUMBER:' \
+ '-link=:starting count:' \
'-localhost' \
'-locexec' \
'-mime_header' \
@@ -83,7 +83,7 @@
'-startfile_ok' \
'-tagsoup' \
'-telnet' \
- '-term=:TERM:' \
+ '-term=:terminal name:_terminals' \
'-tlog' \
'-trace' \
'-traversal' \
Index: Completion/Unix/Command/_modutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_modutils,v
retrieving revision 1.4
diff -u -r1.4 _modutils
--- Completion/Unix/Command/_modutils 2001/05/16 12:34:32 1.4
+++ Completion/Unix/Command/_modutils 2002/01/16 15:29:54
@@ -1,6 +1,6 @@
#compdef modprobe rmmod
-local expl loaded
+local curcontext="$curcontext" state line expl loaded
_modutils_loaded_modules() {
@@ -62,7 +62,7 @@
'(-C)--config:config file:_files'
)
- _arguments '(--remove)-r[remove]:*:loaded module:->modprobe_remove' \
+ _arguments -C '(--remove)-r[remove]:*:loaded module:->modprobe_remove' \
'(-r)--remove:*:loaded module:->modprobe_remove' \
'(--list)-l[list matching modules]:*:module file:->modprobe_list' \
'(-l)--list:*:module file:->modprobe_list' \
Index: Completion/Unix/Command/_mount
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mount,v
retrieving revision 1.13
diff -u -r1.13 _mount
--- Completion/Unix/Command/_mount 2001/12/11 15:46:22 1.13
+++ Completion/Unix/Command/_mount 2002/01/16 15:29:55
@@ -50,7 +50,7 @@
# are below these table.
local curcontext="$curcontext" state line suf ret=1
-local args fss deffs=iso9660 descr tmp typeops=-t _nfs_access _nfs_ufs
+local args deffs=iso9660 tmp typeops=-t _nfs_access _nfs_ufs
typeset -A opt_args
@@ -177,7 +177,7 @@
'(susp)nosusp[disable system use sharing protocol]'
'(norrip)rrip[enable rock ridge extensions]'
'(rrip)norrip[disable rock ridge extensions]'
- 'nmconv[specify filename translation]:filename translation:(c l m)'
+ 'nmconv[specify filename translation]:filename translation:((c\:no\ translation l\:to\ lowercase m\:suppress\ version\ no))'
)
_fs_nfs=(
@@ -537,7 +537,6 @@
'-M[use alternate mtab]:alternate mtab:_files'
'-P[with -p, prepend prefix to paths]:prefix'
)
- fss=( efs proc fd nfs iso9660 dos hfs cachefs )
deffs=efs
;;
linux*)
Index: Completion/Unix/Command/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ssh,v
retrieving revision 1.4
diff -u -r1.4 _ssh
--- Completion/Unix/Command/_ssh 2001/09/25 03:06:48 1.4
+++ Completion/Unix/Command/_ssh 2002/01/16 15:29:55
@@ -5,8 +5,12 @@
# colorings and LIST_TYPES and so on, but I'm just not that ambitious.
local expl
- _wanted files expl 'remote files' \
- compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
+ if zstyle -T ":completion:${curcontext}:" remote-access; then
+ _wanted files expl 'remote files' \
+ compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
+ else
+ _message 'remote files'
+ fi
}
_ssh () {
Index: Completion/Unix/Command/_telnet
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_telnet,v
retrieving revision 1.2
diff -u -r1.2 _telnet
--- Completion/Unix/Command/_telnet 2001/05/29 17:54:37 1.2
+++ Completion/Unix/Command/_telnet 2002/01/16 15:29:55
@@ -9,7 +9,7 @@
typeset -A opt_args
if (( ! $+_telnet_args )); then
- local help="$(_call_program options telnet -\? < /dev/null 2>&1)"
+ local help="$(_call_program options 'telnet -\?' < /dev/null 2>&1)"
local -A optionmap
optionmap=(
'*\[-8\]*' '-8[allow 8-Bit data]'
Index: Completion/Unix/Command/_user_admin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_user_admin,v
retrieving revision 1.3
diff -u -r1.3 _user_admin
--- Completion/Unix/Command/_user_admin 2001/10/08 16:22:40 1.3
+++ Completion/Unix/Command/_user_admin 2002/01/16 15:29:55
@@ -15,7 +15,7 @@
args=(
'(-D)-c+[comment]:comment'
"(-D)-${home}+[home directory]:home directory:_directories -W /"
- '(-D)-e+[specify expriration date]:expiration date (YYYY-MM-DD)'
+ '(-D)-e+[specify expiration date]:expiration date (YYYY-MM-DD)'
'(-D)-f+[specify inactive days]:inactive days'
'(-D)-g+[initial group]:initial group:_groups'
'(-D)-G+[supplementary groups]:supplementary groups:_groups -S,'
Index: Completion/Unix/Command/_w3m
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_w3m,v
retrieving revision 1.3
diff -u -r1.3 _w3m
--- Completion/Unix/Command/_w3m 2001/12/12 11:29:36 1.3
+++ Completion/Unix/Command/_w3m 2002/01/16 15:29:55
@@ -3,7 +3,7 @@
local curcontext="$curcontext" state line
typeset -A opt_args
-_arguments \
+_arguments -C \
'-t[tabwidth]:tabwidth:' \
'-r[ignore backspace effect]' \
'-l[preserved lines]:number of lines:' \
Index: Completion/Unix/Type/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/.distfiles,v
retrieving revision 1.5
diff -u -r1.5 .distfiles
--- Completion/Unix/Type/.distfiles 2001/12/19 15:07:31 1.5
+++ Completion/Unix/Type/.distfiles 2002/01/16 15:29:55
@@ -8,5 +8,5 @@
_files _pdf _pspdf _users
_groups _perl_basepods _signals _users_on
_hosts _perl_builtin_funcs _tar_archive _time_zone
-_file_systems _net_interfaces
+_file_systems _net_interfaces _terminals
'
Index: Completion/Unix/Type/_terminals
===================================================================
RCS file: _terminals
diff -N _terminals
--- /dev/null Thu May 24 22:33:05 2001
+++ _terminals Wed Jan 16 07:29:55 2002
@@ -0,0 +1,8 @@
+#compdef infocmp
+
+local desc expl
+
+desc=( $TERMINFO ~/.terminfo $TERMINFO_DIRS /usr/{,share/}{,lib/}terminfo )
+
+_wanted terminals expl 'terminal name' \
+ compadd "$@" - $desc/*/*(N:t)
Index: Completion/X/Command/_xfig
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_xfig,v
retrieving revision 1.2
diff -u -r1.2 _xfig
--- Completion/X/Command/_xfig 2002/01/02 14:45:22 1.2
+++ Completion/X/Command/_xfig 2002/01/16 15:29:55
@@ -7,7 +7,7 @@
'-but_per_row:number of buttons:' \
'-cbg:canvas background color:_x_color' \
'-cfg:canvas foreground color:_x_color' \
- '-depth:visual depth:_x_visdepth' \
+ '-depth:visual depth:' \
'-exportlanguage:export language:(box latex epic eepic eepicemu pictex ibmgl eps ps pstex textyl tpic pic mf acad pcx png gif jpeg tiff ppm xbm xpm)' \
'-iconGeometry:icon geometry:_x_geometry' \
'-internalBW:internal border width:' \
Index: Completion/X/Command/_xloadimage
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_xloadimage,v
retrieving revision 1.1
diff -u -r1.1 _xloadimage
--- Completion/X/Command/_xloadimage 2002/01/02 14:45:22 1.1
+++ Completion/X/Command/_xloadimage 2002/01/16 15:29:55
@@ -16,7 +16,7 @@
'*-iscale[scale image]:scale factor'
'*-c'{,olor}'dither[dither image]'
'*-expand[expand image to 24-bit]'
- '*-xpm[specify xpm color map]:color context key:(m g4 g c)'
+ '*-xpm[specify xpm color map]:color context key:((m\:mono g4\:4\ level\ gray g\:gray c\:color))'
)
else
# xloadimage
@@ -40,7 +40,7 @@
_x_arguments "$args[@]" \
'-default[set root background to default]' \
'-fit[use default visual and colormap]' \
- '-fullscreen[use whole screen, suurounding image with border]' \
+ '-fullscreen[use whole screen, surrounding image with border]' \
"-goto[specify image to display at end]:image name:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})'" \
'(*)-help[display information on options]' \
'-identity[identify supplied images instead of displaying]' \
Index: Completion/X/Command/_xterm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_xterm,v
retrieving revision 1.1
diff -u -r1.1 _xterm
--- Completion/X/Command/_xterm 2001/04/02 12:16:20 1.1
+++ Completion/X/Command/_xterm 2002/01/16 15:29:55
@@ -16,7 +16,7 @@
'-ms:pointer cursor color:_x_color' \
'-nb:margin bell number:' \
'-sl:save lines:' \
- '-ti:terminal ID:(vt52 vt100 vt101 vt102 vt220)' \
+ '-ti:terminal ID:_terminals' \
'-tm:terminal setting:' \
'-tn:terminal type:' \
'-ziconbeep:iconbeep (percent):' \
Index: Completion/Zsh/Command/_alias
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_alias,v
retrieving revision 1.1
diff -u -r1.1 _alias
--- Completion/Zsh/Command/_alias 2001/04/11 21:47:18 1.1
+++ Completion/Zsh/Command/_alias 2002/01/16 15:29:55
@@ -1,8 +1,21 @@
#compdef alias
+local curcontext="$curcontext" state line suf
+
_arguments -C -s -A "-*" -S \
'-+g[list or define global aliases]' \
'-+r[list or define regular aliases]' \
'-+m[print aliases matching specified pattern]' \
'-L[print each alias in the form of calls to alias]' \
- '*::alias definition:_aliases -S ='
+ '*::alias definition:->defn'
+
+if [[ -n "$state" ]]; then
+ if compset -P 1 '*='; then
+ compset -q
+ _normal
+ else
+ compset -S '=*' || suf='='
+ _wanted alias expl 'alias definition' _aliases -S "$suf"
+ fi
+fi
+
Index: Completion/Zsh/Context/_value
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_value,v
retrieving revision 1.3
diff -u -r1.3 _value
--- Completion/Zsh/Context/_value 2001/10/26 13:05:46 1.3
+++ Completion/Zsh/Context/_value 2002/01/16 15:29:55
@@ -60,6 +60,11 @@
_value:DISPLAY() { _x_display "$@" }
+_value:PRINTER() { _printers "$@" }
+_value:LPDEST() { _printers "$@" }
+
+_value:TERM() { _terminals "$@" }
+
_value:TZ() { _time_zone "$@" }
_value "$@"
This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.messagelabs.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: cleanup of a few completion functions
2002-01-16 15:37 PATCH: cleanup of a few completion functions Oliver Kiddle
@ 2002-01-16 16:44 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2002-01-16 16:44 UTC (permalink / raw)
To: Oliver Kiddle, zsh-workers
On Jan 16, 3:37pm, Oliver Kiddle wrote:
} Subject: PATCH: cleanup of a few completion functions
}
} This is a number of small changes and fixes to completion functions.
} Including:
} - use of pager style in _complete-debug. Sorry Bart but I'm really fed
} up with it using vi and the style will allow it to be changed by
} anyone who wants to use their editor instead of their pager.
That patch doesn't seem to be in here, so I can't get too upset about it.
} Anyone know what is going on with the "(${opts#-l})-L+[.... specs in
} _zle and _pine? They don't seem to work to me. Did they before (I may
} have blindly copied _zle when I wrote _pine)? To work, it seems to need
} to be "(${(@)^^opts#-l})-L+...
That's my fault. I never use rc_expand_param myself so I always forget
that it's turned on everywhere in the completion code.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: cleanup of a few completion functions
@ 2002-01-17 13:02 Oliver Kiddle
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2002-01-17 13:02 UTC (permalink / raw)
To: zsh-workers
Bart wrote:
> } - use of pager style in _complete-debug.
>
> That patch doesn't seem to be in here, so I can't get too upset about
> it.
I must have missed it when I collated the patch together. It is now
below (including associated _zstyle change). With it, anyone who does
use their editor for viewing the traces will need:
zstyle ':completion:complete-debug:*' pager $EDITOR
Note that nslookup also uses the pager style so it's not new and using
a context of '*' might not be what you'd want.
> } Anyone know what is going on with the "(${opts#-l})-L+[.... specs in
> } _zle and _pine? They don't seem to work to me. Did they before (I may
> } have blindly copied _zle when I wrote _pine)? To work, it seems to
> need
> } to be "(${(@)^^opts#-l})-L+...
>
> That's my fault. I never use rc_expand_param myself so I always forget
> that it's turned on everywhere in the completion code.
Actually, it needed to be \(${(j. .)opts:#-l}')-L... and unsetting
rc_expand_param wouldn't actually fix it. I've tried 3.1.9 and nothings
changed since then so it probably never worked right in _zle.
Anyway, I've fixed both _zle and _pine and cleaned up _zle. I'm not
sure that the loop over $state is necessary in _zle but I've left it.
Oliver
Index: Completion/Base/Widget/_complete_debug
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Widget/_complete_debug,v
retrieving revision 1.3
diff -u -r1.3 _complete_debug
--- Completion/Base/Widget/_complete_debug 2001/06/21 10:05:19 1.3
+++ Completion/Base/Widget/_complete_debug 2002/01/17 12:56:48
@@ -4,7 +4,7 @@
(( $+_debug_count )) || integer -g _debug_count
local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count]
-local w="${(qq)words}"
+local pager w="${(qq)words}"
exec 3>&- # Too bad if somebody else is using it ...
[[ -t 2 ]] && { exec 3>&2 2>| $tmp ; trap 'exec 2>&3 3>&-' EXIT INT }
@@ -15,7 +15,8 @@
unsetopt xtrace
[[ -t 3 ]] && {
- print -sR "${VISUAL:-${EDITOR:-${PAGER:-more}}} ${(q)tmp} ;: $w"
+ zstyle -s ':completion:complete-debug::::' pager pager
+ print -sR "${pager:-${PAGER:-${VISUAL:-${EDITOR:-more}}}} ${(q)tmp} ;: $w"
_message -r "Trace output left in $tmp (up-history to view)"
[[ $compstate[nmatches] -le 1 && $compstate[list] != *force* ]] &&
compstate[list]='list force messages'
Index: Completion/Unix/Command/_pine
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_pine,v
retrieving revision 1.3
diff -u -r1.3 _pine
--- Completion/Unix/Command/_pine 2001/05/30 11:54:53 1.3
+++ Completion/Unix/Command/_pine 2002/01/17 12:56:48
@@ -42,12 +42,12 @@
"($opts $send)-o[open first folder read-only]" \
"(-F -h -v)-r[restricted - can only send mail to oneself]" \
"(-h -v)-d[set debug level]:debug:(0 1 2 3 4 5 6 7 8 9 flush timestamp imap= numfiles= verbose=)" \
- "(${opts#-F})-k[force use of function keys]" \
- "(${opts#-F})-z[allow use of ^Z suspension]" \
- "(${opts#-F})-p+[use alternate .pinerc file]:alternate pinerc:_files" \
- "(${opts#-F})-P+[use alternate pine.conf file]:alternate pine.conf:_files" \
- "(${opts#-F})-x[use configuration exceptions file]:configuration exceptions file:_files" \
- "(${opts#-F})-bail[exit if pinerc file doesn't already exist]" \
+ \(${(j. .)opts:#-F}')-k[force use of function keys]' \
+ \(${(j. .)opts:#-F}')-z[allow use of ^Z suspension]' \
+ \(${(j. .)opts:#-F}')-p+[use alternate .pinerc file]:alternate pinerc:_files' \
+ \(${(j. .)opts:#-F}')-P+[use alternate pine.conf file]:alternate pine.conf:_files' \
+ \(${(j. .)opts:#-F}')-x[use configuration exceptions file]:configuration exceptions file:_files' \
+ \(${(j. .)opts:#-F}")-bail[exit if pinerc file doesn't already exist]" \
'*::recipient:->userhost' \
${^_cache_pine_options}':option value' && return 0
Index: Completion/Zsh/Command/_zle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_zle,v
retrieving revision 1.1
diff -u -r1.1 _zle
--- Completion/Zsh/Command/_zle 2001/04/02 11:33:23 1.1
+++ Completion/Zsh/Command/_zle 2002/01/17 12:56:48
@@ -1,7 +1,7 @@
#compdef zle
-local expl ret=1 st
-local -a opts compwids state
+local expl ret=1
+local -a opts compwids state line context
compwids=(accept-and-menu-complete
complete-word
@@ -19,59 +19,55 @@
"($opts)-A[define widget alias]:old widget:->widget :new widget:->widget" \
"($opts)-C[define completion widget]:new widget name:->comp-widget :completion widget:->builtin-comp-widget :widget shell function:->function" \
"($opts)-D[delete widget]:*:widget:->widget" \
- "(${opts#-l})-L+[with -l, list as commands]:*:-:->listing" \
- "(${opts#-[La]})-l+[list user-defined widgets]:*:-:->listing" \
- "(${opts#-l})-a+[with -l, list all widgets]:*:-:->listing" \
+ \(${(j. .)opts:#-l}')-L[with -l, list as commands]' \
+ \(${(j. .)opts:#-[La]}')-l+[list user-defined widgets]:*:-:->listing' \
+ \(${(j. .)opts:#-l}')-a[with -l, list all widgets]' \
"($opts)-M[display message]:message: " \
"($opts)-N[define new widget]:widget name:->widget-or-function ::widget shell function:->function" \
- "(${opts#-c})-R+[redisplay]:*:-:->redisplay" \
- "(${opts#-R})-c+[with -R, clear listing]:*:-:->redisplay" \
+ \(${(j. .)opts:#-c}')-R+[redisplay]:*:-:->redisplay' \
+ \(${(j. .)opts:#-R}')-c[with -R, clear listing]' \
"($opts)-U[unget to input stack]:string: " \
- '(-)::widget name:->call'
+ '(-):widget:->widget' \
+ '(-)*::widget args:->args' && ret=0
[[ $state == listing ]] &&
- _arguments -s -S \
- "-l[list user-defined widgets]" \
+ _arguments -s -S '!-l' \
"(-a)-L[list as commands]" \
"(-L)-a[list all widgets]" \
- '(-)*:widget name:->widget'
+ '*:widget name:->widget' && ret=0
-for st in $state; do
- case $st in
- (call)
- if ((CURRENT > 2)); then
- _arguments \
- '(-N)-n[numeric prefix]:number: ' \
- '(-n)-N[reset numeric prefix]' \
- ':widget::' '(-)*:widget arguments: ' && ret=0
- # :widget:: is a placeholder so we needn't shift words
- continue
- fi
- ;&
+while (( $#state )); do
+ case "$state[1]" in
+ (args)
+ _arguments \
+ '(-N)-n[numeric prefix]:number:' \
+ '(-n)-N[reset numeric prefix]' \
+ '(-)*:widget arguments: ' && ret=0
+ ;;
(widget*)
- _wanted widgets expl widget compadd -k widgets && ret=0
+ _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
[[ $st != *function ]] && continue
;&
(function)
- _wanted functions expl 'widget shell function' \
+ _wanted -C "$context[1]" functions expl 'widget shell function' \
compadd -k functions && ret=0
;;
(comp-widget)
- _wanted widgets expl 'completion widget' \
+ _wanted -C "$context[1]" widgets expl 'completion widget' \
compadd -k "widgets[(R)(*:|)(.|)(${(j(|))compwids})(|:*)]" && ret=0
;&
(builtin-comp-widget)
- _wanted widgets expl 'builtin completion widget' \
+ _wanted -C "$context[1]" widgets expl 'builtin completion widget' \
compadd -k "widgets[(I)(.|)(${(j(|))compwids})]" && ret=0
;;
(redisplay)
- _arguments -s \
- "-R[redisplay]" \
- "(*)-c[clear listing]" \
- "(-)::status line: " "*:strings to list: " && ret=0
+ _arguments -s -S '!-R' \
+ "-c[clear listing]" \
+ ":status line" "*:strings to list" && ret=0
;;
- (*) ret=$?;;
esac
+ shift 1 state
+ shift 1 context
done
return ret
Index: Completion/Zsh/Command/_zstyle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_zstyle,v
retrieving revision 1.6
diff -u -r1.6 _zstyle
--- Completion/Zsh/Command/_zstyle 2002/01/10 11:00:05 1.6
+++ Completion/Zsh/Command/_zstyle 2002/01/17 12:56:49
@@ -89,6 +89,7 @@
original c:bool
packageset c:packageset
path c:_directories
+ pager c:_command_names
pine-directory c:_directories
ports c:_ports
prefix-hidden c:bool
@@ -233,8 +234,8 @@
functions)
_wanted comp-widget expl 'completion widget' \
- compadd $suf - all-matches complete-tag correct-word expand-word \
- expand-alias-word history-words
+ compadd $suf - all-matches complete-debug complete-tag \
+ correct-word expand-word expand-alias-word history-words
;;
user-host-port)
This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.messagelabs.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-17 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-16 15:37 PATCH: cleanup of a few completion functions Oliver Kiddle
2002-01-16 16:44 ` Bart Schaefer
2002-01-17 13:02 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).