zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@berkom.de>
To: zsh-workers@sunsite.dk
Subject: Re: _urls -f
Date: Mon, 7 Jan 2002 15:37:11 +0100	[thread overview]
Message-ID: <15417.45719.865154.105308@wischnow.berkom.de> (raw)
In-Reply-To: <3C173E6B.251ACAD4@yahoo.co.uk>


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@berkom.de


      reply	other threads:[~2002-01-07 14:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-11 17:17 Oliver Kiddle
2001-12-11 17:28 ` Clint Adams
2001-12-12  4:34 ` Tanaka Akira
2001-12-12 11:24   ` Oliver Kiddle
2002-01-07 14:37     ` Sven Wischnowsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15417.45719.865154.105308@wischnow.berkom.de \
    --to=wischnow@berkom.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).