zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _zcompile and _autoload
@ 2000-03-30  8:10 Sven Wischnowsky
  2000-03-31 17:12 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 2000-03-30  8:10 UTC (permalink / raw)
  To: zsh-workers


Here is completion for zcompile and an update for _autoload.

It's a pity that the functions in Builtins are older than _arguments...

And a small fix in _path_files.

Bye
 Sven

diff -ru ../z.old/Completion/Builtins/_autoload Completion/Builtins/_autoload
--- ../z.old/Completion/Builtins/_autoload	Thu Mar 30 09:58:41 2000
+++ Completion/Builtins/_autoload	Thu Mar 30 10:04:16 2000
@@ -2,4 +2,9 @@
 
 local expl
 
-_wanted functions expl 'shell function' compadd - ${^fpath}/*(N:t)
+if (( $words[(I)[-+]*w*] )); then
+  _description files expl 'zwc file'
+  _files "$expl[@]" -g '*.zwc'
+else
+  _wanted functions expl 'shell function' compadd - ${^fpath}/*(N:t)
+fi
diff -ru ../z.old/Completion/Builtins/_zcompile Completion/Builtins/_zcompile
--- ../z.old/Completion/Builtins/_zcompile	Thu Mar 30 10:05:46 2000
+++ Completion/Builtins/_zcompile	Thu Mar 30 10:09:02 2000
@@ -0,0 +1,22 @@
+#compdef zcompile
+
+local context state line expl
+typeset -A opt_args
+
+_arguments -s \
+    '(-c -m -a)-U[don'\''t expand aliases]' \
+    '(-M)-R[mark as read]' \
+    '(-R)-M[mark as mapped]' \
+    '(-c -z -m -a)-k[ksh-style autoloading]' \
+    '(-c -k -m -a)-z[zsh-style autoloading]' \
+    '(-U -z -k)-c[currently defined functions]' \
+    '(-U -z -k)-m[use names as patterns]' \
+    '(-U -z -k)-a[write autoload functions]' \
+    ':zwc file:_files' \
+    '*:function:->function' && return 0
+
+if (( $+opt_args[-c] )); then
+  _wanted functions expl 'function to write' compadd - ${(k)functions}
+else
+  _wanted file expl 'zsh source file' _files
+fi
diff -ru ../z.old/Completion/Core/_path_files Completion/Core/_path_files
--- ../z.old/Completion/Core/_path_files	Thu Mar 30 09:58:49 2000
+++ Completion/Core/_path_files	Thu Mar 30 10:07:22 2000
@@ -528,7 +528,8 @@
 # them as possible matches.
 
 if zstyle -t ":completion:${curcontext}:paths" expand prefix &&
-   [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 ]]; then
+   [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 &&
+      "$exppaths" != "$eorig" ]]; then
   PREFIX="${opre}"
   SUFFIX="${osuf}"
   compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" - "$exppaths[@]"

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: _zcompile and _autoload
  2000-03-30  8:10 PATCH: _zcompile and _autoload Sven Wischnowsky
@ 2000-03-31 17:12 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2000-03-31 17:12 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky wrote:

> It's a pity that the functions in Builtins are older than _arguments...

This patch updates _enable, _disable and _fc to use _arguments and does
a couple of other minor things.

Oliver

--- Completion/Builtins/_nothing.bak	Fri Mar 31 16:33:30 2000
+++ Completion/Builtins/_nothing	Fri Mar 31 16:40:43 2000
@@ -1,3 +1,3 @@
-#compdef true false whoami
+#compdef true false log times whoami
 
 _message 'no argument or option'
--- Completion/Builtins/_cd.bak	Fri Mar 31 16:36:40 2000
+++ Completion/Builtins/_cd	Fri Mar 31 16:36:49 2000
@@ -1,4 +1,4 @@
-#compdef cd pushd
+#compdef cd chdir pushd
 
 # Handling of cd.
 #  - Normally just completes directories.  Uses cdpath if that's set
--- /dev/null	Fri Mar 31 16:57:39 2000
+++ Completion/Builtins/_emulate	Fri Mar 31 16:57:51 2000
@@ -0,0 +1,6 @@
+#compdef emulate
+
+_arguments -C -s \
+  '-L[set local_options and local_traps as well]' \
+  '-R[reset all options instead of only those needed for script portability]' \
+  '1::shell to emulate:(zsh sh ksh csh)'
--- Completion/Builtins/_enable.bak	Thu Mar 30 16:14:23 2000
+++ Completion/Builtins/_enable	Fri Mar 31 11:26:57 2000
@@ -1,15 +1,8 @@
 #compdef enable
 
-local prev="$words[CURRENT-1]" args
-
-args=()
-[[ "$prev" = -*a* ]] &&
-    tags=( 'aliases:alias:compadd - ${(@k)dis_aliases} ${(@k)dis_galiases} )
-[[ "$prev" = -*f* ]] &&
-    tags=( "$tags[@]" 'functions:shell function:compadd - ${(@k)dis_functions}' )
-[[ "$prev" = -*r* ]] &&
-    tags=( "$tags[@]" 'reserved-words:reserved word:compadd - ${(@k)dis_reswords}' )
-[[ "$prev" != -* ]]  &&
-    tags=( 'builtins:builtin command:compadd - ${(@k)dis_builtins} )
-
-_alternative "$args[@]"
+_arguments -C -s \
+  "(-f -r)-a[act on aliases]:*:aliases:(${(k)dis_aliases})" \
+  "(-a -r)-f[act on functions]:*:functions:(${(k)dis_functions})" \
+  "(-a -f)-r[act on reserved words]:*:reserved-words:(${(k)dis_reswords})" \
+  '-m[treat arguments as patterns]' \
+  "*:builtin command:(${(@k)dis_builtins})"
--- Completion/Builtins/_disable.bak	Fri Mar 31 11:28:56 2000
+++ Completion/Builtins/_disable	Fri Mar 31 13:42:45 2000
@@ -1,15 +1,8 @@
 #compdef disable
 
-local prev="$words[CURRENT-1]" args
-
-args=()
-[[ "$prev" = -*a* ]] &&
-    tags=( 'aliases:alias:compadd - ${(@k)aliases} ${(@k)galiases} )
-[[ "$prev" = -*f* ]] &&
-    tags=( "$tags[@]" 'functions:shell function:compadd - ${(@k)functions}' )
-[[ "$prev" = -*r* ]] &&
-    tags=( "$tags[@]" 'reserved-words:reserved word:compadd - ${(@k)reswords}' )
-[[ "$prev" != -* ]]  &&
-    tags=( 'builtins:builtin command:compadd - ${(@k)builtins} )
-
-_alternative "$args[@]"
+_arguments -C -s \
+  "(-f -r)-a[act on aliases]:*:aliases:(${(k)aliases} ${(k)galiases})" \
+  "(-a -r)-f[act on functions]:*:functions:(${(k)functions})" \
+  "(-a -f)-r[act on reserved words]:*:reserved-words:(${(k)reswords})" \
+  '-m[treat arguments as patterns]' \
+  "*:builtin command:(${(k)builtins})"
--- Completion/Builtins/_fc.bak	Fri Mar 31 13:57:59 2000
+++ Completion/Builtins/_fc	Fri Mar 31 16:23:19 2000
@@ -1,9 +1,27 @@
-#compdef fc
+#compdef fc history
 
-local prev="$words[CURRENT-1]"
+local fc_common
 
-if [[ "$prev" = -*e ]]; then
-  _command_names -e
-elif [[ "$prev" = -[ARWI]## ]]; then
-  _files
+fc_common=( \
+  '(-A -R -W -I)-m[treat first argument as a pattern]' \
+  '(-A -R -W -I)-r[reverse order of the commands]' \
+  '(-A -R -W -I -e)-n[suppress line numbers]' \
+  '(-A -R -W -I -e -f -E -i)-d[print time-stamps]' \
+  '(-A -R -W -I -e -d -E -i)-f[mm/dd/yyyy format time-stamps]' \
+  '(-A -R -W -I -e -d -f -i)-E[dd.mm.yyyy format time-stamps]' \
+  '(-A -R -W -I -e -d -f -E)-i[yyyy-mm-dd format time-stamps]' \
+  '(-A -R -W -I -e)-D[print elapsed times]' \
+  '(-A -R -W -I)*::commands:_command_names -e' )
+
+if [[ $words[1] = *history ]]; then
+  _arguments -C -s "$fc_common[@]"
+else
+  _arguments -C -s \
+    '(-A -R -W -I -e)-l[list resulting commands on stdout]' \
+    '(-A -R -W -I -l -n -d -f -E -i -D)-e[specify editor to invoke]:editor to invoke:_command_names -e' \
+    '(-l -m -e -r -n -d -f -E -i -D -A -W *)-R[read history from file]:history file:_files' \
+    '(-l -m -e -r -n -d -f -E -i -D -R -W *)-A[append history to file]:history file:_files' \
+    '(-l -m -e -r -n -d -f -E -i -D -R -A *)-W[write history to file]:history file:_files' \
+    '(-l -m -e -r -n -d -f -E -i -D -A -W *)-I[read/write new events only]:history file:_files' \
+    "$fc_common[@]"
 fi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-03-31 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-30  8:10 PATCH: _zcompile and _autoload Sven Wischnowsky
2000-03-31 17:12 ` 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).