zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: _arguments (Re: PATCH: use _arguments in _which and _unhash)
Date: Sun, 28 May 2000 20:52:43 +0000	[thread overview]
Message-ID: <1000528205243.ZM28260@candle.brasslantern.com> (raw)
In-Reply-To: <393158CD.C9142475@u.genie.co.uk>

On May 28,  6:35pm, Oliver Kiddle wrote:
} Subject: PATCH: use _arguments in _which and _unhash
}
} Bart Schaefer wrote:
} 
} > } % zpty -w l <tab>
} > } _arguments:shift:297: shift count must be <= $#
} > 
} > I can't reproduce that.
} 
} Are you sure? I can reproduce it on different platforms and when
} starting with zsh -f. Maybe one of your options avoids it.

Yup, you're right, I can reproduce it with -f.

Is there a more efficient fix than the following?  (This relies on the
first argument of shift being interpreted as a math expression.)

Index: Completion/Base/_arguments
===================================================================
@@ -285,7 +285,7 @@
 
               # Otherwise we call it with the description-arguments.
 
-              eval "action=( $action )"
+              set -A action ${=~action}
               while _next_label "$subc" expl "$descr"; do
                 "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
 	      done
@@ -293,9 +293,9 @@
             fi
           fi
         fi
-        shift 1 descrs
-        shift 1 actions
-        shift 1 subcs
+        shift "${#descrs} ? 1 : 0" descrs
+        shift "${#actions} ? 1 : 0" actions
+        shift "${#subcs} ? 1 : 0" subcs
       done
 
       if [[ -z "$matched$hasopts" ]] && _requested options &&

-- 
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   


      reply	other threads:[~2000-05-28 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-28 17:35 PATCH: use _arguments in _which and _unhash Oliver Kiddle
2000-05-28 20:52 ` Bart Schaefer [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=1000528205243.ZM28260@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.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).