Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _urls -f



Oliver Kiddle wrote:

> ...
> 
> For netscape, a tag-order of urls before files doesn't seem to work
> entirely so I think I'm still misunderstanding the tags stuff there
> somewhere.

The problem is that one can't use nested _tags-loops in the same
function because the C-code behind it has to keep some internal state
which would get messed up otherwise.

One solution is to re-initialise the outer _tags in the right place.
Another solution would be to move the code into its own little helper
function. The patch below does the former.

Bye
  Sven

Index: Completion/X/Command/_netscape
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_netscape,v
retrieving revision 1.3
diff -u -r1.3 _netscape
--- Completion/X/Command/_netscape	2002/01/02 14:45:22	1.3
+++ Completion/X/Command/_netscape	2002/01/07 14:38:33
@@ -1,6 +1,6 @@
 #compdef netscape
 
-local curcontext="$curcontext" state line ret=1 suf
+local curcontext="$curcontext" state line ret=1 suf files
 typeset -A opt_args
 
 _x_arguments -C \
@@ -68,7 +68,7 @@
 if [[ "$state" = "urls" ]]; then
   _tags files urls
   while _tags; do
-    _requested files expl 'file' _files "$@" && ret=0
+    _requested files expl 'file' _files "$@" && files=yes ret=0
     if _requested urls; then
       # Complete netscape urls
       if compset -P about: ; then
@@ -87,6 +87,7 @@
 	  done
 	  (( ret )) || return 0
 	done
+        [[ -z "$files" ]] && _tags files
       fi
     fi
     (( ret )) || return 0

-- 
Sven Wischnowsky                           wischnow@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author